vagrant-libvirt 0.5.2 → 0.5.3
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/lib/vagrant-libvirt/action/create_domain.rb +1 -1
- data/lib/vagrant-libvirt/action/create_domain_volume.rb +2 -2
- data/lib/vagrant-libvirt/action/handle_box_image.rb +15 -11
- data/lib/vagrant-libvirt/util/byte_number.rb +71 -0
- data/lib/vagrant-libvirt/version +1 -1
- data/spec/unit/action/create_domain_volume_spec.rb +6 -4
- data/spec/unit/action/create_domain_volume_spec/one_disk_in_storage.xml +1 -1
- data/spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_0.xml +1 -1
- data/spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_1.xml +1 -1
- data/spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_2.xml +1 -1
- data/spec/unit/action/handle_box_image_spec.rb +98 -20
- data/spec/unit/provider_spec.rb +11 -0
- data/spec/unit/util/byte_number_spec.rb +26 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45b81bd9999cef0982201e37382c06ce3657bfe4442f060864c3f659ffc2ce37
|
4
|
+
data.tar.gz: e44c22486556883da8170f757cc8c3a29a4a98b07460c4b1098cb4aaed7566b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca1762baa21c39a9e047128f87cae3decedf38fee218bd741ebe0b40779d95bf306926a53c42038e3d4556f1484edb811868b3f612d37c574382afcf14516788
|
7
|
+
data.tar.gz: daabf0d91e896deb468a79ea287c52137991a04c9befabeab53e700dbbe580a17ba019da8b817a6e3a8148b81f5a26e86c112c2d0f05ba216595ea4c56a0dac6
|
@@ -266,7 +266,7 @@ module VagrantPlugins
|
|
266
266
|
end
|
267
267
|
env[:ui].info(" -- Storage pool: #{@storage_pool_name}")
|
268
268
|
@domain_volumes.each do |volume|
|
269
|
-
env[:ui].info(" -- Image(#{volume[:device]}): #{volume[:path]}, #{volume[:virtual_size]}G")
|
269
|
+
env[:ui].info(" -- Image(#{volume[:device]}): #{volume[:path]}, #{volume[:virtual_size].to_GB}G")
|
270
270
|
end
|
271
271
|
|
272
272
|
if not @disk_driver_opts.empty?
|
@@ -39,7 +39,7 @@ module VagrantPlugins
|
|
39
39
|
@backing_file = box_volume.path
|
40
40
|
|
41
41
|
# Virtual size of image. Take value worked out by HandleBoxImage
|
42
|
-
@capacity = env[:box_volumes][index][:virtual_size] #
|
42
|
+
@capacity = env[:box_volumes][index][:virtual_size].to_B # Byte
|
43
43
|
|
44
44
|
# Create new volume from xml template. Fog currently doesn't support
|
45
45
|
# volume snapshots directly.
|
@@ -47,7 +47,7 @@ module VagrantPlugins
|
|
47
47
|
xml = Nokogiri::XML::Builder.new do |xml|
|
48
48
|
xml.volume do
|
49
49
|
xml.name(@name)
|
50
|
-
xml.capacity(@capacity, unit: '
|
50
|
+
xml.capacity(@capacity, unit: 'B')
|
51
51
|
xml.target do
|
52
52
|
xml.format(type: 'qcow2')
|
53
53
|
xml.permissions do
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'log4r'
|
2
2
|
require 'open3'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require 'vagrant-libvirt/util/byte_number'
|
3
6
|
|
4
7
|
module VagrantPlugins
|
5
8
|
module ProviderLibvirt
|
@@ -65,7 +68,7 @@ module VagrantPlugins
|
|
65
68
|
{
|
66
69
|
:path => image_path,
|
67
70
|
:name => volume_name,
|
68
|
-
:virtual_size => virtual_size
|
71
|
+
:virtual_size => virtual_size,
|
69
72
|
:format => HandleBoxImage.verify_box_format(format)
|
70
73
|
}
|
71
74
|
}
|
@@ -81,16 +84,18 @@ module VagrantPlugins
|
|
81
84
|
# Override box_virtual_size
|
82
85
|
box_virtual_size = env[:box_volumes][0][:virtual_size]
|
83
86
|
if config.machine_virtual_size
|
84
|
-
|
87
|
+
config_machine_virtual_size = ByteNumber.from_GB(config.machine_virtual_size)
|
88
|
+
puts config_machine_virtual_size < box_virtual_size
|
89
|
+
if config_machine_virtual_size < box_virtual_size
|
85
90
|
# Warn that a virtual size less than the box metadata size
|
86
91
|
# is not supported and will be ignored
|
87
92
|
env[:ui].warn I18n.t(
|
88
93
|
'vagrant_libvirt.warnings.ignoring_virtual_size_too_small',
|
89
|
-
requested:
|
94
|
+
requested: config_machine_virtual_size.to_GB, minimum: box_virtual_size.to_GB
|
90
95
|
)
|
91
96
|
else
|
92
97
|
env[:ui].info I18n.t('vagrant_libvirt.manual_resize_required')
|
93
|
-
box_virtual_size =
|
98
|
+
box_virtual_size = config_machine_virtual_size
|
94
99
|
end
|
95
100
|
end
|
96
101
|
# save for use by later actions
|
@@ -131,7 +136,7 @@ module VagrantPlugins
|
|
131
136
|
# Virtual size has to be set for allocating space in storage pool.
|
132
137
|
box_virtual_size = env[:machine].box.metadata['virtual_size']
|
133
138
|
raise Errors::NoBoxVirtualSizeSet if box_virtual_size.nil?
|
134
|
-
return box_virtual_size
|
139
|
+
return ByteNumber.from_GB(box_virtual_size)
|
135
140
|
end
|
136
141
|
|
137
142
|
def self.get_box_image_path(box, box_name)
|
@@ -153,14 +158,14 @@ module VagrantPlugins
|
|
153
158
|
end
|
154
159
|
|
155
160
|
def self.get_box_disk_settings(image_path)
|
156
|
-
stdout, stderr, status = Open3.capture3('qemu-img', 'info', image_path)
|
161
|
+
stdout, stderr, status = Open3.capture3('qemu-img', 'info', '--output=json', image_path)
|
157
162
|
if !status.success?
|
158
163
|
raise Errors::BadBoxImage, image: image_path, out: stdout, err: stderr
|
159
164
|
end
|
160
165
|
|
161
|
-
|
162
|
-
format =
|
163
|
-
virtual_size =
|
166
|
+
image_info = JSON.parse(stdout)
|
167
|
+
format = image_info['format']
|
168
|
+
virtual_size = ByteNumber.new(image_info['virtual-size'])
|
164
169
|
|
165
170
|
return format, virtual_size
|
166
171
|
end
|
@@ -178,12 +183,11 @@ module VagrantPlugins
|
|
178
183
|
message = "Creating volume #{box_volume[:name]}"
|
179
184
|
message << " in storage pool #{config.storage_pool_name}."
|
180
185
|
@logger.info(message)
|
181
|
-
|
182
186
|
begin
|
183
187
|
fog_volume = env[:machine].provider.driver.connection.volumes.create(
|
184
188
|
name: box_volume[:name],
|
185
189
|
allocation: "#{box_image_size / 1024 / 1024}M",
|
186
|
-
capacity: "#{box_volume[:virtual_size]}
|
190
|
+
capacity: "#{box_volume[:virtual_size].to_B}B",
|
187
191
|
format_type: box_volume[:format],
|
188
192
|
owner: storage_uid(env),
|
189
193
|
group: storage_gid(env),
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class ByteNumber < Numeric
|
2
|
+
def initialize(int)
|
3
|
+
@int = int
|
4
|
+
end
|
5
|
+
|
6
|
+
def to_s
|
7
|
+
@int.to_s
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_i
|
11
|
+
@int
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_f
|
15
|
+
@int.to_f
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_B
|
19
|
+
to_i
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_KB
|
23
|
+
_compute_unit_to_n_kilo(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_MB
|
27
|
+
_compute_unit_to_n_kilo(2)
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_GB
|
31
|
+
_compute_unit_to_n_kilo(3)
|
32
|
+
end
|
33
|
+
|
34
|
+
def coerce(other)
|
35
|
+
to_i.coerce(other)
|
36
|
+
end
|
37
|
+
|
38
|
+
def <=>(other)
|
39
|
+
to_i <=> other
|
40
|
+
end
|
41
|
+
|
42
|
+
def +(other)
|
43
|
+
to_i + other
|
44
|
+
end
|
45
|
+
|
46
|
+
def -(other)
|
47
|
+
to_i - other
|
48
|
+
end
|
49
|
+
|
50
|
+
def *(other)
|
51
|
+
to_i * other
|
52
|
+
end
|
53
|
+
|
54
|
+
def /(other)
|
55
|
+
to_i / other
|
56
|
+
end
|
57
|
+
|
58
|
+
def pow(n)
|
59
|
+
self.class.new(to_i ** n)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.from_GB(value)
|
63
|
+
self.new(value*(1024**3))
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def _compute_unit_to_n_kilo(n=0)
|
68
|
+
(to_f/(1024 ** n)).ceil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
data/lib/vagrant-libvirt/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
@@ -3,6 +3,8 @@ require 'support/sharedcontext'
|
|
3
3
|
require 'support/libvirt_context'
|
4
4
|
|
5
5
|
require 'vagrant-libvirt/action/destroy_domain'
|
6
|
+
require 'vagrant-libvirt/util/byte_number'
|
7
|
+
|
6
8
|
|
7
9
|
describe VagrantPlugins::ProviderLibvirt::Action::CreateDomainVolume do
|
8
10
|
subject { described_class.new(app, env) }
|
@@ -38,7 +40,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomainVolume do
|
|
38
40
|
env[:box_volumes] = [
|
39
41
|
{
|
40
42
|
:name=>"test_vagrant_box_image_1.1.1_0.img",
|
41
|
-
:virtual_size=>
|
43
|
+
:virtual_size=>ByteNumber.new(5368709120)
|
42
44
|
}
|
43
45
|
]
|
44
46
|
end
|
@@ -65,15 +67,15 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomainVolume do
|
|
65
67
|
env[:box_volumes] = [
|
66
68
|
{
|
67
69
|
:name=>"test_vagrant_box_image_1.1.1_0.img",
|
68
|
-
:virtual_size=>
|
70
|
+
:virtual_size=>ByteNumber.new(5368709120)
|
69
71
|
},
|
70
72
|
{
|
71
73
|
:name=>"test_vagrant_box_image_1.1.1_1.img",
|
72
|
-
:virtual_size=>
|
74
|
+
:virtual_size=>ByteNumber.new(10737423360)
|
73
75
|
},
|
74
76
|
{
|
75
77
|
:name=>"test_vagrant_box_image_1.1.1_2.img",
|
76
|
-
:virtual_size=>
|
78
|
+
:virtual_size=>ByteNumber.new(21474836480)
|
77
79
|
}
|
78
80
|
]
|
79
81
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'json'
|
2
3
|
require 'support/sharedcontext'
|
3
4
|
require 'support/libvirt_context'
|
4
5
|
|
5
6
|
require 'vagrant-libvirt/action/destroy_domain'
|
7
|
+
require 'vagrant-libvirt/util/byte_number'
|
8
|
+
|
6
9
|
|
7
10
|
describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
8
11
|
subject { described_class.new(app, env) }
|
@@ -15,6 +18,41 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
15
18
|
let(:all) { double('all') }
|
16
19
|
let(:box_volume) { double('box_volume') }
|
17
20
|
let(:fog_volume) { double('fog_volume') }
|
21
|
+
let(:config) { double('config') }
|
22
|
+
|
23
|
+
qemu_json_return_5G = JSON.dump({
|
24
|
+
"virtual-size": 5368709120,
|
25
|
+
"filename": "/test/box.img",
|
26
|
+
"cluster-size": 65536,
|
27
|
+
"format": "qcow2",
|
28
|
+
"actual-size": 655360,
|
29
|
+
"dirty-flag": false
|
30
|
+
})
|
31
|
+
byte_number_5G = ByteNumber.new(5368709120)
|
32
|
+
|
33
|
+
|
34
|
+
qemu_json_return_10G = JSON.dump({
|
35
|
+
"virtual-size": 10737423360,
|
36
|
+
"filename": "/test/disk.qcow2",
|
37
|
+
"cluster-size": 65536,
|
38
|
+
"format": "qcow2",
|
39
|
+
"actual-size": 655360,
|
40
|
+
"dirty-flag": false
|
41
|
+
})
|
42
|
+
byte_number_10G = ByteNumber.new(10737423360)
|
43
|
+
|
44
|
+
qemu_json_return_20G = JSON.dump({
|
45
|
+
"virtual-size": 21474836480,
|
46
|
+
"filename": "/test/box_2.img",
|
47
|
+
"cluster-size": 65536,
|
48
|
+
"format": "qcow2",
|
49
|
+
"actual-size": 1508708352,
|
50
|
+
"dirty-flag": false
|
51
|
+
})
|
52
|
+
byte_number_20G = ByteNumber.new(21474836480)
|
53
|
+
|
54
|
+
|
55
|
+
|
18
56
|
|
19
57
|
describe '#call' do
|
20
58
|
before do
|
@@ -51,13 +89,53 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
51
89
|
{
|
52
90
|
:path=>"/test/box.img",
|
53
91
|
:name=>"test_vagrant_box_image_1.1.1_box.img",
|
54
|
-
:virtual_size=>
|
92
|
+
:virtual_size=>byte_number_5G,
|
55
93
|
:format=>"qcow2"
|
56
94
|
}
|
57
95
|
]
|
58
96
|
)
|
59
97
|
end
|
60
98
|
|
99
|
+
context 'When config.machine_virtual_size is set and smaller than box_virtual_size' do
|
100
|
+
before do
|
101
|
+
allow(env[:machine]).to receive_message_chain("provider_config.machine_virtual_size").and_return(1)
|
102
|
+
end
|
103
|
+
it 'should warning must be raise' do
|
104
|
+
expect(ui).to receive(:warn).with("Ignoring requested virtual disk size of '1' as it is below\nthe minimum box image size of '5'.")
|
105
|
+
expect(subject.call(env)).to be_nil
|
106
|
+
expect(env[:box_volumes]).to eq(
|
107
|
+
[
|
108
|
+
{
|
109
|
+
:path=>"/test/box.img",
|
110
|
+
:name=>"test_vagrant_box_image_1.1.1_box.img",
|
111
|
+
:virtual_size=>byte_number_5G,
|
112
|
+
:format=>"qcow2"
|
113
|
+
}
|
114
|
+
]
|
115
|
+
)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'When config.machine_virtual_size is set and higher than box_virtual_size' do
|
120
|
+
before do
|
121
|
+
allow(env[:machine]).to receive_message_chain("provider_config.machine_virtual_size").and_return(20)
|
122
|
+
end
|
123
|
+
it 'should be use' do
|
124
|
+
expect(ui).to receive(:info).with("Created volume larger than box defaults, will require manual resizing of\nfilesystems to utilize.")
|
125
|
+
expect(subject.call(env)).to be_nil
|
126
|
+
expect(env[:box_volumes]).to eq(
|
127
|
+
[
|
128
|
+
{
|
129
|
+
:path=>"/test/box.img",
|
130
|
+
:name=>"test_vagrant_box_image_1.1.1_box.img",
|
131
|
+
:virtual_size=>byte_number_20G,
|
132
|
+
:format=>"qcow2"
|
133
|
+
}
|
134
|
+
]
|
135
|
+
)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
61
139
|
context 'when disk image not in storage pool' do
|
62
140
|
before do
|
63
141
|
allow(File).to receive(:exist?).and_return(true)
|
@@ -74,7 +152,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
74
152
|
hash_including(
|
75
153
|
:name => "test_vagrant_box_image_1.1.1_box.img",
|
76
154
|
:allocation => "5120M",
|
77
|
-
:capacity => "
|
155
|
+
:capacity => "5368709120B",
|
78
156
|
)
|
79
157
|
)
|
80
158
|
expect(subject).to receive(:upload_image)
|
@@ -122,14 +200,14 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
122
200
|
'/test/'.concat(arg.to_s)
|
123
201
|
end
|
124
202
|
allow(status).to receive(:success?).and_return(true)
|
125
|
-
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '/test/box.img').and_return([
|
126
|
-
|
203
|
+
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '--output=json', '/test/box.img').and_return([
|
204
|
+
qemu_json_return_5G, "", status
|
127
205
|
])
|
128
|
-
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '/test/disk.qcow2').and_return([
|
129
|
-
|
206
|
+
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '--output=json', '/test/disk.qcow2').and_return([
|
207
|
+
qemu_json_return_10G, "", status
|
130
208
|
])
|
131
|
-
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '/test/box_2.img').and_return([
|
132
|
-
|
209
|
+
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '--output=json', '/test/box_2.img').and_return([
|
210
|
+
qemu_json_return_20G, "", status
|
133
211
|
])
|
134
212
|
end
|
135
213
|
|
@@ -141,19 +219,19 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
141
219
|
{
|
142
220
|
:path=>"/test/box.img",
|
143
221
|
:name=>"test_vagrant_box_image_1.1.1_send_box_name.img",
|
144
|
-
:virtual_size=>
|
222
|
+
:virtual_size=>byte_number_5G,
|
145
223
|
:format=>"qcow2"
|
146
224
|
},
|
147
225
|
{
|
148
226
|
:path=>"/test/disk.qcow2",
|
149
227
|
:name=>"test_vagrant_box_image_1.1.1_disk.img",
|
150
|
-
:virtual_size=>
|
228
|
+
:virtual_size=>byte_number_10G,
|
151
229
|
:format=>"qcow2"
|
152
230
|
},
|
153
231
|
{
|
154
232
|
:path=>"/test/box_2.img",
|
155
233
|
:name=>"test_vagrant_box_image_1.1.1_box_2.img",
|
156
|
-
:virtual_size=>
|
234
|
+
:virtual_size=>byte_number_20G,
|
157
235
|
:format=>"qcow2"
|
158
236
|
}
|
159
237
|
]
|
@@ -176,7 +254,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
176
254
|
hash_including(
|
177
255
|
:name => "test_vagrant_box_image_1.1.1_send_box_name.img",
|
178
256
|
:allocation => "5120M",
|
179
|
-
:capacity => "
|
257
|
+
:capacity => "5368709120B",
|
180
258
|
)
|
181
259
|
)
|
182
260
|
expect(subject).to receive(:upload_image)
|
@@ -186,7 +264,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
186
264
|
hash_including(
|
187
265
|
:name => "test_vagrant_box_image_1.1.1_disk.img",
|
188
266
|
:allocation => "10240M",
|
189
|
-
:capacity => "
|
267
|
+
:capacity => "10737423360B",
|
190
268
|
)
|
191
269
|
)
|
192
270
|
expect(subject).to receive(:upload_image)
|
@@ -196,7 +274,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
196
274
|
hash_including(
|
197
275
|
:name => "test_vagrant_box_image_1.1.1_box_2.img",
|
198
276
|
:allocation => "20480M",
|
199
|
-
:capacity => "
|
277
|
+
:capacity => "21474836480B",
|
200
278
|
)
|
201
279
|
)
|
202
280
|
expect(subject).to receive(:upload_image)
|
@@ -279,14 +357,14 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
|
|
279
357
|
'/test/'.concat(arg.to_s)
|
280
358
|
end
|
281
359
|
allow(status).to receive(:success?).and_return(true)
|
282
|
-
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '/test/box.img').and_return([
|
283
|
-
|
360
|
+
allow(Open3).to receive(:capture3).with('qemu-img', 'info', "--output=json", '/test/box.img').and_return([
|
361
|
+
qemu_json_return_5G, "", status
|
284
362
|
])
|
285
|
-
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '/test/disk.qcow2').and_return([
|
286
|
-
|
363
|
+
allow(Open3).to receive(:capture3).with('qemu-img', 'info', "--output=json", '/test/disk.qcow2').and_return([
|
364
|
+
qemu_json_return_10G, "", status
|
287
365
|
])
|
288
|
-
allow(Open3).to receive(:capture3).with('qemu-img', 'info', '/test/box_2.img').and_return([
|
289
|
-
|
366
|
+
allow(Open3).to receive(:capture3).with('qemu-img', 'info', "--output=json", '/test/box_2.img').and_return([
|
367
|
+
qemu_json_return_20G, "", status
|
290
368
|
])
|
291
369
|
end
|
292
370
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'vagrant-libvirt/util/byte_number'
|
4
|
+
|
5
|
+
|
6
|
+
describe ByteNumber do
|
7
|
+
describe '#ByteNumber to Gigrabyte' do
|
8
|
+
it 'should return bigger size' do
|
9
|
+
expect( ByteNumber.new("10737423360").to_GB).to eq(11)
|
10
|
+
expect( ByteNumber.new("737423360").to_GB).to eq(1)
|
11
|
+
expect( ByteNumber.new("110737423360").to_GB).to eq(104)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#ByteNumber from Gigrabyte' do
|
16
|
+
it 'should convert' do
|
17
|
+
expect( ByteNumber.from_GB(5).to_i).to eq(5368709120)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#ByteNumber pow' do
|
22
|
+
it 'should be work like interger' do
|
23
|
+
expect( ByteNumber.new(5).pow(5).to_i).to eq(5**5)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Stanek
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-06-
|
14
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec-core
|
@@ -216,6 +216,7 @@ files:
|
|
216
216
|
- lib/vagrant-libvirt/templates/private_network.xml.erb
|
217
217
|
- lib/vagrant-libvirt/templates/public_interface.xml.erb
|
218
218
|
- lib/vagrant-libvirt/util.rb
|
219
|
+
- lib/vagrant-libvirt/util/byte_number.rb
|
219
220
|
- lib/vagrant-libvirt/util/collection.rb
|
220
221
|
- lib/vagrant-libvirt/util/erb_template.rb
|
221
222
|
- lib/vagrant-libvirt/util/error_codes.rb
|
@@ -256,12 +257,14 @@ files:
|
|
256
257
|
- spec/unit/action/start_domain_spec/default_added_tpm_version.xml
|
257
258
|
- spec/unit/action/wait_till_up_spec.rb
|
258
259
|
- spec/unit/config_spec.rb
|
260
|
+
- spec/unit/provider_spec.rb
|
259
261
|
- spec/unit/templates/domain_all_settings.xml
|
260
262
|
- spec/unit/templates/domain_custom_cpu_model.xml
|
261
263
|
- spec/unit/templates/domain_defaults.xml
|
262
264
|
- spec/unit/templates/domain_spec.rb
|
263
265
|
- spec/unit/templates/tpm/version_1.2.xml
|
264
266
|
- spec/unit/templates/tpm/version_2.0.xml
|
267
|
+
- spec/unit/util/byte_number_spec.rb
|
265
268
|
homepage: https://github.com/vagrant-libvirt/vagrant-libvirt
|
266
269
|
licenses:
|
267
270
|
- MIT
|
@@ -310,6 +313,8 @@ test_files:
|
|
310
313
|
- spec/unit/action/halt_domain_spec.rb
|
311
314
|
- spec/unit/action/create_domain_volume_spec.rb
|
312
315
|
- spec/unit/config_spec.rb
|
316
|
+
- spec/unit/util/byte_number_spec.rb
|
317
|
+
- spec/unit/provider_spec.rb
|
313
318
|
- spec/unit/templates/domain_defaults.xml
|
314
319
|
- spec/unit/templates/domain_all_settings.xml
|
315
320
|
- spec/unit/templates/domain_spec.rb
|