uricp 0.0.21 → 0.0.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aeaa81822977930906959744feb0d8bdf9ca820afd10e6b97d32a726cbf67391
4
- data.tar.gz: cd29b49f83ba53a275f4574c32cbb7f1b92c5218421cef668355a14ab5a36bec
3
+ metadata.gz: 1e1b637ff4ba7720c05496e44d43b9dbe71908bb8bf1605e7a64c2ed1497f273
4
+ data.tar.gz: 037bd61ab71e9f18bd654779d6fe7049d42124f678737c5703e7a76eef9448df
5
5
  SHA512:
6
- metadata.gz: 56c0e441da6e7e709580e09cdcc68c56b3ff731fc9fd028e56160dbfca427048ecab2f79c049f490bd15bcb027a67ec1b4aa01ddd2ce801cda89ad53f9ba6efa
7
- data.tar.gz: 92122076440ca0cbd0345f29bf4386503c9f3830d6a4ffbfc92a4f55e40b9ea7790ff81cc1ebf1101ce7ac4cb552c312bf2be0cc5c3c49f0b727ab0247f46f90
6
+ metadata.gz: d71cb3c6211690160d6a57130eff9b6ed3043f497ef9b182f1aefd9dbb378d186c16c7093e637f2ed718867d47f6e6a50059976440ece998f8c313facd701be8
7
+ data.tar.gz: d7feeb5ab8fe6b98e6895d442f38c8404fcc12687dcc851485f6e38e640eb31cfe1bb0dfb2e0803d50261594e918e92034f1653f9ece0d457fea15f98cfbbd3a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uricp (0.0.21)
4
+ uricp (0.0.22)
5
5
  childprocess (~> 1.0)
6
6
  filesize (= 0.0.2)
7
7
  methadone (~> 2.0.2)
data/bin/uricp CHANGED
@@ -4,6 +4,7 @@ require 'optparse'
4
4
  require 'uri'
5
5
  require 'methadone'
6
6
  require 'filesize'
7
+ require 'securerandom'
7
8
  require 'uricp'
8
9
 
9
10
  class App
@@ -79,13 +79,13 @@ Feature: Manipulate file images in ceph
79
79
  """
80
80
  rbd snap protect --id libvirt 'servers/img-testy@uricp_snap'
81
81
  """
82
- And the output should contain:
82
+ And the output should not contain:
83
83
  """
84
84
  rbd snap unprotect --id libvirt 'servers/img-testy@uricp_snap'
85
85
  """
86
- And the output should contain:
86
+ And the output should not contain:
87
87
  """
88
- rbd snap rm --id libvirt 'servers/img-testy@uricp_snap';
88
+ rbd snap rm --id libvirt 'servers/img-testy@uricp_snap'
89
89
  """
90
90
  And the output should contain:
91
91
  """
@@ -103,13 +103,13 @@ Feature: Manipulate file images in ceph
103
103
  """
104
104
  rbd snap protect --id libvirt 'servers/srv-testy@uricp_snap'
105
105
  """
106
- And the output should contain:
106
+ And the output should not contain:
107
107
  """
108
108
  rbd snap unprotect --id libvirt 'servers/srv-testy@uricp_snap'
109
109
  """
110
- And the output should contain:
110
+ And the output should not contain:
111
111
  """
112
- rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap';
112
+ rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap'
113
113
  """
114
114
  And the output should not contain:
115
115
  """
@@ -131,10 +131,6 @@ Feature: Manipulate file images in ceph
131
131
  """
132
132
  rbd snap protect --id libvirt 'servers/img-testy@base'
133
133
  """
134
- And the output should contain:
135
- """
136
- rbd flatten --id libvirt --no-progress 'servers/img-testy'
137
- """
138
134
 
139
135
  Scenario: rbd to rbd - populated cache
140
136
  Given a correctly initialised cache at "/tmp/uricp"
@@ -165,7 +161,7 @@ Feature: Manipulate file images in ceph
165
161
  """
166
162
  And the output should contain:
167
163
  """
168
- rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap';
164
+ rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap'
169
165
  """
170
166
  And the output should contain:
171
167
  """
@@ -192,13 +188,13 @@ Feature: Manipulate file images in ceph
192
188
  """
193
189
  rbd snap protect --id libvirt 'servers/srv-testy@uricp_snap'
194
190
  """
195
- And the output should contain:
191
+ And the output should not contain:
196
192
  """
197
193
  rbd snap unprotect --id libvirt 'servers/srv-testy@uricp_snap'
198
194
  """
199
- And the output should contain:
195
+ And the output should not contain:
200
196
  """
201
- rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap';
197
+ rbd snap rm --id libvirt 'servers/srv-testy@uricp_snap'
202
198
  """
203
199
  And the output should not contain:
204
200
  """
@@ -220,7 +216,3 @@ Feature: Manipulate file images in ceph
220
216
  """
221
217
  rbd snap protect --id libvirt 'servers/img-testy@base'
222
218
  """
223
- And the output should contain:
224
- """
225
- rbd flatten --id libvirt --no-progress 'servers/img-testy'
226
- """
@@ -91,12 +91,14 @@ module Uricp::Strategy
91
91
  end
92
92
 
93
93
  PIPE_URI = URI('pipe:/')
94
+ DRY_SNAP = 'uricp_snap'.freeze
95
+
94
96
  def rbd_base_name
95
97
  'base'.freeze
96
98
  end
97
99
 
98
100
  def rbd_snapshot_name
99
- 'uricp_snap'.freeze
101
+ @rbd_snapshot_name ||= dry_run? ? DRY_SNAP : SecureRandom.uuid
100
102
  end
101
103
 
102
104
  def get_temp_filename(base_dir)
@@ -13,7 +13,7 @@ module Uricp::Strategy
13
13
  end
14
14
 
15
15
  def command
16
- "rbd snap create --id #{rbd_id} '#{rbd_clone_snapshot(rbd_cache_name)}' && "\
16
+ "rbd snap create --id #{rbd_id} '#{rbd_clone_snapshot(rbd_cache_name)}';"\
17
17
  "rbd snap protect --id #{rbd_id} '#{rbd_clone_snapshot(rbd_cache_name)}';"
18
18
  end
19
19
 
@@ -19,7 +19,7 @@ module Uricp::Strategy
19
19
  end
20
20
 
21
21
  def command
22
- "rbd import --no-progress --id #{rbd_id} #{data_source} '#{rbd_cache_name}' && "
22
+ "rbd import --no-progress --id #{rbd_id} #{data_source} '#{rbd_cache_name}';"
23
23
  end
24
24
 
25
25
  def proposal
@@ -23,7 +23,6 @@ module Uricp::Strategy
23
23
  if options['rbd_cache_target']
24
24
  @proposed_options['to_uri'] = options['rbd_cache_target']
25
25
  @proposed_options['rbd_cache_name'] = rbd_image_spec(to)
26
- @proposed_options['rbd_flatten'] ||= @proposed_options['rbd_cache_name']
27
26
  @proposed_options.delete('rbd_cache_target')
28
27
  end
29
28
  self
@@ -24,17 +24,18 @@ module Uricp::Strategy
24
24
  end
25
25
 
26
26
  def command
27
- "rbd snap create --id #{rbd_id} '#{rbd_upload_snapshot(from)}' && " \
28
- "rbd snap protect --id #{rbd_id} '#{rbd_upload_snapshot(from)}' && " \
27
+ "rbd snap create --id #{rbd_id} '#{rbd_upload_snapshot(from)}';" \
28
+ "rbd snap protect --id #{rbd_id} '#{rbd_upload_snapshot(from)}';" \
29
29
  end
30
30
 
31
31
  def proposal
32
32
  @proposed_options = options.dup
33
- @proposed_options['rbd_snapshot'] = rbd_upload_snapshot(from)
34
- @proposed_options['from_uri'] = rbd_uri(@proposed_options['rbd_snapshot'])
33
+ @proposed_options['from_uri'] = rbd_uri(rbd_upload_snapshot(from))
35
34
  if options['rbd_cache_target']
36
35
  @proposed_options['to_uri'] = options['rbd_cache_target']
37
36
  @proposed_options['rbd_cache_target'] = to
37
+ else
38
+ @proposed_options['rbd_snapshot'] = rbd_upload_snapshot(from) unless to.scheme == 'rbd'
38
39
  end
39
40
  self
40
41
  end
@@ -10,7 +10,7 @@ module Uricp::Strategy
10
10
  end
11
11
 
12
12
  def command
13
- "rbd snap unprotect --id #{rbd_id} '#{options['rbd_snapshot']}' && " \
13
+ "rbd snap unprotect --id #{rbd_id} '#{options['rbd_snapshot']}';" \
14
14
  "rbd snap rm --id #{rbd_id} '#{options['rbd_snapshot']}';"
15
15
  end
16
16
 
@@ -49,7 +49,6 @@ module Uricp
49
49
  Strategy::PipedLocalGet,
50
50
  Strategy::PipedLocalPut,
51
51
  Strategy::Cleaner,
52
- Strategy::RbdFlattener,
53
52
  Strategy::RbdSweeper,
54
53
  Strategy::Sweeper
55
54
  ].freeze
data/lib/uricp/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uricp
4
- VERSION = '0.0.21'
4
+ VERSION = '0.0.22'
5
5
  DEFAULT_SEGMENT_SIZE = '5 GiB'
6
6
  end
data/lib/uricp.rb CHANGED
@@ -29,7 +29,6 @@ require 'uricp/strategy/rbd_cache_clone'
29
29
  require 'uricp/strategy/rbd_cached_get'
30
30
  require 'uricp/strategy/rbd_cached_put'
31
31
  require 'uricp/strategy/rbd_cache_upload'
32
- require 'uricp/strategy/rbd_flattener'
33
32
  require 'uricp/strategy/rbd_put'
34
33
  require 'uricp/strategy/rbd_snap'
35
34
  require 'uricp/strategy/rbd_sweeper'
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.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-14 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -229,7 +229,6 @@ files:
229
229
  - lib/uricp/strategy/rbd_cache_upload.rb
230
230
  - lib/uricp/strategy/rbd_cached_get.rb
231
231
  - lib/uricp/strategy/rbd_cached_put.rb
232
- - lib/uricp/strategy/rbd_flattener.rb
233
232
  - lib/uricp/strategy/rbd_put.rb
234
233
  - lib/uricp/strategy/rbd_snap.rb
235
234
  - lib/uricp/strategy/rbd_sweeper.rb
@@ -1,23 +0,0 @@
1
- module Uricp::Strategy
2
- class RbdFlattener
3
- include Uricp::Strategy::Common
4
-
5
- def appropriate?
6
- return proposal if options['rbd_flatten'] &&
7
- rbd_sequence_complete?
8
-
9
- debug "#{self.class.name}: not appropriate"
10
- false
11
- end
12
-
13
- def command
14
- "rbd flatten --id #{rbd_id} --no-progress '#{options['rbd_flatten']}' && "
15
- end
16
-
17
- def proposal
18
- @proposed_options = options.dup
19
- @proposed_options.delete('rbd_flatten')
20
- self
21
- end
22
- end
23
- end