uricp 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/Gemfile.lock +1 -1
- data/almalinux8/Dockerfile +9 -9
- data/features/rbd_access.feature +72 -32
- data/features/support/env.rb +15 -1
- data/lib/uricp/strategy/common.rb +11 -1
- data/lib/uricp/strategy/rbd_cache_clone.rb +4 -1
- data/lib/uricp/strategy/rbd_cached_get.rb +1 -1
- data/lib/uricp/strategy/rbd_cached_put.rb +1 -1
- data/lib/uricp/version.rb +1 -1
- data/uricp.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 64bb8cc88ca0e71e7cc30ba7b1b3bf7f585d7b4d2100ce6bc9f1d06f05bf6d4b
|
|
4
|
+
data.tar.gz: 5b771704aac9b087c7fb71743aa45cb381ab2871ca5ee2f682e150965a0f6540
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be9f8a1cce7949ebc7c12e7abc8168b08a37ac45538f1fe2dc20efcf6edd3c031b3a8ebdf0a544aa12e45cc512e8d5233f93ebf096bf1d3f08f0c2d43ba04c7e
|
|
7
|
+
data.tar.gz: 113be9c96ac0bdea702276a1bf509c43603d72d79dfe74801cd41bfcaa582151446656867d609a5648b83499f3bf815d74f7794fa2d4ab2b0eec29413b776ac9
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 2.7.8
|
data/Gemfile.lock
CHANGED
data/almalinux8/Dockerfile
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
FROM almalinux:8
|
|
1
|
+
FROM almalinux:8
|
|
2
2
|
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/devel/almalinux-devel.repo
|
|
7
|
-
#RUN echo "8-stream" > /etc/dnf/vars/stream
|
|
8
|
-
#RUN dnf -y update
|
|
9
|
-
#RUN dnf config-manager --set-enabled powertools,devel
|
|
10
6
|
RUN dnf config-manager --set-enabled powertools
|
|
11
7
|
RUN dnf -y group install "Development Tools"
|
|
12
|
-
RUN dnf -y install https://www.rdoproject.org/repos/rdo-release.el8.rpm
|
|
13
8
|
RUN dnf -y install \
|
|
14
9
|
git \
|
|
15
10
|
lz4 \
|
|
16
11
|
qemu-img \
|
|
17
12
|
ruby-devel \
|
|
13
|
+
python3-pip \
|
|
18
14
|
rubygems \
|
|
19
|
-
rubygem-bundler
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
rubygem-bundler
|
|
16
|
+
# Ceph
|
|
17
|
+
RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
|
18
|
+
RUN dnf -y install http://download.ceph.com/rpm-pacific/el8/noarch/ceph-release-1-1.el8.noarch.rpm
|
|
19
|
+
RUN dnf -y install ceph-common
|
|
20
|
+
# Swiftclient
|
|
21
|
+
RUN pip3 install python-swiftclient
|
|
22
22
|
RUN mkdir -p /etc/ceph
|
|
23
23
|
ARG RBD_USR=libvirt
|
|
24
24
|
ARG RBD_PSW
|
data/features/rbd_access.feature
CHANGED
|
@@ -32,7 +32,7 @@ Feature: Manipulate file images in ceph
|
|
|
32
32
|
"""
|
|
33
33
|
And the output should contain:
|
|
34
34
|
"""
|
|
35
|
-
rbd clone --id libvirt 'servers/freedos.qcow2@base' 'servers/srv-testy' || { [ $? -eq 22 ] && rbd create --id libvirt -s 0 'servers/srv-testy'; };
|
|
35
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/freedos.qcow2@base' 'servers/srv-testy' || { [ $? -eq 22 ] && rbd create --id libvirt -s 0 'servers/srv-testy'; };
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
38
|
Scenario: HTTP URI from file cache via unpopulated rbd cache
|
|
@@ -53,7 +53,7 @@ Feature: Manipulate file images in ceph
|
|
|
53
53
|
"""
|
|
54
54
|
And the output should contain:
|
|
55
55
|
"""
|
|
56
|
-
rbd clone --id libvirt 'servers/freedos.qcow2@base' 'servers/srv-testy'
|
|
56
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/freedos.qcow2@base' 'servers/srv-testy'
|
|
57
57
|
"""
|
|
58
58
|
|
|
59
59
|
Scenario: HTTP URI to rbd via partial rbd caches
|
|
@@ -77,7 +77,7 @@ Feature: Manipulate file images in ceph
|
|
|
77
77
|
"""
|
|
78
78
|
And the output should contain:
|
|
79
79
|
"""
|
|
80
|
-
rbd clone --id libvirt 'servers/freedos.qcow2@base' 'servers/srv-testy'
|
|
80
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/freedos.qcow2@base' 'servers/srv-testy'
|
|
81
81
|
"""
|
|
82
82
|
|
|
83
83
|
Scenario: file URI to rbd via cache
|
|
@@ -105,23 +105,23 @@ Feature: Manipulate file images in ceph
|
|
|
105
105
|
When I successfully run `uricp --dry-run rbd:///servers/img-testy rbd:///servers/srv-testy`
|
|
106
106
|
And the output should contain:
|
|
107
107
|
"""
|
|
108
|
-
rbd snap create --id libvirt 'servers/img-testy@uricp_snap'
|
|
108
|
+
rbd snap create --id libvirt 'servers/img-testy@srv-testy-uricp_snap'
|
|
109
109
|
"""
|
|
110
110
|
And the output should contain:
|
|
111
111
|
"""
|
|
112
|
-
rbd snap protect --id libvirt 'servers/img-testy@uricp_snap'
|
|
112
|
+
rbd snap protect --id libvirt 'servers/img-testy@srv-testy-uricp_snap'
|
|
113
113
|
"""
|
|
114
114
|
And the output should not contain:
|
|
115
115
|
"""
|
|
116
|
-
rbd snap unprotect --id libvirt 'servers/img-testy@uricp_snap'
|
|
116
|
+
rbd snap unprotect --id libvirt 'servers/img-testy@srv-testy-uricp_snap'
|
|
117
117
|
"""
|
|
118
118
|
And the output should not contain:
|
|
119
119
|
"""
|
|
120
|
-
rbd snap rm --id libvirt 'servers/img-testy@uricp_snap'
|
|
120
|
+
rbd snap rm --id libvirt 'servers/img-testy@srv-testy-uricp_snap'
|
|
121
121
|
"""
|
|
122
122
|
And the output should contain:
|
|
123
123
|
"""
|
|
124
|
-
rbd clone --id libvirt 'servers/img-testy@uricp_snap' 'servers/srv-testy'
|
|
124
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/img-testy@srv-testy-uricp_snap' 'servers/srv-testy'
|
|
125
125
|
"""
|
|
126
126
|
|
|
127
127
|
Scenario: rbd to rbd - unpopulated cache
|
|
@@ -129,27 +129,27 @@ Feature: Manipulate file images in ceph
|
|
|
129
129
|
When I successfully run `uricp --dry-run --cache=/tmp/uricp rbd:///servers/srv-testy rbd:///servers/img-testy`
|
|
130
130
|
And the output should contain:
|
|
131
131
|
"""
|
|
132
|
-
rbd snap create --id libvirt 'servers/srv-testy@uricp_snap'
|
|
132
|
+
rbd snap create --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
133
133
|
"""
|
|
134
134
|
And the output should contain:
|
|
135
135
|
"""
|
|
136
|
-
rbd snap protect --id libvirt 'servers/srv-testy@uricp_snap'
|
|
136
|
+
rbd snap protect --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
137
137
|
"""
|
|
138
138
|
And the output should not contain:
|
|
139
139
|
"""
|
|
140
|
-
rbd snap unprotect --id libvirt 'servers/srv-testy@uricp_snap'
|
|
140
|
+
rbd snap unprotect --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
141
141
|
"""
|
|
142
142
|
And the output should not contain:
|
|
143
143
|
"""
|
|
144
|
-
rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap'
|
|
144
|
+
rbd snap rm --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
145
145
|
"""
|
|
146
146
|
And the output should not contain:
|
|
147
147
|
"""
|
|
148
|
-
rbd export --no-progress --id libvirt 'servers/srv-testy@uricp_snap' -
|
|
148
|
+
rbd export --no-progress --id libvirt 'servers/srv-testy@img-testy-uricp_snap' -
|
|
149
149
|
"""
|
|
150
150
|
And the output should contain:
|
|
151
151
|
"""
|
|
152
|
-
rbd clone --id libvirt 'servers/srv-testy@uricp_snap' 'servers/img-testy'
|
|
152
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/srv-testy@img-testy-uricp_snap' 'servers/img-testy'
|
|
153
153
|
"""
|
|
154
154
|
And the output should not contain:
|
|
155
155
|
"""
|
|
@@ -182,7 +182,47 @@ Feature: Manipulate file images in ceph
|
|
|
182
182
|
"""
|
|
183
183
|
And the output should contain:
|
|
184
184
|
"""
|
|
185
|
-
rbd clone --id libvirt 'servers/img-testy@base' 'servers/srv-testy'
|
|
185
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/img-testy@base' 'servers/srv-testy'
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
Scenario: rbd disk to rbd disk - cache ignored
|
|
189
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
190
|
+
When I successfully run `uricp --dry-run --cache=/tmp/uricp rbd:///servers/vol-testy rbd:///servers/vol-copyy`
|
|
191
|
+
And the output should contain:
|
|
192
|
+
"""
|
|
193
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/vol-testy@vol-copyy-uricp_snap' 'servers/vol-copyy'
|
|
194
|
+
"""
|
|
195
|
+
And the output should not contain:
|
|
196
|
+
"""
|
|
197
|
+
@base
|
|
198
|
+
"""
|
|
199
|
+
|
|
200
|
+
Scenario: rbd disk to a file that is not an image - cache ignored
|
|
201
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
202
|
+
When I successfully run `uricp --dry-run --cache=/tmp/uricp rbd:///servers/vol-testy file:///tmp/uricp/backup.raw`
|
|
203
|
+
And the output should contain:
|
|
204
|
+
"""
|
|
205
|
+
rbd export --no-progress --id libvirt 'servers/vol-testy@backup.raw-uricp_snap' -
|
|
206
|
+
"""
|
|
207
|
+
And the output should contain:
|
|
208
|
+
"""
|
|
209
|
+
rbd snap rm --id libvirt 'servers/vol-testy@backup.raw-uricp_snap'
|
|
210
|
+
"""
|
|
211
|
+
And the output should not contain:
|
|
212
|
+
"""
|
|
213
|
+
rbd clone
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
Scenario: rbd disk with a base snapshot to rbd disk
|
|
217
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
218
|
+
When I successfully run `uricp --dry-run --dry-cache=rbd --cache=/tmp/uricp rbd:///servers/srv-testy-vol rbd:///servers/vol-copyy`
|
|
219
|
+
And the output should contain:
|
|
220
|
+
"""
|
|
221
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/srv-testy-vol@vol-copyy-uricp_snap' 'servers/vol-copyy'
|
|
222
|
+
"""
|
|
223
|
+
And the output should not contain:
|
|
224
|
+
"""
|
|
225
|
+
@base
|
|
186
226
|
"""
|
|
187
227
|
|
|
188
228
|
Scenario: RBD export.
|
|
@@ -190,23 +230,23 @@ Feature: Manipulate file images in ceph
|
|
|
190
230
|
When I successfully run `uricp --dry-run --compress rbd:///servers/srv-testy file:///tmp/img-testy`
|
|
191
231
|
And the output should contain:
|
|
192
232
|
"""
|
|
193
|
-
rbd snap create --id libvirt 'servers/srv-testy@uricp_snap'
|
|
233
|
+
rbd snap create --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
194
234
|
"""
|
|
195
235
|
And the output should contain:
|
|
196
236
|
"""
|
|
197
|
-
rbd snap protect --id libvirt 'servers/srv-testy@uricp_snap'
|
|
237
|
+
rbd snap protect --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
198
238
|
"""
|
|
199
239
|
And the output should contain:
|
|
200
240
|
"""
|
|
201
|
-
rbd snap unprotect --id libvirt 'servers/srv-testy@uricp_snap'
|
|
241
|
+
rbd snap unprotect --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
202
242
|
"""
|
|
203
243
|
And the output should contain:
|
|
204
244
|
"""
|
|
205
|
-
rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap'
|
|
245
|
+
rbd snap rm --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
206
246
|
"""
|
|
207
247
|
And the output should contain:
|
|
208
248
|
"""
|
|
209
|
-
rbd export --no-progress --id libvirt 'servers/srv-testy@uricp_snap' -
|
|
249
|
+
rbd export --no-progress --id libvirt 'servers/srv-testy@img-testy-uricp_snap' -
|
|
210
250
|
"""
|
|
211
251
|
|
|
212
252
|
Scenario: RBD export with cacheing - populated cache
|
|
@@ -232,27 +272,27 @@ Feature: Manipulate file images in ceph
|
|
|
232
272
|
When I successfully run `uricp --dry-run --compress --cache=/tmp/uricp rbd:///servers/srv-testy file:///tmp/img-testy`
|
|
233
273
|
And the output should contain:
|
|
234
274
|
"""
|
|
235
|
-
rbd snap create --id libvirt 'servers/srv-testy@uricp_snap'
|
|
275
|
+
rbd snap create --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
236
276
|
"""
|
|
237
277
|
And the output should contain:
|
|
238
278
|
"""
|
|
239
|
-
rbd snap protect --id libvirt 'servers/srv-testy@uricp_snap'
|
|
279
|
+
rbd snap protect --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
240
280
|
"""
|
|
241
281
|
And the output should not contain:
|
|
242
282
|
"""
|
|
243
|
-
rbd snap unprotect --id libvirt 'servers/srv-testy@uricp_snap'
|
|
283
|
+
rbd snap unprotect --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
244
284
|
"""
|
|
245
285
|
And the output should not contain:
|
|
246
286
|
"""
|
|
247
|
-
rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap'
|
|
287
|
+
rbd snap rm --id libvirt 'servers/srv-testy@img-testy-uricp_snap'
|
|
248
288
|
"""
|
|
249
289
|
And the output should not contain:
|
|
250
290
|
"""
|
|
251
|
-
rbd export --no-progress --id libvirt 'servers/srv-testy@uricp_snap' -
|
|
291
|
+
rbd export --no-progress --id libvirt 'servers/srv-testy@img-testy-uricp_snap' -
|
|
252
292
|
"""
|
|
253
293
|
And the output should contain:
|
|
254
294
|
"""
|
|
255
|
-
rbd clone --id libvirt 'servers/srv-testy@uricp_snap' 'servers/img-testy'
|
|
295
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/srv-testy@img-testy-uricp_snap' 'servers/img-testy'
|
|
256
296
|
"""
|
|
257
297
|
And the output should contain:
|
|
258
298
|
"""
|
|
@@ -272,27 +312,27 @@ Feature: Manipulate file images in ceph
|
|
|
272
312
|
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`
|
|
273
313
|
And the output should contain:
|
|
274
314
|
"""
|
|
275
|
-
rbd snap create --id libvirt 'servers/vol-yd63x@uricp_snap'
|
|
315
|
+
rbd snap create --id libvirt 'servers/vol-yd63x@img-cfwe0-uricp_snap'
|
|
276
316
|
"""
|
|
277
317
|
And the output should contain:
|
|
278
318
|
"""
|
|
279
|
-
rbd snap protect --id libvirt 'servers/vol-yd63x@uricp_snap'
|
|
319
|
+
rbd snap protect --id libvirt 'servers/vol-yd63x@img-cfwe0-uricp_snap'
|
|
280
320
|
"""
|
|
281
321
|
And the output should not contain:
|
|
282
322
|
"""
|
|
283
|
-
rbd snap unprotect --id libvirt 'servers/vol-yd63x@uricp_snap'
|
|
323
|
+
rbd snap unprotect --id libvirt 'servers/vol-yd63x@img-cfwe0-uricp_snap'
|
|
284
324
|
"""
|
|
285
325
|
And the output should not contain:
|
|
286
326
|
"""
|
|
287
|
-
rbd snap rm --id libvirt 'servers/vol-yd63x@uricp_snap'
|
|
327
|
+
rbd snap rm --id libvirt 'servers/vol-yd63x@img-cfwe0-uricp_snap'
|
|
288
328
|
"""
|
|
289
329
|
And the output should not contain:
|
|
290
330
|
"""
|
|
291
|
-
rbd export --no-progress --id libvirt 'servers/vol-yd63x@uricp_snap' -
|
|
331
|
+
rbd export --no-progress --id libvirt 'servers/vol-yd63x@img-cfwe0-uricp_snap' -
|
|
292
332
|
"""
|
|
293
333
|
And the output should contain:
|
|
294
334
|
"""
|
|
295
|
-
rbd clone --id libvirt 'servers/vol-yd63x@uricp_snap' 'servers/img-cfwe0'
|
|
335
|
+
rbd clone --id libvirt --rbd-default-clone-format 2 'servers/vol-yd63x@img-cfwe0-uricp_snap' 'servers/img-cfwe0'
|
|
296
336
|
"""
|
|
297
337
|
And the output should contain:
|
|
298
338
|
"""
|
data/features/support/env.rb
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
require 'aruba/cucumber'
|
|
2
2
|
require 'methadone/cucumber'
|
|
3
3
|
require 'fileutils'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
|
|
6
|
+
# The features refer to their scratch area as /tmp/uricp. Put it under the
|
|
7
|
+
# standard temp directory instead ($TMPDIR, defaulting to /tmp).
|
|
8
|
+
FEATURE_DIR = '/tmp/uricp'
|
|
9
|
+
TEST_DIR = File.join(Dir.tmpdir, 'uricp')
|
|
10
|
+
|
|
11
|
+
# Rewrite the path in every step argument, including docstrings.
|
|
12
|
+
module UseTestDir
|
|
13
|
+
def invoke(args)
|
|
14
|
+
super(args.map { |a| a.is_a?(String) ? String.new(a).gsub(FEATURE_DIR, TEST_DIR) : a })
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
Cucumber::RbSupport::RbStepDefinition.prepend(UseTestDir)
|
|
4
18
|
|
|
5
19
|
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
|
6
20
|
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
|
@@ -15,6 +29,6 @@ end
|
|
|
15
29
|
After do
|
|
16
30
|
ENV['RUBYLIB'] = @original_rubylib
|
|
17
31
|
|
|
18
|
-
FileUtils.rm_rf(Dir.glob('
|
|
32
|
+
FileUtils.rm_rf(Dir.glob(File.join(TEST_DIR, '*')))
|
|
19
33
|
|
|
20
34
|
end
|
|
@@ -7,6 +7,7 @@ module Uricp::Strategy
|
|
|
7
7
|
include Methadone::SH
|
|
8
8
|
|
|
9
9
|
VOL_REGEX = /^(srv|vol)-.....$/
|
|
10
|
+
IMAGE_REGEX = /\Aimg-/.freeze
|
|
10
11
|
|
|
11
12
|
def initialize(options)
|
|
12
13
|
@options = options
|
|
@@ -115,8 +116,11 @@ module Uricp::Strategy
|
|
|
115
116
|
'base'
|
|
116
117
|
end
|
|
117
118
|
|
|
119
|
+
# Prefixed with the target name so snapshot listings show which
|
|
120
|
+
# copy each snapshot was taken for.
|
|
118
121
|
def rbd_snapshot_name
|
|
119
|
-
@rbd_snapshot_name ||=
|
|
122
|
+
@rbd_snapshot_name ||=
|
|
123
|
+
"#{File.basename(to.path)}-#{dry_run? ? DRY_SNAP : SecureRandom.uuid}"
|
|
120
124
|
end
|
|
121
125
|
|
|
122
126
|
def get_temp_filename(base_dir)
|
|
@@ -176,6 +180,12 @@ module Uricp::Strategy
|
|
|
176
180
|
uri.scheme == 'rbd' && uri.path.include?('@')
|
|
177
181
|
end
|
|
178
182
|
|
|
183
|
+
# Only images are cached in RBD. Anything else, such as a server or volume
|
|
184
|
+
# disk, may change after it is copied, so it is never used as a cache.
|
|
185
|
+
def image_cache_name?(uri)
|
|
186
|
+
File.basename(uri.path).match?(IMAGE_REGEX)
|
|
187
|
+
end
|
|
188
|
+
|
|
179
189
|
def rbd_cache_upload_available?
|
|
180
190
|
rbd_cache_name && !rbd_cache_image_exists?(rbd_cache_name)
|
|
181
191
|
end
|
|
@@ -14,6 +14,9 @@ module Uricp::Strategy
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
with_active_cache do
|
|
17
|
+
# Only cache copies to an image; anything else is a plain copy
|
|
18
|
+
return proposal(nil) unless image_cache_name?(to)
|
|
19
|
+
|
|
17
20
|
options['cache_name'] = File.basename(options['to_uri'].path)
|
|
18
21
|
cache_target = rbd_cache_image_spec(from)
|
|
19
22
|
if rbd_cache_image_exists?(cache_target) || in_rbd_cache(cache_target)
|
|
@@ -30,7 +33,7 @@ module Uricp::Strategy
|
|
|
30
33
|
|
|
31
34
|
def proposal(cache_check)
|
|
32
35
|
@proposed_options = options.dup
|
|
33
|
-
@proposed_options['rbd_cache_target'] = rbd_uri(cache_check)
|
|
36
|
+
@proposed_options['rbd_cache_target'] = rbd_uri(cache_check) if cache_check
|
|
34
37
|
@proposed_options.delete('cache')
|
|
35
38
|
@proposed_options.delete('cache_name')
|
|
36
39
|
@proposed_options.delete('dry-cache')
|
|
@@ -8,7 +8,7 @@ module Uricp::Strategy
|
|
|
8
8
|
include Uricp::Strategy::CacheCommon
|
|
9
9
|
|
|
10
10
|
def appropriate?
|
|
11
|
-
if from.scheme != 'rbd' || rbd_snapshot_spec?(from)
|
|
11
|
+
if from.scheme != 'rbd' || rbd_snapshot_spec?(from) || !image_cache_name?(from)
|
|
12
12
|
debug "#{self.class.name}: not appropriate"
|
|
13
13
|
return false
|
|
14
14
|
end
|
|
@@ -16,7 +16,7 @@ module Uricp::Strategy
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def command
|
|
19
|
-
"rbd clone --id #{rbd_id} '#{rbd_image_spec(from)}' "\
|
|
19
|
+
"rbd clone --id #{rbd_id} --rbd-default-clone-format 2 '#{rbd_image_spec(from)}' "\
|
|
20
20
|
"'#{rbd_image_spec(to)}' || { [ $? -eq 22 ] && "\
|
|
21
21
|
"rbd create --id #{rbd_id} -s 0 '#{rbd_image_spec(to)}'; };"
|
|
22
22
|
end
|
data/lib/uricp/version.rb
CHANGED
data/uricp.gemspec
CHANGED
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
|
14
14
|
spec.homepage = ''
|
|
15
15
|
spec.license = 'gplv3'
|
|
16
16
|
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('docs/') || (f.end_with?('.md') && f != 'README.md') }
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
20
|
spec.require_paths = ['lib']
|
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.38
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Neil Wilson
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aruba
|
|
@@ -161,6 +161,7 @@ extra_rdoc_files: []
|
|
|
161
161
|
files:
|
|
162
162
|
- ".gitignore"
|
|
163
163
|
- ".rubocop.yml"
|
|
164
|
+
- ".tool-versions"
|
|
164
165
|
- Gemfile
|
|
165
166
|
- Gemfile.lock
|
|
166
167
|
- Jenkinsfile
|
|
@@ -227,7 +228,7 @@ homepage: ''
|
|
|
227
228
|
licenses:
|
|
228
229
|
- gplv3
|
|
229
230
|
metadata: {}
|
|
230
|
-
post_install_message:
|
|
231
|
+
post_install_message:
|
|
231
232
|
rdoc_options: []
|
|
232
233
|
require_paths:
|
|
233
234
|
- lib
|
|
@@ -242,8 +243,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
242
243
|
- !ruby/object:Gem::Version
|
|
243
244
|
version: '0'
|
|
244
245
|
requirements: []
|
|
245
|
-
rubygems_version: 3.
|
|
246
|
-
signing_key:
|
|
246
|
+
rubygems_version: 3.1.6
|
|
247
|
+
signing_key:
|
|
247
248
|
specification_version: 4
|
|
248
249
|
summary: Copy one URL to another with optional cacheing
|
|
249
250
|
test_files:
|