vagrant-libvirt 0.10.8 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +44 -7
- data/lib/vagrant-libvirt/action/create_domain.rb +45 -22
- data/lib/vagrant-libvirt/action/create_domain_volume.rb +3 -0
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +15 -6
- data/lib/vagrant-libvirt/action/create_networks.rb +2 -6
- data/lib/vagrant-libvirt/action/destroy_domain.rb +2 -10
- data/lib/vagrant-libvirt/action/forward_ports.rb +1 -1
- data/lib/vagrant-libvirt/action/is_suspended.rb +2 -2
- data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +7 -5
- data/lib/vagrant-libvirt/action/resolve_disk_settings.rb +2 -0
- data/lib/vagrant-libvirt/action/resume_domain.rb +3 -1
- data/lib/vagrant-libvirt/action/snapshot_delete.rb +1 -1
- data/lib/vagrant-libvirt/action/snapshot_restore.rb +1 -1
- data/lib/vagrant-libvirt/action/snapshot_save.rb +1 -2
- data/lib/vagrant-libvirt/action/start_domain.rb +149 -62
- data/lib/vagrant-libvirt/action/wait_till_up.rb +2 -2
- data/lib/vagrant-libvirt/action.rb +18 -13
- data/lib/vagrant-libvirt/cap/mount_9p.rb +9 -1
- data/lib/vagrant-libvirt/cap/snapshots.rb +1 -1
- data/lib/vagrant-libvirt/config.rb +198 -26
- data/lib/vagrant-libvirt/driver.rb +94 -55
- data/lib/vagrant-libvirt/provider.rb +4 -4
- data/lib/vagrant-libvirt/templates/domain.xml.erb +73 -27
- data/lib/vagrant-libvirt/templates/public_interface.xml.erb +6 -3
- data/lib/vagrant-libvirt/util/network_util.rb +5 -10
- data/lib/vagrant-libvirt/version +1 -1
- data/locales/en.yml +4 -0
- data/spec/acceptance/additional_storage_spec.rb +1 -4
- data/spec/acceptance/networking_spec.rb +41 -0
- data/spec/acceptance/package_domain_spec.rb +2 -2
- data/spec/acceptance/provider_settings_spec.rb +1 -1
- data/spec/acceptance/simple_vm_provision_via_shell_spec.rb +1 -1
- data/spec/acceptance/snapshots_spec.rb +1 -1
- data/spec/acceptance/two_disks_spec.rb +1 -1
- data/spec/acceptance/use_qemu_agent_for_connectivity_spec.rb +1 -1
- data/spec/spec_helper.rb +31 -8
- data/spec/support/acceptance/isolated_environment.rb +1 -1
- data/spec/support/environment_helper.rb +1 -1
- data/spec/support/libvirt_acceptance_context.rb +15 -1
- data/spec/support/{sharedcontext.rb → unit_context.rb} +20 -5
- data/spec/unit/action/clean_machine_folder_spec.rb +1 -2
- data/spec/unit/action/cleanup_on_failure_spec.rb +1 -2
- data/spec/unit/action/create_domain_spec/additional_disks_domain.xml +4 -2
- data/spec/unit/action/create_domain_spec/custom_disk_settings.xml +4 -2
- data/spec/unit/action/create_domain_spec/default_domain.xml +4 -2
- data/spec/unit/action/create_domain_spec/sysinfo.xml +4 -2
- data/spec/unit/action/create_domain_spec/sysinfo_only_required.xml +4 -2
- data/spec/unit/action/create_domain_spec/two_disk_settings.xml +4 -2
- data/spec/unit/action/create_domain_spec.rb +51 -3
- data/spec/unit/action/create_domain_volume_spec.rb +2 -4
- data/spec/unit/action/destroy_domain_spec/additional_disks_domain.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks_no_aliases.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_disks.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/cdrom_domain.xml +1 -0
- data/spec/unit/action/destroy_domain_spec.rb +1 -18
- data/spec/unit/action/forward_ports_spec.rb +1 -3
- data/spec/unit/action/halt_domain_spec.rb +2 -3
- data/spec/unit/action/handle_box_image_spec.rb +3 -4
- data/spec/unit/action/package_domain_spec.rb +2 -3
- data/spec/unit/action/prepare_nfs_settings_spec.rb +25 -9
- data/spec/unit/action/remove_libvirt_image_spec.rb +1 -2
- data/spec/unit/action/resolve_disk_settings_spec/default_domain.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/default_no_aliases.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_and_custom_no_aliases.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_storage.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec.rb +1 -1
- data/spec/unit/action/resume_domain_spec.rb +66 -0
- data/spec/unit/action/set_boot_order_spec/default.xml +1 -0
- data/spec/unit/action/set_boot_order_spec/explicit_boot_order.xml +1 -0
- data/spec/unit/action/set_boot_order_spec.rb +1 -3
- data/spec/unit/action/set_name_of_domain_spec.rb +3 -1
- data/spec/unit/action/shutdown_domain_spec.rb +4 -3
- data/spec/unit/action/start_domain_spec/clock_timer_removed.xml +1 -1
- data/spec/unit/action/start_domain_spec/clock_timer_rtc.xml +1 -1
- data/spec/unit/action/start_domain_spec/clock_timer_rtc_tsc.xml +1 -1
- data/spec/unit/action/start_domain_spec/default.xml +1 -1
- data/spec/unit/action/start_domain_spec/default_added_tpm_path.xml +1 -1
- data/spec/unit/action/start_domain_spec/default_added_tpm_version.xml +1 -1
- data/spec/unit/action/start_domain_spec/default_with_different_formatting.xml +1 -1
- data/spec/unit/action/start_domain_spec/existing.xml +2 -1
- data/spec/unit/action/start_domain_spec/existing_added_nvram.xml +2 -1
- data/spec/unit/action/start_domain_spec/existing_reordered.xml +2 -1
- data/spec/unit/action/start_domain_spec/nvram_domain.xml +1 -0
- data/spec/unit/action/start_domain_spec/nvram_domain_other_setting.xml +2 -1
- data/spec/unit/action/start_domain_spec/nvram_domain_removed.xml +2 -1
- data/spec/unit/action/start_domain_spec.rb +192 -3
- data/spec/unit/action/wait_till_up_spec.rb +3 -5
- data/spec/unit/action_spec.rb +403 -10
- data/spec/unit/cap/mount_9p_spec.rb +75 -0
- data/spec/unit/cap/synced_folder_9p_spec.rb +1 -2
- data/spec/unit/cap/synced_folder_virtiofs_spec.rb +1 -2
- data/spec/unit/config_spec.rb +365 -25
- data/spec/unit/driver_spec.rb +217 -80
- data/spec/unit/plugin_spec.rb +6 -3
- data/spec/unit/templates/domain_all_settings.xml +26 -4
- data/spec/unit/templates/domain_cpu_mode_passthrough.xml +4 -2
- data/spec/unit/templates/domain_custom_cpu_model.xml +4 -2
- data/spec/unit/templates/domain_defaults.xml +4 -2
- data/spec/unit/templates/domain_scsi_bus_storage.xml +4 -2
- data/spec/unit/templates/domain_scsi_device_storage.xml +4 -2
- data/spec/unit/templates/domain_scsi_multiple_controllers_storage.xml +4 -2
- data/spec/unit/templates/domain_spec.rb +11 -3
- data/spec/unit/templates/tpm/version_1.2.xml +4 -2
- data/spec/unit/templates/tpm/version_2.0.xml +4 -2
- data/spec/unit/util/byte_number_spec.rb +1 -1
- data/spec/unit/util/network_util_spec/default.xml +16 -0
- data/spec/unit/util/network_util_spec/hostdev.xml +6 -0
- data/spec/unit/util/network_util_spec/vagrant-libvirt.xml +16 -0
- data/spec/unit/util/network_util_spec.rb +59 -0
- data/spec/unit/util/resolvers_spec.rb +1 -1
- metadata +87 -73
@@ -87,79 +87,83 @@ module VagrantPlugins
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# cpu_mode
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
cpu = REXML::Element.new('cpu', REXML::XPath.first(xml_descr, '/domain'))
|
95
|
-
cpu.attributes['mode'] = config.cpu_mode
|
96
|
-
else
|
97
|
-
if cpu.attributes['mode'] != config.cpu_mode
|
98
|
-
@logger.debug "cpu_mode updated from '#{cpu.attributes['mode']}' to '#{config.cpu_mode}'"
|
90
|
+
if !config.cpu_mode.nil?
|
91
|
+
cpu = REXML::XPath.first(xml_descr, '/domain/cpu')
|
92
|
+
if cpu.nil?
|
93
|
+
@logger.debug "cpu_mode updated from not set to '#{config.cpu_mode}'"
|
99
94
|
descr_changed = true
|
95
|
+
cpu = REXML::Element.new('cpu', REXML::XPath.first(xml_descr, '/domain'))
|
100
96
|
cpu.attributes['mode'] = config.cpu_mode
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
if config.cpu_mode != 'host-passthrough'
|
105
|
-
cpu_model = REXML::XPath.first(xml_descr, '/domain/cpu/model')
|
106
|
-
if cpu_model.nil?
|
107
|
-
if config.cpu_model.strip != ''
|
108
|
-
@logger.debug "cpu_model updated from not set to '#{config.cpu_model}'"
|
109
|
-
descr_changed = true
|
110
|
-
cpu_model = REXML::Element.new('model', REXML::XPath.first(xml_descr, '/domain/cpu'))
|
111
|
-
cpu_model.attributes['fallback'] = 'allow'
|
112
|
-
cpu_model.text = config.cpu_model
|
113
|
-
end
|
114
97
|
else
|
115
|
-
if
|
116
|
-
@logger.debug "
|
117
|
-
descr_changed = true
|
118
|
-
cpu_model.text = config.cpu_model
|
119
|
-
end
|
120
|
-
if cpu_model.attributes['fallback'] != config.cpu_fallback
|
121
|
-
@logger.debug "cpu_model fallback attribute updated from #{cpu_model.attributes['fallback']} to '#{config.cpu_fallback}'"
|
98
|
+
if cpu.attributes['mode'] != config.cpu_mode
|
99
|
+
@logger.debug "cpu_mode updated from '#{cpu.attributes['mode']}' to '#{config.cpu_mode}'"
|
122
100
|
descr_changed = true
|
123
|
-
|
101
|
+
cpu.attributes['mode'] = config.cpu_mode
|
124
102
|
end
|
125
103
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
if
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
104
|
+
|
105
|
+
if config.cpu_mode != 'host-passthrough'
|
106
|
+
cpu_model = REXML::XPath.first(xml_descr, '/domain/cpu/model')
|
107
|
+
if cpu_model.nil?
|
108
|
+
if config.cpu_model.strip != ''
|
109
|
+
@logger.debug "cpu_model updated from not set to '#{config.cpu_model}'"
|
110
|
+
descr_changed = true
|
111
|
+
cpu_model = REXML::Element.new('model', REXML::XPath.first(xml_descr, '/domain/cpu'))
|
112
|
+
cpu_model.attributes['fallback'] = config.cpu_fallback
|
113
|
+
cpu_model.text = config.cpu_model
|
114
|
+
end
|
115
|
+
else
|
116
|
+
if (cpu_model.text or '').strip != config.cpu_model.strip
|
117
|
+
@logger.debug "cpu_model text updated from #{cpu_model.text} to '#{config.cpu_model}'"
|
118
|
+
descr_changed = true
|
119
|
+
cpu_model.text = config.cpu_model
|
120
|
+
end
|
121
|
+
if cpu_model.attributes['fallback'] != config.cpu_fallback
|
122
|
+
@logger.debug "cpu_model fallback attribute updated from #{cpu_model.attributes['fallback']} to '#{config.cpu_fallback}'"
|
123
|
+
descr_changed = true
|
124
|
+
cpu_model.attributes['fallback'] = config.cpu_fallback
|
125
|
+
end
|
142
126
|
end
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
127
|
+
vmx_feature = REXML::XPath.first(xml_descr, '/domain/cpu/feature[@name="vmx"]')
|
128
|
+
svm_feature = REXML::XPath.first(xml_descr, '/domain/cpu/feature[@name="svm"]')
|
129
|
+
if config.nested
|
130
|
+
if vmx_feature.nil?
|
131
|
+
@logger.debug "nested mode enabled from unset by setting cpu vmx feature"
|
132
|
+
descr_changed = true
|
133
|
+
vmx_feature = REXML::Element.new('feature', REXML::XPath.first(xml_descr, '/domain/cpu'))
|
134
|
+
vmx_feature.attributes['policy'] = 'optional'
|
135
|
+
vmx_feature.attributes['name'] = 'vmx'
|
136
|
+
end
|
137
|
+
if svm_feature.nil?
|
138
|
+
@logger.debug "nested mode enabled from unset by setting cpu svm feature"
|
139
|
+
descr_changed = true
|
140
|
+
svm_feature = REXML::Element.new('feature', REXML::XPath.first(xml_descr, '/domain/cpu'))
|
141
|
+
svm_feature.attributes['policy'] = 'optional'
|
142
|
+
svm_feature.attributes['name'] = 'svm'
|
143
|
+
end
|
144
|
+
else
|
145
|
+
unless vmx_feature.nil?
|
146
|
+
@logger.debug "nested mode disabled for cpu by removing vmx feature"
|
147
|
+
descr_changed = true
|
148
|
+
cpu.delete_element(vmx_feature)
|
149
|
+
end
|
150
|
+
unless svm_feature.nil?
|
151
|
+
@logger.debug "nested mode disabled for cpu by removing svm feature"
|
152
|
+
descr_changed = true
|
153
|
+
cpu.delete_element(svm_feature)
|
154
|
+
end
|
148
155
|
end
|
149
|
-
|
150
|
-
|
156
|
+
elsif config.numa_nodes == nil
|
157
|
+
unless cpu.elements.to_a.empty?
|
158
|
+
@logger.debug "switching cpu_mode to host-passthrough and removing emulated cpu features"
|
151
159
|
descr_changed = true
|
152
|
-
cpu.
|
153
|
-
|
154
|
-
|
155
|
-
elsif config.numa_nodes == nil
|
156
|
-
unless cpu.elements.to_a.empty?
|
157
|
-
@logger.debug "switching cpu_mode to host-passthrough and removing emulated cpu features"
|
158
|
-
descr_changed = true
|
159
|
-
cpu.elements.each do |elem|
|
160
|
-
cpu.delete_element(elem)
|
160
|
+
cpu.elements.each do |elem|
|
161
|
+
cpu.delete_element(elem)
|
162
|
+
end
|
161
163
|
end
|
162
164
|
end
|
165
|
+
else
|
166
|
+
xml_descr.delete_element('/domain/cpu')
|
163
167
|
end
|
164
168
|
|
165
169
|
# Clock
|
@@ -190,6 +194,68 @@ module VagrantPlugins
|
|
190
194
|
end
|
191
195
|
end
|
192
196
|
|
197
|
+
# Launch security
|
198
|
+
launchSecurity = REXML::XPath.first(xml_descr, '/domain/launchSecurity')
|
199
|
+
unless config.launchsecurity_data.nil?
|
200
|
+
if launchSecurity.nil?
|
201
|
+
@logger.debug "Launch security has been added"
|
202
|
+
launchSecurity = REXML::Element.new('launchSecurity', REXML::XPath.first(xml_descr, '/domain'))
|
203
|
+
descr_changed = true
|
204
|
+
end
|
205
|
+
|
206
|
+
if launchSecurity.attributes['type'] != config.launchsecurity_data[:type]
|
207
|
+
launchSecurity.attributes['type'] = config.launchsecurity_data[:type]
|
208
|
+
descr_changed = true
|
209
|
+
end
|
210
|
+
|
211
|
+
[:cbitpos, :policy, :reducedPhysBits].each do |setting|
|
212
|
+
setting_value = config.launchsecurity_data[setting]
|
213
|
+
element = REXML::XPath.first(launchSecurity, setting.to_s)
|
214
|
+
if !setting_value.nil?
|
215
|
+
if element.nil?
|
216
|
+
element = launchSecurity.add_element(setting.to_s)
|
217
|
+
descr_changed = true
|
218
|
+
end
|
219
|
+
|
220
|
+
if element.text != setting_value
|
221
|
+
@logger.debug "launchSecurity #{setting.to_s} config changed"
|
222
|
+
element.text = setting_value
|
223
|
+
descr_changed = true
|
224
|
+
end
|
225
|
+
else
|
226
|
+
if !element.nil?
|
227
|
+
launchSecurity.delete_element(setting.to_s)
|
228
|
+
descr_changed = true
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
controllers = REXML::XPath.each( xml_descr, '/domain/devices/controller')
|
234
|
+
memballoon = REXML::XPath.each( xml_descr, '/domain/devices/memballoon')
|
235
|
+
[controllers, memballoon].lazy.flat_map(&:lazy).each do |controller|
|
236
|
+
driver_node = REXML::XPath.first(controller, 'driver')
|
237
|
+
driver_node = controller.add_element('driver') if driver_node.nil?
|
238
|
+
descr_changed = true if driver_node.attributes['iommu'] != 'on'
|
239
|
+
driver_node.attributes['iommu'] = 'on'
|
240
|
+
end
|
241
|
+
else
|
242
|
+
unless launchSecurity.nil?
|
243
|
+
@logger.debug "Launch security to be deleted"
|
244
|
+
|
245
|
+
descr_changed = true
|
246
|
+
|
247
|
+
launchSecurity.parent.delete_element(launchSecurity)
|
248
|
+
end
|
249
|
+
|
250
|
+
REXML::XPath.each( xml_descr, '/domain/devices/controller') do | controller |
|
251
|
+
driver_node = REXML::XPath.first(controller, 'driver')
|
252
|
+
if !driver_node.nil?
|
253
|
+
descr_changed = true if driver_node.attributes['iommu']
|
254
|
+
driver_node.attributes.delete('iommu')
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
193
259
|
# Graphics
|
194
260
|
graphics = REXML::XPath.first(xml_descr, '/domain/devices/graphics')
|
195
261
|
if config.graphics_type != 'none'
|
@@ -214,6 +280,10 @@ module VagrantPlugins
|
|
214
280
|
graphics.attributes['port'] = config.graphics_port
|
215
281
|
end
|
216
282
|
end
|
283
|
+
if graphics.attributes['websocket'] != config.graphics_websocket.to_s
|
284
|
+
descr_changed = true
|
285
|
+
graphics.attributes['websocket'] = config.graphics_websocket
|
286
|
+
end
|
217
287
|
if graphics.attributes['keymap'] != config.keymap
|
218
288
|
descr_changed = true
|
219
289
|
graphics.attributes['keymap'] = config.keymap
|
@@ -478,6 +548,23 @@ module VagrantPlugins
|
|
478
548
|
raise Errors::DomainStartError, error_message: e.message
|
479
549
|
end
|
480
550
|
|
551
|
+
#libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id)
|
552
|
+
xmldoc = REXML::Document.new(libvirt_domain.xml_desc)
|
553
|
+
graphics = REXML::XPath.first(xmldoc, '/domain/devices/graphics')
|
554
|
+
|
555
|
+
if !graphics.nil?
|
556
|
+
if config.graphics_autoport
|
557
|
+
env[:ui].info(I18n.t('vagrant_libvirt.starting_domain_with_graphics'))
|
558
|
+
env[:ui].info(" -- Graphics Port: #{graphics.attributes['port']}")
|
559
|
+
env[:ui].info(" -- Graphics IP: #{graphics.attributes['listen']}")
|
560
|
+
env[:ui].info(" -- Graphics Password: #{config.graphics_passwd.nil? ? 'Not defined' : 'Defined'}")
|
561
|
+
end
|
562
|
+
|
563
|
+
if config.graphics_websocket == -1
|
564
|
+
env[:ui].info(" -- Graphics Websocket: #{graphics.attributes['websocket']}")
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
481
568
|
@app.call(env)
|
482
569
|
end
|
483
570
|
end
|
@@ -23,7 +23,7 @@ module VagrantPlugins
|
|
23
23
|
env[:metrics] ||= {}
|
24
24
|
|
25
25
|
driver = env[:machine].provider.driver
|
26
|
-
domain = driver.get_domain
|
26
|
+
domain = driver.get_domain
|
27
27
|
|
28
28
|
if domain.nil?
|
29
29
|
raise Errors::NoDomainError,
|
@@ -42,7 +42,7 @@ module VagrantPlugins
|
|
42
42
|
return if env[:interrupted]
|
43
43
|
|
44
44
|
# Wait for domain to obtain an ip address
|
45
|
-
env[:ip_address] = driver.
|
45
|
+
env[:ip_address] = driver.get_ipaddress(domain)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
@logger.info("Got IP address #{env[:ip_address]}")
|
@@ -52,7 +52,6 @@ module VagrantPlugins
|
|
52
52
|
autoload :StartDomain, action_root.join('start_domain')
|
53
53
|
autoload :StartShutdownTimer, action_root.join('shutdown_domain')
|
54
54
|
autoload :SuspendDomain, action_root.join('suspend_domain')
|
55
|
-
autoload :TimedProvision, action_root.join('timed_provision')
|
56
55
|
autoload :WaitTillUp, action_root.join('wait_till_up')
|
57
56
|
|
58
57
|
autoload :Package, 'vagrant/action/general/package'
|
@@ -94,8 +93,6 @@ module VagrantPlugins
|
|
94
93
|
b2.use CreateNetworkInterfaces
|
95
94
|
|
96
95
|
b2.use action_start
|
97
|
-
|
98
|
-
b2.use SetupComplete
|
99
96
|
else
|
100
97
|
b2.use HandleStoragePool
|
101
98
|
require 'vagrant/action/builtin/handle_box'
|
@@ -112,6 +109,7 @@ module VagrantPlugins
|
|
112
109
|
b2.use SetHostname
|
113
110
|
end
|
114
111
|
else
|
112
|
+
# start VM if halted
|
115
113
|
env[:halt_on_error] = true
|
116
114
|
b2.use ResolveDiskSettings
|
117
115
|
b2.use CreateNetworks
|
@@ -129,7 +127,6 @@ module VagrantPlugins
|
|
129
127
|
# poweroff state.
|
130
128
|
private_class_method def self.action_start
|
131
129
|
Vagrant::Action::Builder.new.tap do |b|
|
132
|
-
b.use ConfigValidate
|
133
130
|
b.use Call, IsRunning do |env, b2|
|
134
131
|
# If the VM is running, run the necessary provisioners
|
135
132
|
if env[:result]
|
@@ -138,16 +135,19 @@ module VagrantPlugins
|
|
138
135
|
end
|
139
136
|
|
140
137
|
b2.use Call, IsSuspended do |env2, b3|
|
141
|
-
# if vm is suspended resume it
|
138
|
+
# if vm is suspended resume it
|
142
139
|
if env2[:result]
|
143
140
|
b3.use ResumeDomain
|
144
|
-
next
|
145
|
-
end
|
146
141
|
|
147
|
-
|
142
|
+
# if there was a box, want to wait until the communicator is
|
143
|
+
# available and then forward ports
|
144
|
+
next if !env[:machine].config.vm.box
|
145
|
+
elsif !env[:machine].config.vm.box
|
148
146
|
# With no box, we just care about network creation and starting it
|
149
147
|
b3.use SetBootOrder
|
150
148
|
b3.use StartDomain
|
149
|
+
|
150
|
+
next
|
151
151
|
else
|
152
152
|
# VM is not running or suspended.
|
153
153
|
b3.use PrepareNFSValidIds
|
@@ -165,11 +165,12 @@ module VagrantPlugins
|
|
165
165
|
# Machine should gain IP address when coming up,
|
166
166
|
# so wait for dhcp lease and store IP into machines data_dir.
|
167
167
|
b3.use WaitTillUp
|
168
|
-
require 'vagrant/action/builtin/wait_for_communicator'
|
169
|
-
b3.use WaitForCommunicator, [:running]
|
170
|
-
|
171
|
-
b3.use ForwardPorts
|
172
168
|
end
|
169
|
+
|
170
|
+
require 'vagrant/action/builtin/wait_for_communicator'
|
171
|
+
b3.use WaitForCommunicator, [:running]
|
172
|
+
|
173
|
+
b3.use ForwardPorts
|
173
174
|
end
|
174
175
|
end
|
175
176
|
end
|
@@ -216,15 +217,17 @@ module VagrantPlugins
|
|
216
217
|
# It uses the halt and start actions
|
217
218
|
def self.action_reload
|
218
219
|
Vagrant::Action::Builder.new.tap do |b|
|
220
|
+
b.use ConfigValidate
|
219
221
|
b.use Call, IsCreated do |env, b2|
|
220
222
|
unless env[:result]
|
221
223
|
b2.use MessageNotCreated
|
222
224
|
next
|
223
225
|
end
|
224
226
|
|
225
|
-
b2.use ConfigValidate
|
226
227
|
b2.use Provision
|
227
228
|
b2.use action_halt
|
229
|
+
|
230
|
+
b2.use ResolveDiskSettings
|
228
231
|
b2.use action_start
|
229
232
|
end
|
230
233
|
end
|
@@ -339,6 +342,7 @@ module VagrantPlugins
|
|
339
342
|
b3.use MessageNotRunning
|
340
343
|
next
|
341
344
|
end
|
345
|
+
b3.use ClearForwardedPorts
|
342
346
|
b3.use SuspendDomain
|
343
347
|
end
|
344
348
|
end
|
@@ -366,6 +370,7 @@ module VagrantPlugins
|
|
366
370
|
b3.use Provision
|
367
371
|
require 'vagrant/action/builtin/wait_for_communicator'
|
368
372
|
b3.use WaitForCommunicator, [:running]
|
373
|
+
b3.use ForwardPorts
|
369
374
|
end
|
370
375
|
end
|
371
376
|
end
|
@@ -23,7 +23,15 @@ module VagrantPlugins
|
|
23
23
|
mount_tag = Digest::MD5.new.update(opts[:hostpath]).to_s[0, 31]
|
24
24
|
|
25
25
|
mount_opts = '-o trans=virtio'
|
26
|
-
mount_opts += ",access=#{opts[:
|
26
|
+
mount_opts += ",access=#{opts[:access]}" if opts[:access]
|
27
|
+
if opts[:owner]
|
28
|
+
if opts[:access]
|
29
|
+
machine.ui.warn('deprecated `:owner` option ignored as replacement `:access` option already set, please update your Vagrantfile and remove the `:owner` option to prevent this warning.')
|
30
|
+
else
|
31
|
+
machine.ui.warn('`:owner` option for 9p mount options deprecated in favour of `:access`, please update your Vagrantfile and replace `:owner` with `:access`')
|
32
|
+
mount_opts += ",access=#{opts[:owner]}"
|
33
|
+
end
|
34
|
+
end
|
27
35
|
mount_opts += ",version=#{opts[:version]}" if opts[:version]
|
28
36
|
mount_opts += ",#{opts[:mount_opts]}" if opts[:mount_opts]
|
29
37
|
|