uricp 0.0.29 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/almalinux8/Dockerfile +2 -2
- data/features/rbd_access.feature +52 -0
- data/lib/uricp/curl_primitives.rb +8 -4
- data/lib/uricp/strategy/common.rb +4 -2
- data/lib/uricp/strategy/piped_rbd_get.rb +5 -2
- data/lib/uricp/strategy/piped_remote_get.rb +2 -1
- data/lib/uricp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4895addf1e14cf9a918d89e471fe0f30e12189bd942303806590aff1368a294
|
4
|
+
data.tar.gz: 97be8b34f73e4e0070cd6a0f6878a5f7dd9db465d7b5fd236c4497e72f5b83cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb45da786826b356a2a95b0764eb7e3d117d0933da0f0729e3473ee4715266217fe642fbe819a87f7b7330809bded5d1f7a92cc39c5c27c8766776577bec19e8
|
7
|
+
data.tar.gz: edc045ffc50f615a1f40ef8d4700c541658095ecef4eee84bbf196071a1e233c165eab0f8dd5c237d56aacbfe30ca7722db8398fd45de5fb46a6718356229368
|
data/Gemfile.lock
CHANGED
data/almalinux8/Dockerfile
CHANGED
@@ -3,11 +3,11 @@ MAINTAINER support@brightbox.co.uk
|
|
3
3
|
|
4
4
|
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
5
5
|
RUN dnf -y install dnf-plugins-core
|
6
|
-
RUN dnf config-manager --add-repo https://repo.almalinux.org/almalinux/8
|
6
|
+
RUN dnf config-manager --add-repo https://repo.almalinux.org/almalinux/8/devel/almalinux-devel.repo
|
7
|
+
RUN echo "8-stream" > /etc/dnf/vars/stream
|
7
8
|
RUN dnf -y update
|
8
9
|
RUN dnf config-manager --set-enabled powertools,devel
|
9
10
|
RUN dnf -y group install "Development Tools"
|
10
|
-
RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
11
11
|
RUN dnf -y install https://www.rdoproject.org/repos/rdo-release.el8.rpm
|
12
12
|
RUN dnf -y install \
|
13
13
|
git \
|
data/features/rbd_access.feature
CHANGED
@@ -246,3 +246,55 @@ Feature: Manipulate file images in ceph
|
|
246
246
|
"""
|
247
247
|
rbd snap protect --id libvirt 'servers/img-testy@base'
|
248
248
|
"""
|
249
|
+
|
250
|
+
Scenario: RBD export and upload to HTTPS
|
251
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
252
|
+
When I successfully run `uricp --dry-run --auth-token 'd75945e3b9159f1f14e91b2022bc53ea10481ed15e4a' --target-format 'raw' --compress --segment-size '1073741824B' --cache '/var/cache/domtrix' rbd:/servers/vol-yd63x https://orbit.gb1s.brightbox.com/v1/acc-8tgbq/images/img-cfwe0`
|
253
|
+
And the output should contain:
|
254
|
+
"""
|
255
|
+
rbd snap create --id libvirt 'servers/vol-yd63x@uricp_snap'
|
256
|
+
"""
|
257
|
+
And the output should contain:
|
258
|
+
"""
|
259
|
+
rbd snap protect --id libvirt 'servers/vol-yd63x@uricp_snap'
|
260
|
+
"""
|
261
|
+
And the output should not contain:
|
262
|
+
"""
|
263
|
+
rbd snap unprotect --id libvirt 'servers/vol-yd63x@uricp_snap'
|
264
|
+
"""
|
265
|
+
And the output should not contain:
|
266
|
+
"""
|
267
|
+
rbd snap rm --id libvirt 'servers/vol-yd63x@uricp_snap'
|
268
|
+
"""
|
269
|
+
And the output should not contain:
|
270
|
+
"""
|
271
|
+
rbd export --no-progress --id libvirt 'servers/vol-yd63x@uricp_snap' -
|
272
|
+
"""
|
273
|
+
And the output should contain:
|
274
|
+
"""
|
275
|
+
rbd clone --id libvirt 'servers/vol-yd63x@uricp_snap' 'servers/img-cfwe0'
|
276
|
+
"""
|
277
|
+
And the output should contain:
|
278
|
+
"""
|
279
|
+
rbd export --no-progress --id libvirt 'servers/img-cfwe0@base' -
|
280
|
+
"""
|
281
|
+
And the output should contain:
|
282
|
+
"""
|
283
|
+
rbd snap create --id libvirt 'servers/img-cfwe0@base'
|
284
|
+
"""
|
285
|
+
And the output should contain:
|
286
|
+
"""
|
287
|
+
rbd snap protect --id libvirt 'servers/img-cfwe0@base'
|
288
|
+
"""
|
289
|
+
And the output should contain:
|
290
|
+
"""
|
291
|
+
rbd export --no-progress --id libvirt 'servers/img-cfwe0@base' -
|
292
|
+
"""
|
293
|
+
And the output should contain:
|
294
|
+
"""
|
295
|
+
lz4
|
296
|
+
"""
|
297
|
+
And the output should contain:
|
298
|
+
"""
|
299
|
+
segment_upload --segment-size '1073741824.00 B' https://orbit.gb1s.brightbox.com/v1/acc-8tgbq/images/img-cfwe0
|
300
|
+
"""
|
@@ -24,22 +24,26 @@ module Uricp::CurlPrimitives
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def authentication
|
27
|
-
"-H X-Auth-Token:#{options['authenticator'].call}" if http_authentication?
|
27
|
+
"-H 'X-Auth-Token:#{options['authenticator'].call}'" if http_authentication?
|
28
28
|
end
|
29
29
|
|
30
30
|
def http_authentication?
|
31
31
|
options['authenticator']
|
32
32
|
end
|
33
33
|
|
34
|
+
def temp_url?
|
35
|
+
from && from.query.to_s.include?('temp_url')
|
36
|
+
end
|
37
|
+
|
34
38
|
def curl_upload_from(source, destination = to)
|
35
|
-
"#{curl_command} #{authentication} -T #{source} #{destination};"
|
39
|
+
"#{curl_command} #{authentication} -T '#{source}' '#{destination}';"
|
36
40
|
end
|
37
41
|
|
38
42
|
def curl_download_to_pipe
|
39
|
-
"#{curl_command} #{authentication} #{from} |"
|
43
|
+
"#{curl_command} #{authentication unless temp_url?} '#{from}' |"
|
40
44
|
end
|
41
45
|
|
42
46
|
def curl_manifest(object_manifest, destination = to)
|
43
|
-
"#{curl_command} #{authentication} -X PUT -H 'X-Object-Manifest: #{object_manifest}' #{destination} --data-binary ''"
|
47
|
+
"#{curl_command} #{authentication} -X PUT -H 'X-Object-Manifest: #{object_manifest}' '#{destination}' --data-binary ''"
|
44
48
|
end
|
45
49
|
end
|
@@ -6,6 +6,8 @@ module Uricp::Strategy
|
|
6
6
|
include Uricp::CurlPrimitives
|
7
7
|
include Methadone::SH
|
8
8
|
|
9
|
+
VOL_REGEX = /^(srv|vol)-.....$/
|
10
|
+
|
9
11
|
def initialize(options)
|
10
12
|
@options = options
|
11
13
|
debug "#{self.class.name}: options are #{options.inspect}"
|
@@ -168,7 +170,7 @@ module Uricp::Strategy
|
|
168
170
|
def rbd_cache_image_exists?(target)
|
169
171
|
command = "rbd status --id #{rbd_id} --format json #{target} 2>/dev/null"
|
170
172
|
if dry_run?
|
171
|
-
if options['dry-cache'] == :partial_rbd && options['cache_name'] !~
|
173
|
+
if options['dry-cache'] == :partial_rbd && options['cache_name'] !~ VOL_REGEX
|
172
174
|
command = 'exit 0'
|
173
175
|
else
|
174
176
|
command = 'exit 2'
|
@@ -193,7 +195,7 @@ module Uricp::Strategy
|
|
193
195
|
def in_rbd_cache(target)
|
194
196
|
result =
|
195
197
|
if dry_run?
|
196
|
-
options['dry-cache'] == :rbd && options['cache_name'] !~
|
198
|
+
options['dry-cache'] == :rbd && options['cache_name'] !~ VOL_REGEX
|
197
199
|
else
|
198
200
|
snap_check(target, rbd_base_name)
|
199
201
|
end
|
@@ -10,8 +10,10 @@ module Uricp::Strategy
|
|
10
10
|
without_active_cache do
|
11
11
|
if from.scheme == 'rbd' &&
|
12
12
|
rbd_snapshot_spec?(from) &&
|
13
|
-
to.scheme != 'rbd'
|
14
|
-
|
13
|
+
to.scheme != 'rbd' &&
|
14
|
+
(!conversion_required? || raw_target?) &&
|
15
|
+
!sequence_complete?
|
16
|
+
return proposal
|
15
17
|
end
|
16
18
|
end
|
17
19
|
debug "#{self.class.name}: not appropriate"
|
@@ -25,6 +27,7 @@ module Uricp::Strategy
|
|
25
27
|
def proposal
|
26
28
|
@proposed_options = options.dup
|
27
29
|
@proposed_options['from_uri'] = PIPE_URI
|
30
|
+
@proposed_options.delete('target-format')
|
28
31
|
self
|
29
32
|
end
|
30
33
|
end
|
@@ -75,7 +75,8 @@ module Uricp::Strategy
|
|
75
75
|
|
76
76
|
def headers
|
77
77
|
headers = { 'Range' => 'bytes=0-7' }
|
78
|
-
headers
|
78
|
+
return headers if !http_authentication? || temp_url?
|
79
|
+
headers['X-Auth-Token'] = options['authenticator'].call
|
79
80
|
headers
|
80
81
|
end
|
81
82
|
end
|
data/lib/uricp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uricp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|