vagrant-libvirt 0.7.0 → 0.8.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 +25 -9
- data/lib/vagrant-libvirt/action/cleanup_on_failure.rb +76 -0
- data/lib/vagrant-libvirt/action/create_domain.rb +45 -23
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +5 -1
- data/lib/vagrant-libvirt/action/create_networks.rb +13 -0
- data/lib/vagrant-libvirt/action/destroy_domain.rb +106 -21
- data/lib/vagrant-libvirt/action/destroy_networks.rb +1 -1
- data/lib/vagrant-libvirt/action/forward_ports.rb +12 -11
- data/lib/vagrant-libvirt/action/wait_till_up.rb +6 -32
- data/lib/vagrant-libvirt/action.rb +67 -80
- data/lib/vagrant-libvirt/config.rb +45 -33
- data/lib/vagrant-libvirt/driver.rb +3 -1
- data/lib/vagrant-libvirt/errors.rb +8 -0
- data/lib/vagrant-libvirt/templates/domain.xml.erb +223 -226
- data/lib/vagrant-libvirt/templates/private_network.xml.erb +4 -1
- data/lib/vagrant-libvirt/util/network_util.rb +13 -2
- data/lib/vagrant-libvirt/util/resolvers.rb +80 -0
- data/lib/vagrant-libvirt/version +1 -1
- data/locales/en.yml +13 -0
- data/spec/spec_helper.rb +33 -28
- data/spec/support/libvirt_context.rb +3 -3
- data/spec/unit/action/cleanup_on_failure_spec.rb +131 -0
- data/spec/unit/action/create_domain_spec/additional_disks_domain.xml +6 -18
- data/spec/unit/action/create_domain_spec/custom_disk_settings.xml +43 -0
- data/spec/unit/action/create_domain_spec/default_domain.xml +6 -18
- data/spec/unit/action/create_domain_spec/two_disk_settings.xml +49 -0
- data/spec/unit/action/create_domain_spec.rb +51 -7
- data/spec/unit/action/create_domain_volume_spec.rb +5 -3
- data/spec/unit/action/destroy_domain_spec/additional_disks_domain.xml +47 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks.xml +55 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks.xml +72 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks_no_aliases.xml +67 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_disks.xml +67 -0
- data/spec/unit/action/destroy_domain_spec/cdrom_domain.xml +48 -0
- data/spec/unit/action/destroy_domain_spec.rb +134 -30
- data/spec/unit/action/forward_ports_spec.rb +10 -2
- data/spec/unit/action/prepare_nfs_settings_spec.rb +4 -0
- data/spec/unit/action/start_domain_spec/clock_timer_rtc.xml +6 -18
- data/spec/unit/action/start_domain_spec/default.xml +6 -18
- data/spec/unit/action/start_domain_spec/default_added_tpm_path.xml +6 -18
- data/spec/unit/action/start_domain_spec/default_added_tpm_version.xml +6 -18
- data/spec/unit/action/start_domain_spec/existing.xml +1 -1
- data/spec/unit/action/wait_till_up_spec.rb +2 -42
- data/spec/unit/action_spec.rb +2 -0
- data/spec/unit/config_spec.rb +85 -26
- data/spec/unit/driver_spec.rb +17 -8
- data/spec/unit/provider_spec.rb +11 -0
- data/spec/unit/templates/domain_all_settings.xml +52 -79
- data/spec/unit/templates/domain_cpu_mode_passthrough.xml +39 -0
- data/spec/unit/templates/domain_custom_cpu_model.xml +6 -18
- data/spec/unit/templates/domain_defaults.xml +6 -18
- data/spec/unit/templates/domain_spec.rb +36 -13
- data/spec/unit/templates/tpm/version_1.2.xml +6 -18
- data/spec/unit/templates/tpm/version_2.0.xml +6 -18
- data/spec/unit/util/resolvers_spec.rb +116 -0
- metadata +62 -64
@@ -5,115 +5,111 @@
|
|
5
5
|
<uuid><%= @uuid %></uuid>
|
6
6
|
<memory><%= @memory_size %></memory>
|
7
7
|
<vcpu<% if @cpuset %> cpuset='<%= @cpuset %>'<% end %>><%= @cpus %></vcpu>
|
8
|
-
|
9
|
-
|
10
8
|
<cpu mode='<%= @cpu_mode %>'>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
9
|
+
<%- if @cpu_mode != 'host-passthrough' -%>
|
10
|
+
<model fallback='<%= @cpu_fallback %>'><% if @cpu_mode == 'custom' %><%= @cpu_model %><% end %></model>
|
11
|
+
<%- end -%>
|
12
|
+
<%- if @nested -%>
|
13
|
+
<%- if @cpu_features.select{|x| x[:name] == 'vmx'}.empty? -%>
|
14
|
+
<feature policy='optional' name='vmx'/>
|
15
|
+
<%- end -%>
|
16
|
+
<%- if @cpu_features.select{|x| x[:name] == 'svm'}.empty? -%>
|
17
|
+
<feature policy='optional' name='svm'/>
|
18
|
+
<%- end -%>
|
19
|
+
<%- end -%>
|
20
|
+
<%- @cpu_features.each do |cpu_feature| -%>
|
21
|
+
<feature name='<%= cpu_feature[:name] %>' policy='<%= cpu_feature[:policy] %>'/>
|
22
|
+
<%- end -%>
|
23
|
+
<%- unless @cpu_topology.empty? -%>
|
24
|
+
<%# CPU topology -%>
|
25
|
+
<topology sockets='<%= @cpu_topology[:sockets] %>' cores='<%= @cpu_topology[:cores] %>' threads='<%= @cpu_topology[:threads] %>'/>
|
26
|
+
<%- end -%>
|
27
|
+
<%- if @numa_nodes -%>
|
28
|
+
<numa>
|
29
|
+
<%- @numa_nodes.each_with_index do |node, index| -%>
|
30
|
+
<cell id='<%= index %>' cpus='<%= node[:cpus] %>' memory='<%= node[:memory] %>'<% if node.key?(:memAccess) %> memAccess='<%= node[:memAccess] %>'<% end %>/>
|
31
|
+
<%- end -%>
|
32
|
+
</numa>
|
33
|
+
<%- end -%>
|
36
34
|
</cpu>
|
37
|
-
|
38
35
|
<%- if @nodeset -%>
|
39
36
|
<numatune>
|
40
37
|
<memory nodeset='<%= @nodeset %>'/>
|
41
38
|
</numatune>
|
42
39
|
<%- end -%>
|
43
|
-
|
40
|
+
<%- unless @memory_backing.empty? -%>
|
44
41
|
<memoryBacking>
|
45
|
-
|
42
|
+
<%- @memory_backing.each do |backing| -%>
|
46
43
|
<<%= backing[:name] %> <%= backing[:config].map { |k,v| "#{k}='#{v}'"}.join(' ') %>/>
|
47
|
-
|
44
|
+
<%- end -%>
|
48
45
|
</memoryBacking>
|
49
|
-
|
50
|
-
|
46
|
+
<%- end%>
|
47
|
+
<%- if @shares -%>
|
51
48
|
<cputune>
|
52
49
|
<shares><%= @shares %></shares>
|
53
50
|
</cputune>
|
54
|
-
|
55
|
-
|
51
|
+
<%- end -%>
|
56
52
|
<os>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
53
|
+
<%- if @machine_type -%>
|
54
|
+
<%- if @machine_arch -%>
|
55
|
+
<type arch='<%= @machine_arch %>' machine='<%= @machine_type %>'>hvm</type>
|
56
|
+
<%- else -%>
|
57
|
+
<type machine='<%= @machine_type %>'>hvm</type>
|
58
|
+
<%- end -%>
|
59
|
+
<%- else -%>
|
60
|
+
<%- if @machine_arch -%>
|
61
|
+
<type arch='<%= @machine_arch %>'>hvm</type>
|
62
|
+
<%- else -%>
|
63
|
+
<type>hvm</type>
|
64
|
+
<%- end -%>
|
65
|
+
<%- end -%>
|
66
|
+
<%- if @loader -%>
|
67
|
+
<%- if @nvram -%>
|
68
|
+
<loader readonly='yes' type='pflash'><%= @loader %></loader>
|
69
|
+
<%- else -%>
|
70
|
+
<loader readonly='yes' type='rom'><%= @loader %></loader>
|
71
|
+
<%- end -%>
|
72
|
+
<%- end -%>
|
73
|
+
<%- if @nvram -%>
|
74
|
+
<nvram><%= @nvram %></nvram>
|
75
|
+
<%- end -%>
|
76
|
+
<%- if @boot_order.count >= 1 -%>
|
77
|
+
<bootmenu enable='yes'/>
|
78
|
+
<%- end -%>
|
83
79
|
<kernel><%= @kernel %></kernel>
|
84
80
|
<initrd><%= @initrd %></initrd>
|
85
81
|
<cmdline><%= @cmd_line %></cmdline>
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
<%- if @dtb -%>
|
83
|
+
<dtb><%= @dtb %></dtb>
|
84
|
+
<% end -%>
|
89
85
|
</os>
|
90
86
|
<features>
|
91
|
-
|
87
|
+
<%- @features.each do |feature| -%>
|
92
88
|
<<%= feature %>/>
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
89
|
+
<%- end -%>
|
90
|
+
<%- if @kvm_hidden -%>
|
91
|
+
<kvm>
|
92
|
+
<hidden state='on'/>
|
93
|
+
</kvm>
|
94
|
+
<%- end -%>
|
95
|
+
<%- if !@features_hyperv.empty? -%>
|
100
96
|
<hyperv>
|
101
|
-
|
97
|
+
<%- @features_hyperv.each do |feature| -%>
|
102
98
|
<<%= feature[:name] %> state='<%= feature[:state] %>'<% if feature[:name] == 'spinlocks' %> retries='<%= feature[:retries] %>'<% end %> />
|
103
|
-
|
99
|
+
<%- end -%>
|
104
100
|
</hyperv>
|
105
|
-
|
101
|
+
<%- end -%>
|
106
102
|
</features>
|
107
103
|
<clock offset='<%= @clock_offset %>'>
|
108
|
-
|
104
|
+
<%- @clock_timers.each do |clock_timer| -%>
|
109
105
|
<timer<% clock_timer.each do |attr, value| %> <%= attr %>='<%= value %>'<% end %>/>
|
110
|
-
|
106
|
+
<%- end -%>
|
111
107
|
</clock>
|
112
108
|
<devices>
|
113
|
-
|
109
|
+
<%- if @emulator_path -%>
|
114
110
|
<emulator><%= @emulator_path %></emulator>
|
115
|
-
|
116
|
-
|
111
|
+
<%- end -%>
|
112
|
+
<%- @domain_volumes.each_with_index do |volume, index| -%>
|
117
113
|
<disk type='file' device='disk'>
|
118
114
|
<alias name='ua-box-volume-<%= index -%>'/>
|
119
115
|
<driver name='qemu' type='qcow2' <%=
|
@@ -125,9 +121,9 @@
|
|
125
121
|
<%# we need to ensure a unique target dev -%>
|
126
122
|
<target dev='<%= volume[:dev] %>' bus='<%= volume[:bus] %>'/>
|
127
123
|
</disk>
|
128
|
-
|
124
|
+
<%- end -%>
|
129
125
|
<%# additional disks -%>
|
130
|
-
|
126
|
+
<%- @disks.each_with_index do |d, index| -%>
|
131
127
|
<disk type='file' device='disk'>
|
132
128
|
<alias name='ua-disk-volume-<%= index -%>'/>
|
133
129
|
<driver name='qemu' type='<%= d[:type] %>' <%=
|
@@ -138,187 +134,188 @@
|
|
138
134
|
-%>/>
|
139
135
|
<source file='<%= d[:absolute_path] %>'/>
|
140
136
|
<target dev='<%= d[:device] %>' bus='<%= d[:bus] %>'/>
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
137
|
+
<%- if d[:shareable] -%>
|
138
|
+
<shareable/>
|
139
|
+
<%- end -%>
|
140
|
+
<%- if d[:serial] -%>
|
141
|
+
<serial><%= d[:serial] %></serial>
|
142
|
+
<%- end -%>
|
143
|
+
<%- if d[:wwn] -%>
|
144
|
+
<wwn><%= d[:wwn] %></wwn>
|
145
|
+
<%- end -%>
|
150
146
|
<%# this will get auto generated by Libvirt
|
151
147
|
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
|
152
148
|
-%>
|
153
149
|
</disk>
|
154
150
|
<% end -%>
|
155
|
-
|
156
|
-
<% @cdroms.each do |c| %>
|
151
|
+
<%- @cdroms.each do |c| -%>
|
157
152
|
<disk type='file' device='cdrom'>
|
158
153
|
<driver name='qemu' type='<%= c[:type] %>' />
|
159
154
|
<source file='<%= c[:path] %>'/>
|
160
155
|
<target dev='<%= c[:dev] %>' bus='<%= c[:bus] %>'/>
|
161
156
|
<readonly/>
|
162
157
|
</disk>
|
163
|
-
|
164
|
-
|
165
|
-
<% @serials.each_with_index do |serial, port| %>
|
158
|
+
<%- end -%>
|
159
|
+
<%- @serials.each_with_index do |serial, port| -%>
|
166
160
|
<serial type='<%= serial[:type] %>'>
|
167
|
-
|
161
|
+
<%- unless serial[:source].nil? -%>
|
168
162
|
<source path='<%= serial[:source][:path] %>'/>
|
169
|
-
|
163
|
+
<%- end -%>
|
170
164
|
<target port='<%= port %>'/>
|
171
165
|
</serial>
|
172
|
-
|
173
|
-
|
166
|
+
<%- end -%>
|
167
|
+
<%- unless @serials.empty? -%>
|
168
|
+
<%- console_log = @serials.first -%>
|
174
169
|
<console type='<%= console_log[:type] %>'>
|
175
|
-
|
170
|
+
<%- unless console_log[:source].nil? -%>
|
176
171
|
<source path='<%= console_log[:source][:path] %>'/>
|
177
|
-
|
172
|
+
<%- end -%>
|
178
173
|
<target port='0'/>
|
179
174
|
</console>
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<source
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
<% if channel[:target_port] %>
|
201
|
-
port="<%= channel[:target_port] %>"
|
202
|
-
<% end %>
|
203
|
-
/>
|
204
|
-
</channel>
|
205
|
-
<% end %>
|
206
|
-
|
207
|
-
<% @inputs.each do |input| %>
|
175
|
+
<%- end -%>
|
176
|
+
<%- @channels.each do |channel| -%>
|
177
|
+
<channel type='<%= channel[:type] %>' >
|
178
|
+
<%-if channel[:source_mode] or channel[:source_path] -%>
|
179
|
+
<source <%=
|
180
|
+
channel.select { |k,_| [:source_mode, :source_path].include? k }
|
181
|
+
.reject { |k,v| v.nil? }
|
182
|
+
.map { |k,v| "#{k.to_s.split('_').last}='#{v}'"}
|
183
|
+
.join(' ')
|
184
|
+
-%>/>
|
185
|
+
<%- end -%>
|
186
|
+
<target type='<%= channel[:target_type] %>' <%=
|
187
|
+
channel.select { |k,_| [:target_name, :target_address, :target_port].include? k }
|
188
|
+
.reject { |k,v| v.nil? }
|
189
|
+
.map { |k,v| "#{k.to_s.split('_').last}='#{v}'"}
|
190
|
+
.join(' ')
|
191
|
+
-%>/>
|
192
|
+
</channel>
|
193
|
+
<%- end -%>
|
194
|
+
<%- @inputs.each do |input| -%>
|
208
195
|
<input type='<%= input[:type] %>' bus='<%= input[:bus] %>'/>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
<
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
196
|
+
<%- end -%>
|
197
|
+
<%- if !@sound_type.nil? -%>
|
198
|
+
<%# Sound device-%>
|
199
|
+
<sound model='<%= @sound_type %>'>
|
200
|
+
</sound>
|
201
|
+
<%# End Sound%>
|
202
|
+
<%- end -%>
|
203
|
+
<%- if @graphics_type != 'none'
|
204
|
+
graphics = {
|
205
|
+
'type' => @graphics_type,
|
206
|
+
'port' => @graphics_port,
|
207
|
+
'autoport' => @graphics_autoport,
|
208
|
+
'listen' => @graphics_ip,
|
209
|
+
'keymap' => @keymap,
|
210
|
+
'passwd' => @graphics_passwd,
|
211
|
+
}
|
212
|
+
-%>
|
213
|
+
<%# Video device -%>
|
214
|
+
<graphics <%=
|
215
|
+
graphics.reject { |k,v| v.nil? }
|
216
|
+
.map { |k,v| "#{k}='#{v}'" }
|
217
|
+
.join(' ')
|
218
|
+
-%><%- if not @graphics_gl %>/><% else %>>
|
219
|
+
<gl enable='yes'/>
|
220
|
+
</graphics><% end -%>
|
221
|
+
<video>
|
222
|
+
<model type='<%= @video_type %>' vram='<%= @video_vram %>' heads='1'<% if not @video_accel3d %>/><% else %>>
|
223
|
+
<acceleration accel3d='yes'/>
|
224
|
+
</model><% end -%>
|
225
|
+
</video>
|
226
|
+
<%#End Video -%>
|
227
|
+
<%- end -%>
|
228
|
+
<%- if @rng[:model] == "random"%>
|
229
|
+
<rng model='virtio'>
|
230
|
+
<backend model='random'>/dev/random</backend>
|
231
|
+
</rng>
|
232
|
+
<%- end -%>
|
233
|
+
<%- @pcis.each do |pci| -%>
|
234
|
+
<hostdev mode='subsystem' type='pci' managed='yes'>
|
235
|
+
<source>
|
236
|
+
<address <%= pci.select { |k,_| [:domain, :bus, :slot, :function].include? k }
|
237
|
+
.reject { |k,v| v.nil? }
|
238
|
+
.map { |k,v| "#{k.to_s}='#{v}'" }
|
239
|
+
.join(' ')
|
240
|
+
-%>/>
|
241
|
+
</source>
|
242
|
+
</hostdev>
|
243
|
+
<%- end -%>
|
244
|
+
<%- @usbs.each do |usb| -%>
|
245
|
+
<hostdev mode='subsystem' type='usb'>
|
246
|
+
<source startupPolicy='<%= usb[:startupPolicy] || "mandatory" %>'>
|
247
|
+
<%- if usb[:vendor] -%>
|
248
|
+
<vendor id='<%= usb[:vendor] %>'/>
|
249
|
+
<%- end -%>
|
250
|
+
<%- if usb[:product] -%>
|
251
|
+
<product id='<%= usb[:product] %>'/>
|
252
|
+
<%- end -%>
|
253
|
+
<%- if usb[:bus] && usb[:device] -%>
|
254
|
+
<address bus='<%= usb[:bus] %>' device='<%= usb[:device] %>'/>
|
255
|
+
<%- end -%>
|
256
|
+
</source>
|
257
|
+
</hostdev>
|
258
|
+
<%- end -%>
|
259
|
+
<%- unless @redirdevs.empty? -%>
|
260
|
+
<%- @redirdevs.each do |redirdev| -%>
|
261
|
+
<redirdev bus='usb' type='<%= redirdev[:type] %>'>
|
262
|
+
</redirdev>
|
263
|
+
<%- end -%>
|
264
|
+
<%- unless @redirfilters.empty? -%>
|
265
|
+
<redirfilter>
|
266
|
+
<%- @redirfilters.each do |usbdev| -%>
|
267
|
+
<usbdev class='<%= usbdev[:class] %>' vendor='<%= usbdev[:vendor] %>' product='<%= usbdev[:product] %>' version='<%= usbdev[:version] %>' allow='<%= usbdev[:allow] %>'/>
|
268
|
+
<%- end -%>
|
269
|
+
</redirfilter>
|
270
|
+
<%- end -%>
|
271
|
+
<%- end -%>
|
272
|
+
<%- unless @watchdog_dev.empty? -%>
|
273
273
|
<%# Watchdog Device -%>
|
274
274
|
<watchdog model='<%= @watchdog_dev[:model] %>' action='<%= @watchdog_dev[:action] %>'/>
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
<% if @tpm_path || @tpm_version -%>
|
275
|
+
<%- end -%>
|
276
|
+
<%- unless @smartcard_dev.empty? -%>
|
277
|
+
<%- if @smartcard_dev[:mode] == 'passthrough' -%>
|
278
|
+
<%- if @smartcard_dev[:type] == 'tcp' -%>
|
279
|
+
<smartcard mode='<%= @smartcard_dev[:mode] %>' type='<%= @smartcard_dev[:type] %>'>
|
280
|
+
<source mode='<%= @smartcard_dev[:source_mode] %>' host='<%= @smartcard_dev[:source_host] %>' service='<%= @smartcard_dev[:source_service] %>'/>
|
281
|
+
</smartcard>
|
282
|
+
<%- else -%>
|
283
|
+
<smartcard mode='<%= @smartcard_dev[:mode] %>' type='<%= @smartcard_dev[:type] %>'/>
|
284
|
+
<%- end -%>
|
285
|
+
<%- end -%>
|
286
|
+
<%- end -%>
|
287
|
+
<%- if @tpm_path || @tpm_version -%>
|
290
288
|
<%# TPM Device -%>
|
291
289
|
<tpm model='<%= @tpm_model %>'>
|
292
290
|
<backend type='<%= @tpm_type %>'<% if @tpm_version %> version='<%= @tpm_version %>'<% end %>>
|
293
|
-
|
291
|
+
<%- if @tpm_path -%>
|
294
292
|
<device path='<%= @tpm_path %>'/>
|
295
|
-
|
293
|
+
<%- end -%>
|
296
294
|
</backend>
|
297
295
|
</tpm>
|
298
|
-
|
299
|
-
|
296
|
+
<%- end -%>
|
297
|
+
<%- if not @usbctl_dev.empty? -%>
|
300
298
|
<%# USB Controller -%>
|
301
299
|
<controller type='usb' model='<%= @usbctl_dev[:model] %>' <%= "ports=\"#{@usbctl_dev[:ports]}\" " if @usbctl_dev[:ports] %>/>
|
302
|
-
|
303
|
-
|
304
|
-
|
300
|
+
<%- end -%>
|
301
|
+
<%- unless @memballoon_enabled.nil? -%>
|
302
|
+
<%- if @memballoon_enabled -%>
|
305
303
|
<memballoon model='<%= @memballoon_model %>'>
|
306
304
|
<address type='pci' domain='0x0000' bus='<%= @memballoon_pci_bus %>' slot='<%= @memballoon_pci_slot %>' function='0x0'/>
|
307
305
|
</memballoon>
|
308
|
-
|
306
|
+
<%- else -%>
|
309
307
|
<memballoon model='none'/>
|
310
|
-
|
311
|
-
|
308
|
+
<%- end -%>
|
309
|
+
<%- end -%>
|
312
310
|
</devices>
|
313
|
-
|
314
|
-
<% if not @qemu_args.empty? or not @qemu_env.empty? %>
|
311
|
+
<%- if not @qemu_args.empty? or not @qemu_env.empty? -%>
|
315
312
|
<qemu:commandline>
|
316
|
-
|
313
|
+
<%- @qemu_args.each do |arg| -%>
|
317
314
|
<qemu:arg value='<%= arg[:value] %>'/>
|
318
|
-
|
319
|
-
|
315
|
+
<%- end -%>
|
316
|
+
<%- @qemu_env.each do |env_var, env_value| -%>
|
320
317
|
<qemu:env name='<%= env_var.to_s %>' value='<%= env_value %>'/>
|
321
|
-
|
318
|
+
<%- end -%>
|
322
319
|
</qemu:commandline>
|
323
|
-
|
320
|
+
<%- end -%>
|
324
321
|
</domain>
|
@@ -18,8 +18,11 @@
|
|
18
18
|
<% end %>
|
19
19
|
<% end %>
|
20
20
|
|
21
|
-
<% if @network_forward_mode != 'veryisolated' %>
|
21
|
+
<% if @network_forward_mode != 'veryisolated' && !@network_address.nil? %>
|
22
22
|
<ip address="<%= @network_address %>" netmask="<%= @network_netmask %>">
|
23
|
+
<% if @tftp_root %>
|
24
|
+
<tftp root="<%= @tftp_root %>" />
|
25
|
+
<% end %>
|
23
26
|
<% if @network_dhcp_enabled %>
|
24
27
|
<dhcp>
|
25
28
|
<range start="<%= @network_range_start %>" end="<%= @network_range_stop %>" />
|
@@ -32,6 +32,7 @@ module VagrantPlugins
|
|
32
32
|
management_network_pci_slot = env[:machine].provider_config.management_network_pci_slot
|
33
33
|
management_network_domain = env[:machine].provider_config.management_network_domain
|
34
34
|
management_network_mtu = env[:machine].provider_config.management_network_mtu
|
35
|
+
management_network_keep = env[:machine].provider_config.management_network_keep
|
35
36
|
logger.info "Using #{management_network_name} at #{management_network_address} as the management network #{management_network_mode} is the mode"
|
36
37
|
|
37
38
|
begin
|
@@ -92,8 +93,18 @@ module VagrantPlugins
|
|
92
93
|
management_network_options[:slot] = management_network_pci_slot
|
93
94
|
end
|
94
95
|
|
95
|
-
if
|
96
|
-
|
96
|
+
if management_network_keep
|
97
|
+
management_network_options[:always_destroy] = false
|
98
|
+
end
|
99
|
+
|
100
|
+
# if there is a box and management network is disabled
|
101
|
+
# need qemu agent enabled and at least one network that can be accessed
|
102
|
+
if (
|
103
|
+
env[:machine].config.vm.box &&
|
104
|
+
!env[:machine].provider_config.mgmt_attach &&
|
105
|
+
!env[:machine].provider_config.qemu_use_agent &&
|
106
|
+
!env[:machine].config.vm.networks.any? { |type, _| ["private_network", "public_network"].include?(type.to_s) }
|
107
|
+
)
|
97
108
|
raise Errors::ManagementNetworkRequired
|
98
109
|
end
|
99
110
|
|