vagrant-libvirt 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -6
- data/lib/vagrant-libvirt/action/create_domain.rb +19 -91
- data/lib/vagrant-libvirt/action/destroy_domain.rb +20 -4
- data/lib/vagrant-libvirt/action/destroy_networks.rb +1 -1
- data/lib/vagrant-libvirt/action/handle_box_image.rb +2 -0
- data/lib/vagrant-libvirt/action/resolve_disk_settings.rb +174 -0
- data/lib/vagrant-libvirt/action/start_domain.rb +41 -1
- data/lib/vagrant-libvirt/action.rb +14 -6
- data/lib/vagrant-libvirt/config.rb +12 -4
- data/lib/vagrant-libvirt/templates/domain.xml.erb +13 -8
- data/lib/vagrant-libvirt/util/domain_flags.rb +15 -0
- data/lib/vagrant-libvirt/util.rb +1 -0
- data/lib/vagrant-libvirt/version +1 -1
- data/locales/en.yml +4 -2
- data/spec/support/libvirt_context.rb +4 -0
- data/spec/unit/action/cleanup_on_failure_spec.rb +0 -2
- data/spec/unit/action/create_domain_spec.rb +113 -147
- data/spec/unit/action/create_domain_volume_spec.rb +0 -3
- data/spec/unit/action/destroy_domain_spec.rb +43 -10
- data/spec/unit/action/handle_box_image_spec.rb +13 -13
- data/spec/unit/action/package_domain_spec.rb +0 -5
- data/spec/unit/action/resolve_disk_settings_spec/default_domain.xml +43 -0
- data/spec/unit/action/resolve_disk_settings_spec/default_no_aliases.xml +42 -0
- data/spec/unit/action/{create_domain_spec → resolve_disk_settings_spec}/default_system_storage_pool.xml +0 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box.xml +55 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_and_custom_no_aliases.xml +67 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_storage.xml +67 -0
- data/spec/unit/action/resolve_disk_settings_spec.rb +361 -0
- data/spec/unit/action/start_domain_spec/existing_added_nvram.xml +62 -0
- data/spec/unit/action/start_domain_spec/nvram_domain.xml +64 -0
- data/spec/unit/action/start_domain_spec/nvram_domain_other_setting.xml +64 -0
- data/spec/unit/action/start_domain_spec/nvram_domain_removed.xml +64 -0
- data/spec/unit/action/start_domain_spec.rb +64 -6
- data/spec/unit/action/wait_till_up_spec.rb +0 -2
- data/spec/unit/action_spec.rb +0 -3
- data/spec/unit/config_spec.rb +18 -0
- data/spec/unit/driver_spec.rb +2 -0
- data/spec/unit/templates/domain_all_settings.xml +8 -2
- data/spec/unit/templates/domain_spec.rb +3 -2
- metadata +38 -16
@@ -0,0 +1,361 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
require 'fog/libvirt/models/compute/volume'
|
6
|
+
|
7
|
+
require 'vagrant-libvirt/action/resolve_disk_settings'
|
8
|
+
|
9
|
+
describe VagrantPlugins::ProviderLibvirt::Action::ResolveDiskSettings do
|
10
|
+
subject { described_class.new(app, env) }
|
11
|
+
|
12
|
+
include_context 'unit'
|
13
|
+
include_context 'libvirt'
|
14
|
+
|
15
|
+
let(:servers) { double('servers') }
|
16
|
+
let(:volumes) { double('volumes') }
|
17
|
+
let(:domain_volume) { instance_double(::Fog::Libvirt::Compute::Volume) }
|
18
|
+
let(:libvirt_storage_pool) { double('storage_pool') }
|
19
|
+
|
20
|
+
let(:domain_xml) { File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), domain_xml_file)) }
|
21
|
+
let(:storage_pool_xml) do
|
22
|
+
File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), storage_pool_xml_file))
|
23
|
+
end
|
24
|
+
|
25
|
+
before do
|
26
|
+
allow(logger).to receive(:info)
|
27
|
+
allow(logger).to receive(:debug)
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#call' do
|
31
|
+
before do
|
32
|
+
allow(connection).to receive(:volumes).and_return(volumes)
|
33
|
+
allow(volumes).to receive(:all).and_return([domain_volume])
|
34
|
+
allow(domain_volume).to receive(:pool_name).and_return('default')
|
35
|
+
allow(domain_volume).to receive(:path).and_return('/var/lib/libvirt/images/vagrant-test_default.img')
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when vm box is in use' do
|
39
|
+
context 'when box metadata is available' do
|
40
|
+
let(:box_volumes) do
|
41
|
+
[
|
42
|
+
{
|
43
|
+
path: '/test/box.img',
|
44
|
+
name: 'test_vagrant_box_image_1.1.1_box.img',
|
45
|
+
},
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
before do
|
50
|
+
env[:domain_name] = 'vagrant-test_default'
|
51
|
+
env[:box_volumes] = box_volumes
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should populate domain volume' do
|
55
|
+
expect(subject.call(env)).to be_nil
|
56
|
+
expect(env[:domain_volumes]).to match(
|
57
|
+
[
|
58
|
+
hash_including(
|
59
|
+
device: 'vda',
|
60
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
61
|
+
),
|
62
|
+
]
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when additional storage specified' do
|
67
|
+
let(:vagrantfile_providerconfig) do
|
68
|
+
<<-EOF
|
69
|
+
libvirt.storage :file, :size => '20G'
|
70
|
+
EOF
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should use the next device for storage' do
|
74
|
+
expect(subject.call(env)).to be_nil
|
75
|
+
expect(env[:disks]).to match(
|
76
|
+
[
|
77
|
+
hash_including(
|
78
|
+
device: 'vdb',
|
79
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vdb.qcow2'
|
80
|
+
),
|
81
|
+
]
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when custom disk device setting' do
|
87
|
+
before do
|
88
|
+
machine.provider_config.disk_device = 'sda'
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should set the domain device' do
|
92
|
+
expect(subject.call(env)).to be_nil
|
93
|
+
expect(env[:domain_volumes]).to match(
|
94
|
+
[
|
95
|
+
hash_including(
|
96
|
+
device: 'sda',
|
97
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
98
|
+
),
|
99
|
+
]
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'when additional storage specified' do
|
104
|
+
let(:vagrantfile_providerconfig) do
|
105
|
+
<<-EOF
|
106
|
+
libvirt.storage :file, :size => '20G'
|
107
|
+
EOF
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should use the next custom disk device for storage' do
|
111
|
+
expect(subject.call(env)).to be_nil
|
112
|
+
expect(env[:disks]).to match(
|
113
|
+
[
|
114
|
+
hash_including(
|
115
|
+
device: 'sdb',
|
116
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-sdb.qcow2'
|
117
|
+
),
|
118
|
+
]
|
119
|
+
)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context 'when multiple box volumes' do
|
125
|
+
let(:box_volumes) do
|
126
|
+
[
|
127
|
+
{
|
128
|
+
path: '/test/box.img',
|
129
|
+
name: 'test_vagrant_box_image_1.1.1_box.img',
|
130
|
+
},
|
131
|
+
{
|
132
|
+
path: '/test/box_2.img',
|
133
|
+
name: 'test_vagrant_box_image_1.1.1_box_2.img',
|
134
|
+
},
|
135
|
+
]
|
136
|
+
end
|
137
|
+
it 'should populate all domain volumes' do
|
138
|
+
expect(subject.call(env)).to be_nil
|
139
|
+
expect(env[:domain_volumes]).to match(
|
140
|
+
[
|
141
|
+
hash_including(
|
142
|
+
device: 'vda',
|
143
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
144
|
+
),
|
145
|
+
hash_including(
|
146
|
+
device: 'vdb',
|
147
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
148
|
+
),
|
149
|
+
]
|
150
|
+
)
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'when additional storage specified' do
|
154
|
+
let(:vagrantfile_providerconfig) do
|
155
|
+
<<-EOF
|
156
|
+
libvirt.storage :file, :size => '20G'
|
157
|
+
EOF
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'should use the next device for storage' do
|
161
|
+
expect(subject.call(env)).to be_nil
|
162
|
+
expect(env[:disks]).to match(
|
163
|
+
[
|
164
|
+
hash_including(
|
165
|
+
device: 'vdc',
|
166
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vdc.qcow2'
|
167
|
+
),
|
168
|
+
]
|
169
|
+
)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'when box metadata is not available' do
|
176
|
+
let(:domain_xml_file) { 'default_domain.xml' }
|
177
|
+
|
178
|
+
before do
|
179
|
+
expect(libvirt_client).to receive(:lookup_domain_by_uuid).and_return(libvirt_domain)
|
180
|
+
expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'should query the domain xml' do
|
184
|
+
expect(subject.call(env)).to be_nil
|
185
|
+
expect(env[:domain_volumes]).to match(
|
186
|
+
[
|
187
|
+
hash_including(
|
188
|
+
device: 'vda',
|
189
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
190
|
+
),
|
191
|
+
]
|
192
|
+
)
|
193
|
+
end
|
194
|
+
|
195
|
+
context 'when multiple volumes in domain config' do
|
196
|
+
let(:domain_xml_file) { 'multi_volume_box.xml' }
|
197
|
+
|
198
|
+
it 'should populate domain volumes with devices' do
|
199
|
+
expect(subject.call(env)).to be_nil
|
200
|
+
expect(env[:domain_volumes]).to match(
|
201
|
+
[
|
202
|
+
hash_including(
|
203
|
+
device: 'vda',
|
204
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
205
|
+
),
|
206
|
+
hash_including(
|
207
|
+
device: 'vdb',
|
208
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default_1.img'
|
209
|
+
),
|
210
|
+
hash_including(
|
211
|
+
device: 'vdc',
|
212
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default_2.img'
|
213
|
+
),
|
214
|
+
]
|
215
|
+
)
|
216
|
+
end
|
217
|
+
|
218
|
+
context 'when additional storage in domain config' do
|
219
|
+
let(:domain_xml_file) { 'multi_volume_box_additional_storage.xml' }
|
220
|
+
let(:vagrantfile_providerconfig) do
|
221
|
+
<<-EOF
|
222
|
+
libvirt.storage :file, :size => '20G'
|
223
|
+
libvirt.storage :file, :size => '20G'
|
224
|
+
EOF
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'should populate disks with devices' do
|
228
|
+
expect(subject.call(env)).to be_nil
|
229
|
+
expect(env[:disks]).to match(
|
230
|
+
[
|
231
|
+
hash_including(
|
232
|
+
device: 'vdd',
|
233
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vdd.qcow2'
|
234
|
+
),
|
235
|
+
hash_including(
|
236
|
+
device: 'vde',
|
237
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vde.qcow2'
|
238
|
+
),
|
239
|
+
]
|
240
|
+
)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
context 'when no aliases available' do
|
246
|
+
let(:domain_xml_file) { 'default_no_aliases.xml' }
|
247
|
+
|
248
|
+
it 'should assume a single box volume' do
|
249
|
+
expect(subject.call(env)).to be_nil
|
250
|
+
expect(env[:domain_volumes]).to match(
|
251
|
+
[
|
252
|
+
hash_including(
|
253
|
+
device: 'vda',
|
254
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
255
|
+
),
|
256
|
+
]
|
257
|
+
)
|
258
|
+
end
|
259
|
+
|
260
|
+
context 'when additional storage and a custom disk device attached' do
|
261
|
+
let(:domain_xml_file) { 'multi_volume_box_additional_and_custom_no_aliases.xml' }
|
262
|
+
let(:vagrantfile_providerconfig) do
|
263
|
+
<<-EOF
|
264
|
+
libvirt.storage :file, :size => '20G'
|
265
|
+
libvirt.storage :file, :size => '20G'
|
266
|
+
EOF
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'should detect the domain volumes and disks while ignoring the last one' do
|
270
|
+
expect(subject.call(env)).to be_nil
|
271
|
+
expect(env[:domain_volumes]).to match(
|
272
|
+
[
|
273
|
+
hash_including(
|
274
|
+
device: 'vda',
|
275
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
|
276
|
+
),
|
277
|
+
hash_including(
|
278
|
+
device: 'vdb',
|
279
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default_1.img'
|
280
|
+
),
|
281
|
+
hash_including(
|
282
|
+
device: 'vdc',
|
283
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default_2.img'
|
284
|
+
),
|
285
|
+
]
|
286
|
+
)
|
287
|
+
expect(env[:disks]).to match(
|
288
|
+
[
|
289
|
+
hash_including(
|
290
|
+
device: 'vdd',
|
291
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vdd.qcow2'
|
292
|
+
),
|
293
|
+
hash_including(
|
294
|
+
device: 'vde',
|
295
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vde.qcow2'
|
296
|
+
),
|
297
|
+
]
|
298
|
+
)
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
context 'no default pool' do
|
305
|
+
let(:domain_xml_file) { 'default_domain.xml' }
|
306
|
+
let(:vagrantfile) do
|
307
|
+
<<-EOF
|
308
|
+
Vagrant.configure('2') do |config|
|
309
|
+
config.vm.define :test
|
310
|
+
end
|
311
|
+
EOF
|
312
|
+
end
|
313
|
+
|
314
|
+
it 'should raise an exception' do
|
315
|
+
expect(libvirt_client).to receive(:lookup_domain_by_uuid).and_return(libvirt_domain)
|
316
|
+
expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml)
|
317
|
+
expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(nil)
|
318
|
+
|
319
|
+
expect { subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::NoStoragePool)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
context 'when no box defined' do
|
325
|
+
let(:domain_xml_file) { 'default_domain.xml' }
|
326
|
+
let(:storage_pool_xml_file) { 'default_system_storage_pool.xml' }
|
327
|
+
let(:vagrantfile) do
|
328
|
+
<<-EOF
|
329
|
+
Vagrant.configure('2') do |config|
|
330
|
+
config.vm.define :test
|
331
|
+
config.vm.provider :libvirt do |libvirt|
|
332
|
+
libvirt.storage :file, :size => '20G'
|
333
|
+
end
|
334
|
+
end
|
335
|
+
EOF
|
336
|
+
end
|
337
|
+
|
338
|
+
it 'should query for domain name and storage pool path' do
|
339
|
+
expect(libvirt_client).to receive(:lookup_domain_by_uuid).and_return(libvirt_domain)
|
340
|
+
expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml)
|
341
|
+
expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
|
342
|
+
expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
|
343
|
+
|
344
|
+
expect(subject.call(env)).to be_nil
|
345
|
+
expect(env[:disks]).to match(
|
346
|
+
[
|
347
|
+
hash_including(
|
348
|
+
device: 'vda',
|
349
|
+
cache: 'default',
|
350
|
+
bus: 'virtio',
|
351
|
+
path: 'vagrant-test_default-vda.qcow2',
|
352
|
+
absolute_path: '/var/lib/libvirt/images/vagrant-test_default-vda.qcow2',
|
353
|
+
size: '20G',
|
354
|
+
pool: 'default'
|
355
|
+
),
|
356
|
+
]
|
357
|
+
)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<domain type='qemu'>
|
2
|
+
<name>vagrant-libvirt_default</name>
|
3
|
+
<uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
|
4
|
+
<description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
|
5
|
+
<memory unit='KiB'>2097152</memory>
|
6
|
+
<currentMemory unit='KiB'>2097152</currentMemory>
|
7
|
+
<vcpu placement='static'>2</vcpu>
|
8
|
+
<os>
|
9
|
+
<type arch='x86_64' machine='pc-i440fx-6.0'>hvm</type><loader type='pflash'>/path/to/loader/file</loader><nvram>/path/to/nvram/file</nvram>
|
10
|
+
<boot dev='hd'/>
|
11
|
+
</os>
|
12
|
+
<features>
|
13
|
+
<acpi/>
|
14
|
+
<apic/>
|
15
|
+
<pae/>
|
16
|
+
</features>
|
17
|
+
<cpu check='partial' mode='host-model'/>
|
18
|
+
<clock offset='utc'/>
|
19
|
+
<on_poweroff>destroy</on_poweroff>
|
20
|
+
<on_reboot>restart</on_reboot>
|
21
|
+
<on_crash>destroy</on_crash>
|
22
|
+
<devices>
|
23
|
+
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
24
|
+
<disk device='disk' type='file'>
|
25
|
+
<driver name='qemu' type='qcow2'/>
|
26
|
+
<source file='/var/lib/libvirt/images/vagrant-libvirt_default.img'/>
|
27
|
+
<target bus='virtio' dev='vda'/>
|
28
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x03' type='pci'/>
|
29
|
+
</disk>
|
30
|
+
<controller index='0' model='piix3-uhci' type='usb'>
|
31
|
+
<address bus='0x00' domain='0x0000' function='0x2' slot='0x01' type='pci'/>
|
32
|
+
</controller>
|
33
|
+
<controller index='0' model='pci-root' type='pci'/>
|
34
|
+
<interface type='network'>
|
35
|
+
<mac address='52:54:00:7d:14:0e'/>
|
36
|
+
<source network='vagrant-libvirt'/>
|
37
|
+
<model type='virtio'/>
|
38
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x05' type='pci'/>
|
39
|
+
</interface>
|
40
|
+
<serial type='pty'>
|
41
|
+
<target port='0' type='isa-serial'>
|
42
|
+
<model name='isa-serial'/>
|
43
|
+
</target>
|
44
|
+
</serial>
|
45
|
+
<console type='pty'>
|
46
|
+
<target port='0' type='serial'/>
|
47
|
+
</console>
|
48
|
+
<input bus='ps2' type='mouse'/>
|
49
|
+
<input bus='ps2' type='keyboard'/>
|
50
|
+
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'>
|
51
|
+
<listen address='127.0.0.1' type='address'/>
|
52
|
+
</graphics>
|
53
|
+
<audio id='1' type='none'/>
|
54
|
+
<video>
|
55
|
+
<model heads='1' primary='yes' type='cirrus' vram='16384'/>
|
56
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x02' type='pci'/>
|
57
|
+
</video>
|
58
|
+
<memballoon model='virtio'>
|
59
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x04' type='pci'/>
|
60
|
+
</memballoon>
|
61
|
+
</devices>
|
62
|
+
</domain>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<domain type='qemu'>
|
2
|
+
<name>vagrant-libvirt_default</name>
|
3
|
+
<uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
|
4
|
+
<description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
|
5
|
+
<memory unit='KiB'>2097152</memory>
|
6
|
+
<currentMemory unit='KiB'>2097152</currentMemory>
|
7
|
+
<vcpu placement='static'>2</vcpu>
|
8
|
+
<os>
|
9
|
+
<type arch='x86_64' machine='pc-i440fx-6.0'>hvm</type>
|
10
|
+
<loader type='pflash'>/path/to/loader/file</loader>
|
11
|
+
<nvram>/path/to/nvram/file</nvram>
|
12
|
+
<boot dev='hd'/>
|
13
|
+
</os>
|
14
|
+
<features>
|
15
|
+
<acpi/>
|
16
|
+
<apic/>
|
17
|
+
<pae/>
|
18
|
+
</features>
|
19
|
+
<cpu mode='host-model' check='partial'/>
|
20
|
+
<clock offset='utc'/>
|
21
|
+
<on_poweroff>destroy</on_poweroff>
|
22
|
+
<on_reboot>restart</on_reboot>
|
23
|
+
<on_crash>destroy</on_crash>
|
24
|
+
<devices>
|
25
|
+
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
26
|
+
<disk type='file' device='disk'>
|
27
|
+
<driver name='qemu' type='qcow2'/>
|
28
|
+
<source file='/var/lib/libvirt/images/vagrant-libvirt_default.img'/>
|
29
|
+
<target dev='vda' bus='virtio'/>
|
30
|
+
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
31
|
+
</disk>
|
32
|
+
<controller type='usb' index='0' model='piix3-uhci'>
|
33
|
+
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
34
|
+
</controller>
|
35
|
+
<controller type='pci' index='0' model='pci-root'/>
|
36
|
+
<interface type='network'>
|
37
|
+
<mac address='52:54:00:7d:14:0e'/>
|
38
|
+
<source network='vagrant-libvirt'/>
|
39
|
+
<model type='virtio'/>
|
40
|
+
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
41
|
+
</interface>
|
42
|
+
<serial type='pty'>
|
43
|
+
<target type='isa-serial' port='0'>
|
44
|
+
<model name='isa-serial'/>
|
45
|
+
</target>
|
46
|
+
</serial>
|
47
|
+
<console type='pty'>
|
48
|
+
<target type='serial' port='0'/>
|
49
|
+
</console>
|
50
|
+
<input type='mouse' bus='ps2'/>
|
51
|
+
<input type='keyboard' bus='ps2'/>
|
52
|
+
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
|
53
|
+
<listen type='address' address='127.0.0.1'/>
|
54
|
+
</graphics>
|
55
|
+
<audio id='1' type='none'/>
|
56
|
+
<video>
|
57
|
+
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
|
58
|
+
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
59
|
+
</video>
|
60
|
+
<memballoon model='virtio'>
|
61
|
+
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
62
|
+
</memballoon>
|
63
|
+
</devices>
|
64
|
+
</domain>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<domain type='qemu'>
|
2
|
+
<name>vagrant-libvirt_default</name>
|
3
|
+
<uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
|
4
|
+
<description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
|
5
|
+
<memory unit='KiB'>2097152</memory>
|
6
|
+
<currentMemory unit='KiB'>2097152</currentMemory>
|
7
|
+
<vcpu placement='static'>4</vcpu>
|
8
|
+
<os>
|
9
|
+
<type arch='x86_64' machine='pc-i440fx-6.0'>hvm</type>
|
10
|
+
<loader type='pflash'>/path/to/loader/file</loader>
|
11
|
+
<nvram>/path/to/nvram/file</nvram>
|
12
|
+
<boot dev='hd'/>
|
13
|
+
</os>
|
14
|
+
<features>
|
15
|
+
<acpi/>
|
16
|
+
<apic/>
|
17
|
+
<pae/>
|
18
|
+
</features>
|
19
|
+
<cpu check='partial' mode='host-model'/>
|
20
|
+
<clock offset='utc'/>
|
21
|
+
<on_poweroff>destroy</on_poweroff>
|
22
|
+
<on_reboot>restart</on_reboot>
|
23
|
+
<on_crash>destroy</on_crash>
|
24
|
+
<devices>
|
25
|
+
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
26
|
+
<disk device='disk' type='file'>
|
27
|
+
<driver name='qemu' type='qcow2'/>
|
28
|
+
<source file='/var/lib/libvirt/images/vagrant-libvirt_default.img'/>
|
29
|
+
<target bus='virtio' dev='vda'/>
|
30
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x03' type='pci'/>
|
31
|
+
</disk>
|
32
|
+
<controller index='0' model='piix3-uhci' type='usb'>
|
33
|
+
<address bus='0x00' domain='0x0000' function='0x2' slot='0x01' type='pci'/>
|
34
|
+
</controller>
|
35
|
+
<controller index='0' model='pci-root' type='pci'/>
|
36
|
+
<interface type='network'>
|
37
|
+
<mac address='52:54:00:7d:14:0e'/>
|
38
|
+
<source network='vagrant-libvirt'/>
|
39
|
+
<model type='virtio'/>
|
40
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x05' type='pci'/>
|
41
|
+
</interface>
|
42
|
+
<serial type='pty'>
|
43
|
+
<target port='0' type='isa-serial'>
|
44
|
+
<model name='isa-serial'/>
|
45
|
+
</target>
|
46
|
+
</serial>
|
47
|
+
<console type='pty'>
|
48
|
+
<target port='0' type='serial'/>
|
49
|
+
</console>
|
50
|
+
<input bus='ps2' type='mouse'/>
|
51
|
+
<input bus='ps2' type='keyboard'/>
|
52
|
+
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'>
|
53
|
+
<listen address='127.0.0.1' type='address'/>
|
54
|
+
</graphics>
|
55
|
+
<audio id='1' type='none'/>
|
56
|
+
<video>
|
57
|
+
<model heads='1' primary='yes' type='cirrus' vram='16384'/>
|
58
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x02' type='pci'/>
|
59
|
+
</video>
|
60
|
+
<memballoon model='virtio'>
|
61
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x04' type='pci'/>
|
62
|
+
</memballoon>
|
63
|
+
</devices>
|
64
|
+
</domain>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<domain type='qemu'>
|
2
|
+
<name>vagrant-libvirt_default</name>
|
3
|
+
<uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
|
4
|
+
<description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
|
5
|
+
<memory unit='KiB'>2097152</memory>
|
6
|
+
<currentMemory unit='KiB'>2097152</currentMemory>
|
7
|
+
<vcpu placement='static'>2</vcpu>
|
8
|
+
<os>
|
9
|
+
<type arch='x86_64' machine='pc-i440fx-6.0'>hvm</type>
|
10
|
+
|
11
|
+
|
12
|
+
<boot dev='hd'/>
|
13
|
+
</os>
|
14
|
+
<features>
|
15
|
+
<acpi/>
|
16
|
+
<apic/>
|
17
|
+
<pae/>
|
18
|
+
</features>
|
19
|
+
<cpu check='partial' mode='host-model'/>
|
20
|
+
<clock offset='utc'/>
|
21
|
+
<on_poweroff>destroy</on_poweroff>
|
22
|
+
<on_reboot>restart</on_reboot>
|
23
|
+
<on_crash>destroy</on_crash>
|
24
|
+
<devices>
|
25
|
+
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
26
|
+
<disk device='disk' type='file'>
|
27
|
+
<driver name='qemu' type='qcow2'/>
|
28
|
+
<source file='/var/lib/libvirt/images/vagrant-libvirt_default.img'/>
|
29
|
+
<target bus='virtio' dev='vda'/>
|
30
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x03' type='pci'/>
|
31
|
+
</disk>
|
32
|
+
<controller index='0' model='piix3-uhci' type='usb'>
|
33
|
+
<address bus='0x00' domain='0x0000' function='0x2' slot='0x01' type='pci'/>
|
34
|
+
</controller>
|
35
|
+
<controller index='0' model='pci-root' type='pci'/>
|
36
|
+
<interface type='network'>
|
37
|
+
<mac address='52:54:00:7d:14:0e'/>
|
38
|
+
<source network='vagrant-libvirt'/>
|
39
|
+
<model type='virtio'/>
|
40
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x05' type='pci'/>
|
41
|
+
</interface>
|
42
|
+
<serial type='pty'>
|
43
|
+
<target port='0' type='isa-serial'>
|
44
|
+
<model name='isa-serial'/>
|
45
|
+
</target>
|
46
|
+
</serial>
|
47
|
+
<console type='pty'>
|
48
|
+
<target port='0' type='serial'/>
|
49
|
+
</console>
|
50
|
+
<input bus='ps2' type='mouse'/>
|
51
|
+
<input bus='ps2' type='keyboard'/>
|
52
|
+
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'>
|
53
|
+
<listen address='127.0.0.1' type='address'/>
|
54
|
+
</graphics>
|
55
|
+
<audio id='1' type='none'/>
|
56
|
+
<video>
|
57
|
+
<model heads='1' primary='yes' type='cirrus' vram='16384'/>
|
58
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x02' type='pci'/>
|
59
|
+
</video>
|
60
|
+
<memballoon model='virtio'>
|
61
|
+
<address bus='0x00' domain='0x0000' function='0x0' slot='0x04' type='pci'/>
|
62
|
+
</memballoon>
|
63
|
+
</devices>
|
64
|
+
</domain>
|