vagrant-libvirt 0.3.0 → 0.4.0
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/README.md +170 -17
- data/lib/vagrant-libvirt/action/create_domain.rb +30 -9
- data/lib/vagrant-libvirt/action/forward_ports.rb +1 -1
- data/lib/vagrant-libvirt/action/package_domain.rb +2 -1
- data/lib/vagrant-libvirt/action/start_domain.rb +86 -29
- data/lib/vagrant-libvirt/action/wait_till_up.rb +7 -27
- data/lib/vagrant-libvirt/config.rb +202 -41
- data/lib/vagrant-libvirt/driver.rb +46 -31
- data/lib/vagrant-libvirt/provider.rb +2 -9
- data/lib/vagrant-libvirt/templates/domain.xml.erb +29 -5
- data/lib/vagrant-libvirt/version +1 -1
- data/lib/vagrant-libvirt/version.rb +57 -9
- data/spec/spec_helper.rb +28 -2
- data/spec/support/libvirt_context.rb +2 -0
- data/spec/support/sharedcontext.rb +4 -0
- data/spec/unit/action/create_domain_spec.rb +110 -35
- data/spec/unit/action/create_domain_spec/{default_storage_pool.xml → default_system_storage_pool.xml} +0 -0
- data/spec/unit/action/create_domain_spec/default_user_storage_pool.xml +17 -0
- data/spec/unit/action/start_domain_spec.rb +183 -1
- data/spec/unit/action/start_domain_spec/clock_timer_rtc.xml +50 -0
- data/spec/unit/action/start_domain_spec/default.xml +2 -2
- data/spec/unit/action/start_domain_spec/default_added_tpm_path.xml +48 -0
- data/spec/unit/action/start_domain_spec/default_added_tpm_version.xml +48 -0
- data/spec/unit/action/wait_till_up_spec.rb +14 -9
- data/spec/unit/config_spec.rb +392 -127
- data/spec/unit/provider_spec.rb +11 -0
- data/spec/unit/templates/domain_all_settings.xml +6 -3
- data/spec/unit/templates/domain_custom_cpu_model.xml +2 -1
- data/spec/unit/templates/domain_defaults.xml +2 -1
- data/spec/unit/templates/domain_spec.rb +80 -2
- data/spec/unit/templates/tpm/version_1.2.xml +54 -0
- data/spec/unit/templates/tpm/version_2.0.xml +53 -0
- metadata +74 -17
@@ -36,11 +36,14 @@
|
|
36
36
|
<BBB state='on' />
|
37
37
|
</hyperv>
|
38
38
|
</features>
|
39
|
-
<clock offset='
|
39
|
+
<clock offset='variable'>
|
40
|
+
<timer name='t1'/>
|
41
|
+
<timer name='t2' track='b' tickpolicy='c' frequency='d' mode='e' present='yes'/>
|
42
|
+
</clock>
|
40
43
|
<devices>
|
41
44
|
<emulator>/usr/bin/kvm-spice</emulator>
|
42
45
|
<disk type='file' device='disk'>
|
43
|
-
<driver name='qemu' type='qcow2' cache='unsafe'/>
|
46
|
+
<driver name='qemu' type='qcow2' cache='unsafe' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
|
44
47
|
<source file='/var/lib/libvirt/images/test.qcow2'/>
|
45
48
|
<target dev='vda' bus='ide'/>
|
46
49
|
</disk>
|
@@ -50,7 +53,7 @@
|
|
50
53
|
<target dev='vdb' bus='virtio'/>
|
51
54
|
</disk>
|
52
55
|
<disk type='file' device='disk'>
|
53
|
-
<driver name='qemu' type='qcow2' cache='default'/>
|
56
|
+
<driver name='qemu' type='qcow2' cache='default' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
|
54
57
|
<source file='/var/lib/libvirt/images/test-disk2.qcow2'/>
|
55
58
|
<target dev='vdc' bus='virtio'/>
|
56
59
|
</disk>
|
@@ -33,6 +33,9 @@ describe 'templates/domain' do
|
|
33
33
|
domain.cpu_mode = 'custom'
|
34
34
|
domain.cpu_feature(name: 'AAA', policy: 'required')
|
35
35
|
domain.hyperv_feature(name: 'BBB', state: 'on')
|
36
|
+
domain.clock_offset = 'variable'
|
37
|
+
domain.clock_timer(name: 't1')
|
38
|
+
domain.clock_timer(name: 't2', track: 'b', tickpolicy: 'c', frequency: 'd', mode: 'e', present: 'yes')
|
36
39
|
domain.cputopology(sockets: '1', cores: '3', threads: '2')
|
37
40
|
domain.machine_type = 'pc-compatible'
|
38
41
|
domain.machine_arch = 'x86_64'
|
@@ -42,11 +45,12 @@ describe 'templates/domain' do
|
|
42
45
|
domain.boot('hd')
|
43
46
|
domain.emulator_path = '/usr/bin/kvm-spice'
|
44
47
|
domain.instance_variable_set('@domain_volume_path', '/var/lib/libvirt/images/test.qcow2')
|
45
|
-
domain.instance_variable_set('@domain_volume_cache', '
|
48
|
+
domain.instance_variable_set('@domain_volume_cache', 'deprecated')
|
46
49
|
domain.disk_bus = 'ide'
|
47
50
|
domain.disk_device = 'vda'
|
51
|
+
domain.disk_driver(:cache => 'unsafe', :io => 'threads', :copy_on_read => 'on', :discard => 'unmap', :detect_zeroes => 'on')
|
48
52
|
domain.storage(:file, path: 'test-disk1.qcow2')
|
49
|
-
domain.storage(:file, path: 'test-disk2.qcow2')
|
53
|
+
domain.storage(:file, path: 'test-disk2.qcow2', io: 'threads', copy_on_read: 'on', discard: 'unmap', detect_zeroes: 'on')
|
50
54
|
domain.disks.each do |disk|
|
51
55
|
disk[:absolute_path] = '/var/lib/libvirt/images/' + disk[:path]
|
52
56
|
end
|
@@ -105,4 +109,78 @@ describe 'templates/domain' do
|
|
105
109
|
expect(domain.to_xml('domain')).to eq xml_expected
|
106
110
|
end
|
107
111
|
end
|
112
|
+
|
113
|
+
context 'when tpm 2.0 device is specified' do
|
114
|
+
before do
|
115
|
+
domain.tpm_version = '2.0'
|
116
|
+
domain.tpm_type = 'emulator'
|
117
|
+
domain.tpm_model = 'tpm-crb'
|
118
|
+
end
|
119
|
+
let(:test_file) { 'tpm/version_2.0.xml' }
|
120
|
+
it 'renders template' do
|
121
|
+
domain.finalize!
|
122
|
+
expect(domain.to_xml('domain')).to eq xml_expected
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'when tpm 1.2 device is implicitly used' do
|
127
|
+
before do
|
128
|
+
domain.tpm_path = '/dev/tpm0'
|
129
|
+
end
|
130
|
+
let(:test_file) { 'tpm/version_1.2.xml' }
|
131
|
+
it 'renders template' do
|
132
|
+
domain.finalize!
|
133
|
+
expect(domain.to_xml('domain')).to eq xml_expected
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'memballoon' do
|
138
|
+
context 'default' do
|
139
|
+
it 'renders without specifying the xml tag' do
|
140
|
+
domain.finalize!
|
141
|
+
|
142
|
+
expect(domain.to_xml('domain')).to_not match(/memballoon/)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'memballon enabled' do
|
147
|
+
before do
|
148
|
+
domain.memballoon_enabled = true
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'renders with memballon element' do
|
152
|
+
domain.finalize!
|
153
|
+
|
154
|
+
expect(domain.to_xml('domain')).to match(/<memballoon model='virtio'>/)
|
155
|
+
expect(domain.to_xml('domain')).to match(/<address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'\/>/)
|
156
|
+
end
|
157
|
+
|
158
|
+
context 'all settings specified' do
|
159
|
+
before do
|
160
|
+
domain.memballoon_model = "virtio-non-transitional"
|
161
|
+
domain.memballoon_pci_bus = "0x01"
|
162
|
+
domain.memballoon_pci_slot = "0x05"
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'renders with specified values' do
|
166
|
+
domain.finalize!
|
167
|
+
|
168
|
+
expect(domain.to_xml('domain')).to match(/<memballoon model='virtio-non-transitional'>/)
|
169
|
+
expect(domain.to_xml('domain')).to match(/<address type='pci' domain='0x0000' bus='0x01' slot='0x05' function='0x0'\/>/)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'memballon disabled' do
|
175
|
+
before do
|
176
|
+
domain.memballoon_enabled = false
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'renders the memballoon element with model none' do
|
180
|
+
domain.finalize!
|
181
|
+
|
182
|
+
expect(domain.to_xml('domain')).to match(/<memballoon model='none'\/>/)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
108
186
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
2
|
+
<name></name>
|
3
|
+
<title></title>
|
4
|
+
<description></description>
|
5
|
+
<uuid></uuid>
|
6
|
+
<memory></memory>
|
7
|
+
<vcpu>1</vcpu>
|
8
|
+
|
9
|
+
|
10
|
+
<cpu mode='host-model'>
|
11
|
+
<model fallback='allow'></model>
|
12
|
+
</cpu>
|
13
|
+
|
14
|
+
|
15
|
+
<os>
|
16
|
+
<type>hvm</type>
|
17
|
+
<kernel></kernel>
|
18
|
+
<initrd></initrd>
|
19
|
+
<cmdline></cmdline>
|
20
|
+
</os>
|
21
|
+
<features>
|
22
|
+
<acpi/>
|
23
|
+
<apic/>
|
24
|
+
<pae/>
|
25
|
+
</features>
|
26
|
+
<clock offset='utc'>
|
27
|
+
</clock>
|
28
|
+
<devices>
|
29
|
+
|
30
|
+
|
31
|
+
<serial type='pty'>
|
32
|
+
<target port='0'/>
|
33
|
+
</serial>
|
34
|
+
<console type='pty'>
|
35
|
+
<target port='0'/>
|
36
|
+
</console>
|
37
|
+
|
38
|
+
|
39
|
+
<input type='mouse' bus='ps2'/>
|
40
|
+
|
41
|
+
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' />
|
42
|
+
<video>
|
43
|
+
<model type='cirrus' vram='9216' heads='1'/>
|
44
|
+
</video>
|
45
|
+
|
46
|
+
|
47
|
+
<tpm model='tpm-tis'>
|
48
|
+
<backend type='passthrough'>
|
49
|
+
<device path='/dev/tpm0'/>
|
50
|
+
</backend>
|
51
|
+
</tpm>
|
52
|
+
</devices>
|
53
|
+
|
54
|
+
</domain>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
2
|
+
<name></name>
|
3
|
+
<title></title>
|
4
|
+
<description></description>
|
5
|
+
<uuid></uuid>
|
6
|
+
<memory></memory>
|
7
|
+
<vcpu>1</vcpu>
|
8
|
+
|
9
|
+
|
10
|
+
<cpu mode='host-model'>
|
11
|
+
<model fallback='allow'></model>
|
12
|
+
</cpu>
|
13
|
+
|
14
|
+
|
15
|
+
<os>
|
16
|
+
<type>hvm</type>
|
17
|
+
<kernel></kernel>
|
18
|
+
<initrd></initrd>
|
19
|
+
<cmdline></cmdline>
|
20
|
+
</os>
|
21
|
+
<features>
|
22
|
+
<acpi/>
|
23
|
+
<apic/>
|
24
|
+
<pae/>
|
25
|
+
</features>
|
26
|
+
<clock offset='utc'>
|
27
|
+
</clock>
|
28
|
+
<devices>
|
29
|
+
|
30
|
+
|
31
|
+
<serial type='pty'>
|
32
|
+
<target port='0'/>
|
33
|
+
</serial>
|
34
|
+
<console type='pty'>
|
35
|
+
<target port='0'/>
|
36
|
+
</console>
|
37
|
+
|
38
|
+
|
39
|
+
<input type='mouse' bus='ps2'/>
|
40
|
+
|
41
|
+
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' />
|
42
|
+
<video>
|
43
|
+
<model type='cirrus' vram='9216' heads='1'/>
|
44
|
+
</video>
|
45
|
+
|
46
|
+
|
47
|
+
<tpm model='tpm-crb'>
|
48
|
+
<backend type='emulator' version='2.0'>
|
49
|
+
</backend>
|
50
|
+
</tpm>
|
51
|
+
</devices>
|
52
|
+
|
53
|
+
</domain>
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Stanek
|
8
8
|
- Dima Vasilets
|
9
9
|
- Brian Pitts
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-03-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: contextual_proc
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: rspec-core
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,6 +68,34 @@ dependencies:
|
|
54
68
|
- - "~>"
|
55
69
|
- !ruby/object:Gem::Version
|
56
70
|
version: 3.5.0
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: simplecov
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: simplecov-lcov
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
57
99
|
- !ruby/object:Gem::Dependency
|
58
100
|
name: fog-libvirt
|
59
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,22 +227,29 @@ files:
|
|
185
227
|
- spec/support/libvirt_context.rb
|
186
228
|
- spec/support/sharedcontext.rb
|
187
229
|
- spec/unit/action/create_domain_spec.rb
|
188
|
-
- spec/unit/action/create_domain_spec/
|
230
|
+
- spec/unit/action/create_domain_spec/default_system_storage_pool.xml
|
231
|
+
- spec/unit/action/create_domain_spec/default_user_storage_pool.xml
|
189
232
|
- spec/unit/action/destroy_domain_spec.rb
|
190
233
|
- spec/unit/action/set_name_of_domain_spec.rb
|
191
234
|
- spec/unit/action/start_domain_spec.rb
|
235
|
+
- spec/unit/action/start_domain_spec/clock_timer_rtc.xml
|
192
236
|
- spec/unit/action/start_domain_spec/default.xml
|
237
|
+
- spec/unit/action/start_domain_spec/default_added_tpm_path.xml
|
238
|
+
- spec/unit/action/start_domain_spec/default_added_tpm_version.xml
|
193
239
|
- spec/unit/action/wait_till_up_spec.rb
|
194
240
|
- spec/unit/config_spec.rb
|
241
|
+
- spec/unit/provider_spec.rb
|
195
242
|
- spec/unit/templates/domain_all_settings.xml
|
196
243
|
- spec/unit/templates/domain_custom_cpu_model.xml
|
197
244
|
- spec/unit/templates/domain_defaults.xml
|
198
245
|
- spec/unit/templates/domain_spec.rb
|
246
|
+
- spec/unit/templates/tpm/version_1.2.xml
|
247
|
+
- spec/unit/templates/tpm/version_2.0.xml
|
199
248
|
homepage: https://github.com/vagrant-libvirt/vagrant-libvirt
|
200
249
|
licenses:
|
201
250
|
- MIT
|
202
251
|
metadata: {}
|
203
|
-
post_install_message:
|
252
|
+
post_install_message:
|
204
253
|
rdoc_options: []
|
205
254
|
require_paths:
|
206
255
|
- lib
|
@@ -215,24 +264,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
264
|
- !ruby/object:Gem::Version
|
216
265
|
version: '0'
|
217
266
|
requirements: []
|
218
|
-
|
219
|
-
|
267
|
+
rubyforge_project:
|
268
|
+
rubygems_version: 2.7.11
|
269
|
+
signing_key:
|
220
270
|
specification_version: 4
|
221
271
|
summary: libvirt provider for Vagrant.
|
222
272
|
test_files:
|
223
|
-
- spec/
|
224
|
-
- spec/support/sharedcontext.rb
|
225
|
-
- spec/support/environment_helper.rb
|
226
|
-
- spec/unit/templates/domain_all_settings.xml
|
227
|
-
- spec/unit/templates/domain_custom_cpu_model.xml
|
228
|
-
- spec/unit/templates/domain_defaults.xml
|
229
|
-
- spec/unit/templates/domain_spec.rb
|
230
|
-
- spec/unit/action/create_domain_spec/default_storage_pool.xml
|
273
|
+
- spec/unit/action/start_domain_spec.rb
|
231
274
|
- spec/unit/action/create_domain_spec.rb
|
232
275
|
- spec/unit/action/wait_till_up_spec.rb
|
276
|
+
- spec/unit/action/start_domain_spec/default_added_tpm_version.xml
|
277
|
+
- spec/unit/action/start_domain_spec/clock_timer_rtc.xml
|
278
|
+
- spec/unit/action/start_domain_spec/default.xml
|
279
|
+
- spec/unit/action/start_domain_spec/default_added_tpm_path.xml
|
233
280
|
- spec/unit/action/destroy_domain_spec.rb
|
234
|
-
- spec/unit/action/
|
281
|
+
- spec/unit/action/create_domain_spec/default_system_storage_pool.xml
|
282
|
+
- spec/unit/action/create_domain_spec/default_user_storage_pool.xml
|
235
283
|
- spec/unit/action/set_name_of_domain_spec.rb
|
236
|
-
- spec/unit/action/start_domain_spec/default.xml
|
237
284
|
- spec/unit/config_spec.rb
|
285
|
+
- spec/unit/provider_spec.rb
|
286
|
+
- spec/unit/templates/domain_defaults.xml
|
287
|
+
- spec/unit/templates/domain_all_settings.xml
|
288
|
+
- spec/unit/templates/domain_spec.rb
|
289
|
+
- spec/unit/templates/tpm/version_1.2.xml
|
290
|
+
- spec/unit/templates/tpm/version_2.0.xml
|
291
|
+
- spec/unit/templates/domain_custom_cpu_model.xml
|
292
|
+
- spec/support/libvirt_context.rb
|
293
|
+
- spec/support/environment_helper.rb
|
294
|
+
- spec/support/sharedcontext.rb
|
238
295
|
- spec/spec_helper.rb
|