vagrant-libvirt 0.10.7 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -7
  3. data/lib/vagrant-libvirt/action/create_domain.rb +45 -22
  4. data/lib/vagrant-libvirt/action/create_domain_volume.rb +3 -0
  5. data/lib/vagrant-libvirt/action/create_network_interfaces.rb +15 -5
  6. data/lib/vagrant-libvirt/action/create_networks.rb +2 -6
  7. data/lib/vagrant-libvirt/action/destroy_domain.rb +2 -10
  8. data/lib/vagrant-libvirt/action/forward_ports.rb +1 -1
  9. data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +7 -5
  10. data/lib/vagrant-libvirt/action/resolve_disk_settings.rb +2 -0
  11. data/lib/vagrant-libvirt/action/snapshot_delete.rb +1 -1
  12. data/lib/vagrant-libvirt/action/snapshot_restore.rb +1 -1
  13. data/lib/vagrant-libvirt/action/snapshot_save.rb +1 -2
  14. data/lib/vagrant-libvirt/action/start_domain.rb +161 -63
  15. data/lib/vagrant-libvirt/action/wait_till_up.rb +2 -2
  16. data/lib/vagrant-libvirt/action.rb +18 -13
  17. data/lib/vagrant-libvirt/cap/mount_9p.rb +9 -1
  18. data/lib/vagrant-libvirt/cap/snapshots.rb +1 -1
  19. data/lib/vagrant-libvirt/config.rb +198 -26
  20. data/lib/vagrant-libvirt/driver.rb +95 -56
  21. data/lib/vagrant-libvirt/provider.rb +4 -4
  22. data/lib/vagrant-libvirt/templates/domain.xml.erb +73 -27
  23. data/lib/vagrant-libvirt/templates/public_interface.xml.erb +6 -3
  24. data/lib/vagrant-libvirt/util/compat.rb +1 -1
  25. data/lib/vagrant-libvirt/util/network_util.rb +5 -10
  26. data/lib/vagrant-libvirt/version +1 -1
  27. data/locales/en.yml +2 -0
  28. data/spec/acceptance/additional_storage_spec.rb +1 -4
  29. data/spec/acceptance/networking_spec.rb +41 -0
  30. data/spec/acceptance/package_domain_spec.rb +2 -2
  31. data/spec/acceptance/provider_settings_spec.rb +1 -1
  32. data/spec/acceptance/simple_vm_provision_via_shell_spec.rb +1 -1
  33. data/spec/acceptance/snapshots_spec.rb +1 -1
  34. data/spec/acceptance/support-skeletons/package_complex/scripts/sysprep.sh +0 -0
  35. data/spec/acceptance/two_disks_spec.rb +1 -1
  36. data/spec/acceptance/use_qemu_agent_for_connectivity_spec.rb +1 -1
  37. data/spec/spec_helper.rb +37 -8
  38. data/spec/support/acceptance/isolated_environment.rb +1 -1
  39. data/spec/support/environment_helper.rb +1 -1
  40. data/spec/support/libvirt_acceptance_context.rb +15 -1
  41. data/spec/support/{sharedcontext.rb → unit_context.rb} +20 -5
  42. data/spec/unit/action/clean_machine_folder_spec.rb +1 -2
  43. data/spec/unit/action/cleanup_on_failure_spec.rb +1 -2
  44. data/spec/unit/action/create_domain_spec/additional_disks_domain.xml +4 -2
  45. data/spec/unit/action/create_domain_spec/custom_disk_settings.xml +4 -2
  46. data/spec/unit/action/create_domain_spec/default_domain.xml +4 -2
  47. data/spec/unit/action/create_domain_spec/sysinfo.xml +4 -2
  48. data/spec/unit/action/create_domain_spec/sysinfo_only_required.xml +4 -2
  49. data/spec/unit/action/create_domain_spec/two_disk_settings.xml +4 -2
  50. data/spec/unit/action/create_domain_spec.rb +51 -3
  51. data/spec/unit/action/create_domain_volume_spec.rb +2 -4
  52. data/spec/unit/action/destroy_domain_spec/additional_disks_domain.xml +1 -0
  53. data/spec/unit/action/destroy_domain_spec/box_multiple_disks.xml +1 -0
  54. data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks.xml +1 -0
  55. data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks_no_aliases.xml +1 -0
  56. data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_disks.xml +1 -0
  57. data/spec/unit/action/destroy_domain_spec/cdrom_domain.xml +1 -0
  58. data/spec/unit/action/destroy_domain_spec.rb +1 -18
  59. data/spec/unit/action/forward_ports_spec.rb +1 -3
  60. data/spec/unit/action/halt_domain_spec.rb +2 -3
  61. data/spec/unit/action/handle_box_image_spec.rb +3 -4
  62. data/spec/unit/action/package_domain_spec.rb +2 -3
  63. data/spec/unit/action/prepare_nfs_settings_spec.rb +25 -9
  64. data/spec/unit/action/remove_libvirt_image_spec.rb +1 -2
  65. data/spec/unit/action/resolve_disk_settings_spec/default_domain.xml +1 -0
  66. data/spec/unit/action/resolve_disk_settings_spec/default_no_aliases.xml +1 -0
  67. data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box.xml +1 -0
  68. data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_and_custom_no_aliases.xml +1 -0
  69. data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_storage.xml +1 -0
  70. data/spec/unit/action/resolve_disk_settings_spec.rb +1 -1
  71. data/spec/unit/action/set_boot_order_spec/default.xml +1 -0
  72. data/spec/unit/action/set_boot_order_spec/explicit_boot_order.xml +1 -0
  73. data/spec/unit/action/set_boot_order_spec.rb +1 -3
  74. data/spec/unit/action/set_name_of_domain_spec.rb +3 -1
  75. data/spec/unit/action/shutdown_domain_spec.rb +4 -3
  76. data/spec/unit/action/start_domain_spec/clock_timer_removed.xml +1 -1
  77. data/spec/unit/action/start_domain_spec/clock_timer_rtc.xml +1 -1
  78. data/spec/unit/action/start_domain_spec/clock_timer_rtc_tsc.xml +1 -1
  79. data/spec/unit/action/start_domain_spec/default.xml +1 -1
  80. data/spec/unit/action/start_domain_spec/default_added_tpm_path.xml +1 -1
  81. data/spec/unit/action/start_domain_spec/default_added_tpm_version.xml +1 -1
  82. data/spec/unit/action/start_domain_spec/default_with_different_formatting.xml +1 -1
  83. data/spec/unit/action/start_domain_spec/existing.xml +2 -1
  84. data/spec/unit/action/start_domain_spec/existing_added_nvram.xml +2 -1
  85. data/spec/unit/action/start_domain_spec/existing_reordered.xml +63 -0
  86. data/spec/unit/action/start_domain_spec/nvram_domain.xml +1 -0
  87. data/spec/unit/action/start_domain_spec/nvram_domain_other_setting.xml +2 -1
  88. data/spec/unit/action/start_domain_spec/nvram_domain_removed.xml +2 -1
  89. data/spec/unit/action/start_domain_spec.rb +226 -17
  90. data/spec/unit/action/wait_till_up_spec.rb +3 -5
  91. data/spec/unit/action_spec.rb +403 -10
  92. data/spec/unit/cap/mount_9p_spec.rb +75 -0
  93. data/spec/unit/cap/synced_folder_9p_spec.rb +1 -2
  94. data/spec/unit/cap/synced_folder_virtiofs_spec.rb +1 -2
  95. data/spec/unit/config_spec.rb +365 -25
  96. data/spec/unit/driver_spec.rb +217 -80
  97. data/spec/unit/plugin_spec.rb +6 -3
  98. data/spec/unit/templates/domain_all_settings.xml +26 -4
  99. data/spec/unit/templates/domain_cpu_mode_passthrough.xml +4 -2
  100. data/spec/unit/templates/domain_custom_cpu_model.xml +4 -2
  101. data/spec/unit/templates/domain_defaults.xml +4 -2
  102. data/spec/unit/templates/domain_scsi_bus_storage.xml +4 -2
  103. data/spec/unit/templates/domain_scsi_device_storage.xml +4 -2
  104. data/spec/unit/templates/domain_scsi_multiple_controllers_storage.xml +4 -2
  105. data/spec/unit/templates/domain_spec.rb +11 -3
  106. data/spec/unit/templates/tpm/version_1.2.xml +4 -2
  107. data/spec/unit/templates/tpm/version_2.0.xml +4 -2
  108. data/spec/unit/util/byte_number_spec.rb +1 -1
  109. data/spec/unit/util/network_util_spec/default.xml +16 -0
  110. data/spec/unit/util/network_util_spec/hostdev.xml +6 -0
  111. data/spec/unit/util/network_util_spec/vagrant-libvirt.xml +16 -0
  112. data/spec/unit/util/network_util_spec.rb +59 -0
  113. data/spec/unit/util/resolvers_spec.rb +1 -1
  114. metadata +95 -81
@@ -87,79 +87,83 @@ module VagrantPlugins
87
87
  end
88
88
 
89
89
  # cpu_mode
90
- cpu = REXML::XPath.first(xml_descr, '/domain/cpu')
91
- if cpu.nil?
92
- @logger.debug "cpu_mode updated from not set to '#{config.cpu_mode}'"
93
- descr_changed = true
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 (cpu_model.text or '').strip != config.cpu_model.strip
116
- @logger.debug "cpu_model text updated from #{cpu_model.text} to '#{config.cpu_model}'"
98
+ if cpu.attributes['mode'] != config.cpu_mode
99
+ @logger.debug "cpu_mode updated from '#{cpu.attributes['mode']}' to '#{config.cpu_mode}'"
117
100
  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}'"
122
- descr_changed = true
123
- cpu_model.attributes['fallback'] = config.cpu_fallback
101
+ cpu.attributes['mode'] = config.cpu_mode
124
102
  end
125
103
  end
126
- vmx_feature = REXML::XPath.first(xml_descr, '/domain/cpu/feature[@name="vmx"]')
127
- svm_feature = REXML::XPath.first(xml_descr, '/domain/cpu/feature[@name="svm"]')
128
- if config.nested
129
- if vmx_feature.nil?
130
- @logger.debug "nested mode enabled from unset by setting cpu vmx feature"
131
- descr_changed = true
132
- vmx_feature = REXML::Element.new('feature', REXML::XPath.first(xml_descr, '/domain/cpu'))
133
- vmx_feature.attributes['policy'] = 'optional'
134
- vmx_feature.attributes['name'] = 'vmx'
135
- end
136
- if svm_feature.nil?
137
- @logger.debug "nested mode enabled from unset by setting cpu svm feature"
138
- descr_changed = true
139
- svm_feature = REXML::Element.new('feature', REXML::XPath.first(xml_descr, '/domain/cpu'))
140
- svm_feature.attributes['policy'] = 'optional'
141
- svm_feature.attributes['name'] = 'svm'
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
- else
144
- unless vmx_feature.nil?
145
- @logger.debug "nested mode disabled for cpu by removing vmx feature"
146
- descr_changed = true
147
- cpu.delete_element(vmx_feature)
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
- unless svm_feature.nil?
150
- @logger.debug "nested mode disabled for cpu by removing svm feature"
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.delete_element(svm_feature)
153
- end
154
- end
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
@@ -429,9 +499,20 @@ module VagrantPlugins
429
499
  raise Errors::UpdateServerError, error_message: e.message
430
500
  end
431
501
 
502
+ # this normalises the attribute order to be the same as what was sent in the above
503
+ # request to update the domain XML. Without this, if the XML documents are not
504
+ # equivalent, many more differences will be reported than there actually are.
505
+ applied_xml = String.new
506
+ REXML::Document.new(libvirt_domain.xml_desc(1)).write(applied_xml)
507
+
432
508
  # need to check whether the updated XML contains all the changes requested
433
509
  proposed = VagrantPlugins::ProviderLibvirt::Util::Xml.new(new_xml)
434
- applied = VagrantPlugins::ProviderLibvirt::Util::Xml.new(libvirt_domain.xml_desc(1))
510
+ applied = VagrantPlugins::ProviderLibvirt::Util::Xml.new(applied_xml)
511
+
512
+ # perform some sorting to allow comparison otherwise order of devices differing
513
+ # even if they are equivalent will be reported as being different.
514
+ proposed.xml['devices'][0].each { |_, v| next unless v.is_a?(Array); v.sort_by! { |e| [e['type'], e['index']]} }
515
+ applied.xml['devices'][0].each { |_, v| next unless v.is_a?(Array); v.sort_by! { |e| [e['type'], e['index']]} }
435
516
 
436
517
  if proposed != applied
437
518
  require 'diffy'
@@ -467,6 +548,23 @@ module VagrantPlugins
467
548
  raise Errors::DomainStartError, error_message: e.message
468
549
  end
469
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
+
470
568
  @app.call(env)
471
569
  end
472
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(env[:machine])
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.get_domain_ipaddress(env[:machine], domain)
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 then exit
138
+ # if vm is suspended resume it
142
139
  if env2[:result]
143
140
  b3.use ResumeDomain
144
- next
145
- end
146
141
 
147
- if !env[:machine].config.vm.box
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[:owner]}" if opts[:owner]
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
 
@@ -4,7 +4,7 @@ module VagrantPlugins
4
4
  class Snapshots
5
5
  def self.snapshot_list(machine)
6
6
  return if machine.state.id == :not_created
7
- machine.provider.driver.list_snapshots(machine)
7
+ machine.provider.driver.list_snapshots
8
8
  end
9
9
  end
10
10
  end