vagrant-libvirt 0.0.42 → 0.2.1
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 +5 -5
- data/README.md +393 -147
- data/lib/vagrant-libvirt/action.rb +3 -2
- data/lib/vagrant-libvirt/action/create_domain.rb +87 -37
- data/lib/vagrant-libvirt/action/create_domain_volume.rb +19 -14
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +9 -5
- data/lib/vagrant-libvirt/action/create_networks.rb +7 -2
- data/lib/vagrant-libvirt/action/destroy_domain.rb +1 -1
- data/lib/vagrant-libvirt/action/destroy_networks.rb +5 -0
- data/lib/vagrant-libvirt/action/forward_ports.rb +10 -8
- data/lib/vagrant-libvirt/action/halt_domain.rb +1 -1
- data/lib/vagrant-libvirt/action/handle_box_image.rb +26 -15
- data/lib/vagrant-libvirt/action/handle_storage_pool.rb +9 -4
- data/lib/vagrant-libvirt/action/package_domain.rb +58 -12
- data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +3 -9
- data/lib/vagrant-libvirt/action/prune_nfs_exports.rb +19 -9
- data/lib/vagrant-libvirt/action/remove_libvirt_image.rb +2 -2
- data/lib/vagrant-libvirt/action/remove_stale_volume.rb +17 -11
- data/lib/vagrant-libvirt/action/set_boot_order.rb +2 -2
- data/lib/vagrant-libvirt/action/set_name_of_domain.rb +6 -9
- data/lib/vagrant-libvirt/action/start_domain.rb +2 -2
- data/lib/vagrant-libvirt/action/wait_till_up.rb +31 -16
- data/lib/vagrant-libvirt/cap/public_address.rb +16 -0
- data/lib/vagrant-libvirt/cap/synced_folder.rb +3 -3
- data/lib/vagrant-libvirt/config.rb +177 -29
- data/lib/vagrant-libvirt/driver.rb +31 -2
- data/lib/vagrant-libvirt/errors.rb +5 -1
- data/lib/vagrant-libvirt/plugin.rb +7 -2
- data/lib/vagrant-libvirt/templates/default_storage_pool.xml.erb +3 -3
- data/lib/vagrant-libvirt/templates/domain.xml.erb +48 -8
- data/lib/vagrant-libvirt/util.rb +1 -0
- data/lib/vagrant-libvirt/util/erb_template.rb +6 -7
- data/lib/vagrant-libvirt/util/network_util.rb +33 -13
- data/lib/vagrant-libvirt/util/nfs.rb +17 -0
- data/lib/vagrant-libvirt/util/storage_util.rb +27 -0
- data/lib/vagrant-libvirt/version.rb +1 -1
- data/locales/en.yml +8 -4
- data/spec/support/environment_helper.rb +1 -1
- data/spec/support/libvirt_context.rb +1 -1
- data/spec/support/sharedcontext.rb +2 -2
- data/spec/unit/action/destroy_domain_spec.rb +2 -2
- data/spec/unit/action/set_name_of_domain_spec.rb +3 -3
- data/spec/unit/config_spec.rb +173 -0
- data/spec/unit/templates/domain_all_settings.xml +20 -4
- data/spec/unit/templates/domain_custom_cpu_model.xml +48 -0
- data/spec/unit/templates/domain_defaults.xml +2 -0
- data/spec/unit/templates/domain_spec.rb +26 -2
- metadata +24 -32
- data/.coveralls.yml +0 -1
- data/.github/issue_template.md +0 -37
- data/.gitignore +0 -21
- data/.travis.yml +0 -24
- data/Gemfile +0 -26
- data/Rakefile +0 -8
- data/example_box/README.md +0 -29
- data/example_box/Vagrantfile +0 -60
- data/example_box/metadata.json +0 -5
- data/tools/create_box.sh +0 -130
- data/tools/prepare_redhat_for_box.sh +0 -119
- data/vagrant-libvirt.gemspec +0 -54
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ProviderLibvirt
|
3
|
+
module Cap
|
4
|
+
class PublicAddress
|
5
|
+
def self.public_address(machine)
|
6
|
+
# This does not need to be a globally routable address, it
|
7
|
+
# only needs to be accessible from the machine running
|
8
|
+
# Vagrant.
|
9
|
+
ssh_info = machine.ssh_info
|
10
|
+
return nil if !ssh_info
|
11
|
+
ssh_info[:host]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -20,7 +20,7 @@ module VagrantPlugins
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def usable?(machine, _raise_error = false)
|
23
|
-
# bail now if not using
|
23
|
+
# bail now if not using Libvirt since checking version would throw error
|
24
24
|
return false unless machine.provider_name == :libvirt
|
25
25
|
|
26
26
|
# <filesystem/> support in device attach/detach introduced in 1.2.2
|
@@ -30,7 +30,7 @@ module VagrantPlugins
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def prepare(machine, folders, _opts)
|
33
|
-
raise Vagrant::Errors::Error('No
|
33
|
+
raise Vagrant::Errors::Error('No Libvirt connection') if machine.provider.driver.connection.nil?
|
34
34
|
@conn = machine.provider.driver.connection.client
|
35
35
|
|
36
36
|
begin
|
@@ -89,7 +89,7 @@ module VagrantPlugins
|
|
89
89
|
|
90
90
|
def cleanup(machine, _opts)
|
91
91
|
if machine.provider.driver.connection.nil?
|
92
|
-
raise Vagrant::Errors::Error('No
|
92
|
+
raise Vagrant::Errors::Error('No Libvirt connection')
|
93
93
|
end
|
94
94
|
@conn = machine.provider.driver.connection.client
|
95
95
|
begin
|
@@ -20,12 +20,12 @@ module VagrantPlugins
|
|
20
20
|
# A hypervisor name to access via Libvirt.
|
21
21
|
attr_accessor :driver
|
22
22
|
|
23
|
-
# The name of the server, where
|
23
|
+
# The name of the server, where Libvirtd is running.
|
24
24
|
attr_accessor :host
|
25
25
|
|
26
26
|
# If use ssh tunnel to connect to Libvirt.
|
27
27
|
attr_accessor :connect_via_ssh
|
28
|
-
# Path towards the
|
28
|
+
# Path towards the Libvirt socket
|
29
29
|
attr_accessor :socket
|
30
30
|
|
31
31
|
# The username to access Libvirt.
|
@@ -40,11 +40,16 @@ module VagrantPlugins
|
|
40
40
|
# Libvirt storage pool name, where box image and instance snapshots will
|
41
41
|
# be stored.
|
42
42
|
attr_accessor :storage_pool_name
|
43
|
+
attr_accessor :storage_pool_path
|
44
|
+
|
45
|
+
# Libvirt storage pool where the base image snapshot shall be stored
|
46
|
+
attr_accessor :snapshot_pool_name
|
43
47
|
|
44
48
|
# Turn on to prevent hostname conflicts
|
45
49
|
attr_accessor :random_hostname
|
46
50
|
|
47
51
|
# Libvirt default network
|
52
|
+
attr_accessor :management_network_device
|
48
53
|
attr_accessor :management_network_name
|
49
54
|
attr_accessor :management_network_address
|
50
55
|
attr_accessor :management_network_mode
|
@@ -53,24 +58,35 @@ module VagrantPlugins
|
|
53
58
|
attr_accessor :management_network_autostart
|
54
59
|
attr_accessor :management_network_pci_bus
|
55
60
|
attr_accessor :management_network_pci_slot
|
61
|
+
attr_accessor :management_network_domain
|
62
|
+
|
63
|
+
# System connection information
|
64
|
+
attr_accessor :system_uri
|
56
65
|
|
57
66
|
# Default host prefix (alternative to use project folder name)
|
58
67
|
attr_accessor :default_prefix
|
59
68
|
|
60
69
|
# Domain specific settings used while creating new domain.
|
70
|
+
attr_accessor :title
|
71
|
+
attr_accessor :description
|
61
72
|
attr_accessor :uuid
|
62
73
|
attr_accessor :memory
|
74
|
+
attr_accessor :nodeset
|
63
75
|
attr_accessor :memory_backing
|
64
76
|
attr_accessor :channel
|
65
77
|
attr_accessor :cpus
|
78
|
+
attr_accessor :cpuset
|
66
79
|
attr_accessor :cpu_mode
|
67
80
|
attr_accessor :cpu_model
|
68
81
|
attr_accessor :cpu_fallback
|
69
82
|
attr_accessor :cpu_features
|
70
83
|
attr_accessor :cpu_topology
|
84
|
+
attr_accessor :shares
|
71
85
|
attr_accessor :features
|
86
|
+
attr_accessor :features_hyperv
|
72
87
|
attr_accessor :numa_nodes
|
73
88
|
attr_accessor :loader
|
89
|
+
attr_accessor :nvram
|
74
90
|
attr_accessor :boot_order
|
75
91
|
attr_accessor :machine_type
|
76
92
|
attr_accessor :machine_arch
|
@@ -126,6 +142,9 @@ module VagrantPlugins
|
|
126
142
|
# Watchdog device
|
127
143
|
attr_accessor :watchdog_dev
|
128
144
|
|
145
|
+
# USB controller
|
146
|
+
attr_accessor :usbctl_dev
|
147
|
+
|
129
148
|
# USB device passthrough
|
130
149
|
attr_accessor :usbs
|
131
150
|
|
@@ -148,6 +167,12 @@ module VagrantPlugins
|
|
148
167
|
# Additional qemuargs arguments
|
149
168
|
attr_accessor :qemu_args
|
150
169
|
|
170
|
+
# Additional qemuenv arguments
|
171
|
+
attr_accessor :qemu_env
|
172
|
+
|
173
|
+
# Use QEMU session instead of system
|
174
|
+
attr_accessor :qemu_use_session
|
175
|
+
|
151
176
|
def initialize
|
152
177
|
@uri = UNSET_VALUE
|
153
178
|
@driver = UNSET_VALUE
|
@@ -157,7 +182,9 @@ module VagrantPlugins
|
|
157
182
|
@password = UNSET_VALUE
|
158
183
|
@id_ssh_key_file = UNSET_VALUE
|
159
184
|
@storage_pool_name = UNSET_VALUE
|
185
|
+
@snapshot_pool_name = UNSET_VALUE
|
160
186
|
@random_hostname = UNSET_VALUE
|
187
|
+
@management_network_device = UNSET_VALUE
|
161
188
|
@management_network_name = UNSET_VALUE
|
162
189
|
@management_network_address = UNSET_VALUE
|
163
190
|
@management_network_mode = UNSET_VALUE
|
@@ -166,20 +193,31 @@ module VagrantPlugins
|
|
166
193
|
@management_network_autostart = UNSET_VALUE
|
167
194
|
@management_network_pci_slot = UNSET_VALUE
|
168
195
|
@management_network_pci_bus = UNSET_VALUE
|
196
|
+
@management_network_domain = UNSET_VALUE
|
197
|
+
|
198
|
+
# System connection information
|
199
|
+
@system_uri = UNSET_VALUE
|
169
200
|
|
170
201
|
# Domain specific settings.
|
202
|
+
@title = UNSET_VALUE
|
203
|
+
@description = UNSET_VALUE
|
171
204
|
@uuid = UNSET_VALUE
|
172
205
|
@memory = UNSET_VALUE
|
206
|
+
@nodeset = UNSET_VALUE
|
173
207
|
@memory_backing = UNSET_VALUE
|
174
208
|
@cpus = UNSET_VALUE
|
209
|
+
@cpuset = UNSET_VALUE
|
175
210
|
@cpu_mode = UNSET_VALUE
|
176
211
|
@cpu_model = UNSET_VALUE
|
177
212
|
@cpu_fallback = UNSET_VALUE
|
178
213
|
@cpu_features = UNSET_VALUE
|
179
214
|
@cpu_topology = UNSET_VALUE
|
215
|
+
@shares = UNSET_VALUE
|
180
216
|
@features = UNSET_VALUE
|
217
|
+
@features_hyperv = UNSET_VALUE
|
181
218
|
@numa_nodes = UNSET_VALUE
|
182
219
|
@loader = UNSET_VALUE
|
220
|
+
@nvram = UNSET_VALUE
|
183
221
|
@machine_type = UNSET_VALUE
|
184
222
|
@machine_arch = UNSET_VALUE
|
185
223
|
@machine_virtual_size = UNSET_VALUE
|
@@ -231,6 +269,9 @@ module VagrantPlugins
|
|
231
269
|
# Watchdog device
|
232
270
|
@watchdog_dev = UNSET_VALUE
|
233
271
|
|
272
|
+
# USB controller
|
273
|
+
@usbctl_dev = UNSET_VALUE
|
274
|
+
|
234
275
|
# USB device passthrough
|
235
276
|
@usbs = UNSET_VALUE
|
236
277
|
|
@@ -250,7 +291,13 @@ module VagrantPlugins
|
|
250
291
|
# Attach mgmt network
|
251
292
|
@mgmt_attach = UNSET_VALUE
|
252
293
|
|
253
|
-
|
294
|
+
# Additional QEMU commandline arguments
|
295
|
+
@qemu_args = UNSET_VALUE
|
296
|
+
|
297
|
+
# Additional QEMU commandline environment variables
|
298
|
+
@qemu_env = UNSET_VALUE
|
299
|
+
|
300
|
+
@qemu_use_session = UNSET_VALUE
|
254
301
|
end
|
255
302
|
|
256
303
|
def boot(device)
|
@@ -282,7 +329,7 @@ module VagrantPlugins
|
|
282
329
|
end
|
283
330
|
end
|
284
331
|
|
285
|
-
# is it better to raise our own error, or let
|
332
|
+
# is it better to raise our own error, or let Libvirt cause the exception?
|
286
333
|
raise 'Only four cdroms may be attached at a time'
|
287
334
|
end
|
288
335
|
|
@@ -321,6 +368,17 @@ module VagrantPlugins
|
|
321
368
|
policy: options[:policy])
|
322
369
|
end
|
323
370
|
|
371
|
+
def hyperv_feature(options = {})
|
372
|
+
if options[:name].nil? || options[:state].nil?
|
373
|
+
raise 'Feature name AND state must be specified'
|
374
|
+
end
|
375
|
+
|
376
|
+
@features_hyperv = [] if @features_hyperv == UNSET_VALUE
|
377
|
+
|
378
|
+
@features_hyperv.push(name: options[:name],
|
379
|
+
state: options[:state])
|
380
|
+
end
|
381
|
+
|
324
382
|
def cputopology(options = {})
|
325
383
|
if options[:sockets].nil? || options[:cores].nil? || options[:threads].nil?
|
326
384
|
raise 'CPU topology must have all of sockets, cores and threads specified'
|
@@ -332,7 +390,7 @@ module VagrantPlugins
|
|
332
390
|
|
333
391
|
@cpu_topology[:sockets] = options[:sockets]
|
334
392
|
@cpu_topology[:cores] = options[:cores]
|
335
|
-
@cpu_topology[:threads] = options[:threads]
|
393
|
+
@cpu_topology[:threads] = options[:threads]
|
336
394
|
end
|
337
395
|
|
338
396
|
def memorybacking(option, config = {})
|
@@ -400,7 +458,14 @@ module VagrantPlugins
|
|
400
458
|
|
401
459
|
@pcis = [] if @pcis == UNSET_VALUE
|
402
460
|
|
403
|
-
|
461
|
+
if options[:domain].nil?
|
462
|
+
pci_domain = '0x0000'
|
463
|
+
else
|
464
|
+
pci_domain = options[:domain]
|
465
|
+
end
|
466
|
+
|
467
|
+
@pcis.push(domain: pci_domain,
|
468
|
+
bus: options[:bus],
|
404
469
|
slot: options[:slot],
|
405
470
|
function: options[:function])
|
406
471
|
end
|
@@ -419,6 +484,19 @@ module VagrantPlugins
|
|
419
484
|
end
|
420
485
|
|
421
486
|
|
487
|
+
def usb_controller(options = {})
|
488
|
+
if options[:model].nil?
|
489
|
+
raise 'USB controller model must be specified.'
|
490
|
+
end
|
491
|
+
|
492
|
+
if @usbctl_dev == UNSET_VALUE
|
493
|
+
@usbctl_dev = {}
|
494
|
+
end
|
495
|
+
|
496
|
+
@usbctl_dev[:model] = options[:model]
|
497
|
+
@usbctl_dev[:ports] = options[:ports]
|
498
|
+
end
|
499
|
+
|
422
500
|
def usb(options = {})
|
423
501
|
if (options[:bus].nil? || options[:device].nil?) && options[:vendor].nil? && options[:product].nil?
|
424
502
|
raise 'Bus and device and/or vendor and/or product must be specified. Check `lsusb` for these.'
|
@@ -447,9 +525,9 @@ module VagrantPlugins
|
|
447
525
|
@redirfilters = [] if @redirfilters == UNSET_VALUE
|
448
526
|
|
449
527
|
@redirfilters.push(class: options[:class] || -1,
|
450
|
-
vendor: options[:
|
451
|
-
product: options[:
|
452
|
-
version: options[:
|
528
|
+
vendor: options[:vendor] || -1,
|
529
|
+
product: options[:product] || -1,
|
530
|
+
version: options[:version] || -1,
|
453
531
|
allow: options[:allow])
|
454
532
|
end
|
455
533
|
|
@@ -526,23 +604,41 @@ module VagrantPlugins
|
|
526
604
|
cache: options[:cache] || 'default',
|
527
605
|
allow_existing: options[:allow_existing],
|
528
606
|
shareable: options[:shareable],
|
529
|
-
serial: options[:serial]
|
607
|
+
serial: options[:serial],
|
608
|
+
wwn: options[:wwn]
|
530
609
|
}
|
531
610
|
|
532
611
|
@disks << disk # append
|
533
612
|
end
|
534
613
|
|
535
614
|
def qemuargs(options = {})
|
615
|
+
@qemu_args = [] if @qemu_args == UNSET_VALUE
|
616
|
+
|
536
617
|
@qemu_args << options if options[:value]
|
537
618
|
end
|
538
619
|
|
539
|
-
|
540
|
-
|
541
|
-
|
620
|
+
def qemuenv(options = {})
|
621
|
+
@qemu_env = {} if @qemu_env == UNSET_VALUE
|
622
|
+
|
623
|
+
@qemu_env.merge!(options)
|
624
|
+
end
|
625
|
+
|
626
|
+
# code to generate URI from from either the LIBVIRT_URI environment
|
627
|
+
# variable or a config moved out of the connect action
|
628
|
+
def _generate_uri(qemu_use_session)
|
629
|
+
|
630
|
+
# If the LIBVIRT_DEFAULT_URI var is set, we'll use that
|
631
|
+
if ENV.fetch('LIBVIRT_DEFAULT_URI', '') != ""
|
632
|
+
return ENV['LIBVIRT_DEFAULT_URI']
|
633
|
+
end
|
634
|
+
|
635
|
+
# builds the Libvirt connection URI from the given driver config
|
542
636
|
# Setup connection uri.
|
543
637
|
uri = @driver.dup
|
544
638
|
virt_path = case uri
|
545
|
-
when 'qemu', '
|
639
|
+
when 'qemu', 'kvm'
|
640
|
+
qemu_use_session ? '/session' : '/system'
|
641
|
+
when 'openvz', 'uml', 'phyp', 'parallels'
|
546
642
|
'/system'
|
547
643
|
when '@en', 'esx'
|
548
644
|
'/'
|
@@ -552,38 +648,44 @@ module VagrantPlugins
|
|
552
648
|
raise "Require specify driver #{uri}"
|
553
649
|
end
|
554
650
|
if uri == 'kvm'
|
555
|
-
uri = 'qemu' # use
|
651
|
+
uri = 'qemu' # use QEMU uri for KVM domain type
|
556
652
|
end
|
557
653
|
|
558
654
|
if @connect_via_ssh
|
559
655
|
uri << '+ssh://'
|
560
656
|
uri << @username + '@' if @username
|
561
657
|
|
562
|
-
uri <<
|
563
|
-
@host
|
564
|
-
else
|
565
|
-
'localhost'
|
566
|
-
end
|
658
|
+
uri << ( @host ? @host : 'localhost' )
|
567
659
|
else
|
568
660
|
uri << '://'
|
569
661
|
uri << @host if @host
|
570
662
|
end
|
571
663
|
|
572
664
|
uri << virt_path
|
573
|
-
|
665
|
+
|
666
|
+
params = {'no_verify' => '1'}
|
574
667
|
|
575
668
|
if @id_ssh_key_file
|
576
|
-
# set ssh key for access to
|
577
|
-
uri << "\&keyfile="
|
669
|
+
# set ssh key for access to Libvirt host
|
578
670
|
# if no slash, prepend $HOME/.ssh/
|
579
|
-
@id_ssh_key_file.prepend("#{
|
580
|
-
|
671
|
+
@id_ssh_key_file.prepend("#{ENV['HOME']}/.ssh/") if @id_ssh_key_file !~ /\A\//
|
672
|
+
params['keyfile'] = @id_ssh_key_file
|
581
673
|
end
|
582
|
-
# set path to
|
583
|
-
|
674
|
+
# set path to Libvirt socket
|
675
|
+
params['socket'] = @socket if @socket
|
676
|
+
|
677
|
+
uri << "?" + params.map{|pair| pair.join('=')}.join('&')
|
584
678
|
uri
|
585
679
|
end
|
586
680
|
|
681
|
+
def _parse_uri(uri)
|
682
|
+
begin
|
683
|
+
URI.parse(uri)
|
684
|
+
rescue
|
685
|
+
raise "@uri set to invalid uri '#{uri}'"
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
587
689
|
def finalize!
|
588
690
|
@driver = 'kvm' if @driver == UNSET_VALUE
|
589
691
|
@host = nil if @host == UNSET_VALUE
|
@@ -592,7 +694,10 @@ module VagrantPlugins
|
|
592
694
|
@password = nil if @password == UNSET_VALUE
|
593
695
|
@id_ssh_key_file = 'id_rsa' if @id_ssh_key_file == UNSET_VALUE
|
594
696
|
@storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
|
697
|
+
@snapshot_pool_name = @storage_pool_name if @snapshot_pool_name == UNSET_VALUE
|
698
|
+
@storage_pool_path = nil if @storage_pool_path == UNSET_VALUE
|
595
699
|
@random_hostname = false if @random_hostname == UNSET_VALUE
|
700
|
+
@management_network_device = 'virbr0' if @management_network_device == UNSET_VALUE
|
596
701
|
@management_network_name = 'vagrant-libvirt' if @management_network_name == UNSET_VALUE
|
597
702
|
@management_network_address = '192.168.121.0/24' if @management_network_address == UNSET_VALUE
|
598
703
|
@management_network_mode = 'nat' if @management_network_mode == UNSET_VALUE
|
@@ -601,27 +706,51 @@ module VagrantPlugins
|
|
601
706
|
@management_network_autostart = false if @management_network_autostart == UNSET_VALUE
|
602
707
|
@management_network_pci_bus = nil if @management_network_pci_bus == UNSET_VALUE
|
603
708
|
@management_network_pci_slot = nil if @management_network_pci_slot == UNSET_VALUE
|
709
|
+
@management_network_domain = nil if @management_network_domain == UNSET_VALUE
|
710
|
+
@system_uri = 'qemu:///system' if @system_uri == UNSET_VALUE
|
711
|
+
|
712
|
+
# If uri isn't set then let's build one from various sources.
|
713
|
+
# Default to passing false for qemu_use_session if it's not set.
|
714
|
+
if @uri == UNSET_VALUE
|
715
|
+
@uri = _generate_uri(@qemu_use_session == UNSET_VALUE ? false : @qemu_use_session)
|
716
|
+
end
|
604
717
|
|
605
|
-
#
|
606
|
-
|
718
|
+
# Set qemu_use_session based on the URI if it wasn't set by the user
|
719
|
+
if @qemu_use_session == UNSET_VALUE
|
720
|
+
uri = _parse_uri(@uri)
|
721
|
+
if (uri.scheme.start_with? "qemu") && (uri.path.include? "session")
|
722
|
+
@qemu_use_session = true
|
723
|
+
else
|
724
|
+
@qemu_use_session = false
|
725
|
+
end
|
726
|
+
end
|
607
727
|
|
608
728
|
# Domain specific settings.
|
729
|
+
@title = '' if @title == UNSET_VALUE
|
730
|
+
@description = '' if @description == UNSET_VALUE
|
609
731
|
@uuid = '' if @uuid == UNSET_VALUE
|
610
732
|
@memory = 512 if @memory == UNSET_VALUE
|
733
|
+
@nodeset = nil if @nodeset == UNSET_VALUE
|
611
734
|
@memory_backing = [] if @memory_backing == UNSET_VALUE
|
612
735
|
@cpus = 1 if @cpus == UNSET_VALUE
|
736
|
+
@cpuset = nil if @cpuset == UNSET_VALUE
|
613
737
|
@cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE
|
614
738
|
@cpu_model = if (@cpu_model == UNSET_VALUE) && (@cpu_mode == 'custom')
|
615
739
|
'qemu64'
|
616
740
|
elsif @cpu_mode != 'custom'
|
617
741
|
''
|
742
|
+
else
|
743
|
+
@cpu_model
|
618
744
|
end
|
619
745
|
@cpu_topology = {} if @cpu_topology == UNSET_VALUE
|
620
746
|
@cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE
|
621
747
|
@cpu_features = [] if @cpu_features == UNSET_VALUE
|
748
|
+
@shares = nil if @shares == UNSET_VALUE
|
622
749
|
@features = ['acpi','apic','pae'] if @features == UNSET_VALUE
|
750
|
+
@features_hyperv = [] if @features_hyperv == UNSET_VALUE
|
623
751
|
@numa_nodes = @numa_nodes == UNSET_VALUE ? nil : _generate_numa
|
624
752
|
@loader = nil if @loader == UNSET_VALUE
|
753
|
+
@nvram = nil if @nvram == UNSET_VALUE
|
625
754
|
@machine_type = nil if @machine_type == UNSET_VALUE
|
626
755
|
@machine_arch = nil if @machine_arch == UNSET_VALUE
|
627
756
|
@machine_virtual_size = nil if @machine_virtual_size == UNSET_VALUE
|
@@ -684,6 +813,9 @@ module VagrantPlugins
|
|
684
813
|
# Watchdog device
|
685
814
|
@watchdog_dev = {} if @watchdog_dev == UNSET_VALUE
|
686
815
|
|
816
|
+
# USB controller
|
817
|
+
@usbctl_dev = {} if @usbctl_dev == UNSET_VALUE
|
818
|
+
|
687
819
|
# USB device passthrough
|
688
820
|
@usbs = [] if @usbs == UNSET_VALUE
|
689
821
|
|
@@ -703,12 +835,24 @@ module VagrantPlugins
|
|
703
835
|
# Attach mgmt network
|
704
836
|
@mgmt_attach = true if @mgmt_attach == UNSET_VALUE
|
705
837
|
|
838
|
+
# Additional QEMU commandline arguments
|
706
839
|
@qemu_args = [] if @qemu_args == UNSET_VALUE
|
840
|
+
|
841
|
+
# Additional QEMU commandline environment variables
|
842
|
+
@qemu_env = {} if @qemu_env == UNSET_VALUE
|
707
843
|
end
|
708
844
|
|
709
845
|
def validate(machine)
|
710
846
|
errors = _detected_errors
|
711
847
|
|
848
|
+
# The @uri and @qemu_use_session should not conflict
|
849
|
+
uri = _parse_uri(@uri)
|
850
|
+
if (uri.scheme.start_with? "qemu") && (uri.path.include? "session")
|
851
|
+
if @qemu_use_session != true
|
852
|
+
errors << "the URI and qemu_use_session configuration conflict: uri:'#{@uri}' qemu_use_session:'#{@qemu_use_session}'"
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
712
856
|
machine.provider_config.disks.each do |disk|
|
713
857
|
if disk[:path] && (disk[:path][0] == '/')
|
714
858
|
errors << "absolute volume paths like '#{disk[:path]}' not yet supported"
|
@@ -739,6 +883,10 @@ module VagrantPlugins
|
|
739
883
|
c = cdroms.dup
|
740
884
|
c += other.cdroms
|
741
885
|
result.cdroms = c
|
886
|
+
|
887
|
+
c = qemu_env != UNSET_VALUE ? qemu_env.dup : {}
|
888
|
+
c.merge!(other.qemu_env) if other.qemu_env != UNSET_VALUE
|
889
|
+
result.qemu_env = c
|
742
890
|
end
|
743
891
|
end
|
744
892
|
end
|