vagrant-libvirt 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +20 -0
  3. data/Gemfile +6 -1
  4. data/README.md +146 -6
  5. data/example_box/Vagrantfile +1 -1
  6. data/example_box/metadata.json +1 -1
  7. data/lib/vagrant-libvirt.rb +3 -15
  8. data/lib/vagrant-libvirt/action.rb +59 -73
  9. data/lib/vagrant-libvirt/action/create_domain.rb +47 -19
  10. data/lib/vagrant-libvirt/action/create_domain_volume.rb +5 -5
  11. data/lib/vagrant-libvirt/action/create_network_interfaces.rb +82 -36
  12. data/lib/vagrant-libvirt/action/create_networks.rb +99 -54
  13. data/lib/vagrant-libvirt/action/destroy_domain.rb +4 -4
  14. data/lib/vagrant-libvirt/action/destroy_networks.rb +2 -2
  15. data/lib/vagrant-libvirt/action/halt_domain.rb +1 -1
  16. data/lib/vagrant-libvirt/action/handle_box_image.rb +25 -5
  17. data/lib/vagrant-libvirt/action/handle_storage_pool.rb +9 -7
  18. data/lib/vagrant-libvirt/action/is_running.rb +1 -1
  19. data/lib/vagrant-libvirt/action/is_suspended.rb +1 -1
  20. data/lib/vagrant-libvirt/action/package_domain.rb +3 -3
  21. data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +8 -5
  22. data/lib/vagrant-libvirt/action/prepare_nfs_valid_ids.rb +1 -1
  23. data/lib/vagrant-libvirt/action/prune_nfs_exports.rb +1 -1
  24. data/lib/vagrant-libvirt/action/read_mac_addresses.rb +1 -1
  25. data/lib/vagrant-libvirt/action/remove_libvirt_image.rb +1 -1
  26. data/lib/vagrant-libvirt/action/remove_stale_volume.rb +2 -2
  27. data/lib/vagrant-libvirt/action/resume_domain.rb +1 -1
  28. data/lib/vagrant-libvirt/action/set_boot_order.rb +66 -0
  29. data/lib/vagrant-libvirt/action/set_name_of_domain.rb +3 -2
  30. data/lib/vagrant-libvirt/action/start_domain.rb +1 -1
  31. data/lib/vagrant-libvirt/action/suspend_domain.rb +1 -1
  32. data/lib/vagrant-libvirt/action/wait_till_up.rb +1 -1
  33. data/lib/vagrant-libvirt/cap/mount_p9.rb +2 -1
  34. data/lib/vagrant-libvirt/cap/synced_folder.rb +11 -5
  35. data/lib/vagrant-libvirt/config.rb +44 -5
  36. data/lib/vagrant-libvirt/driver.rb +121 -0
  37. data/lib/vagrant-libvirt/errors.rb +4 -0
  38. data/lib/vagrant-libvirt/plugin.rb +7 -5
  39. data/lib/vagrant-libvirt/provider.rb +54 -12
  40. data/lib/vagrant-libvirt/templates/domain.xml.erb +18 -12
  41. data/lib/vagrant-libvirt/templates/filesystem.xml.erb +1 -1
  42. data/lib/vagrant-libvirt/templates/tunnel_interface.xml.erb +11 -0
  43. data/lib/vagrant-libvirt/util/network_util.rb +11 -1
  44. data/lib/vagrant-libvirt/version.rb +1 -1
  45. data/locales/en.yml +24 -15
  46. data/spec/support/environment_helper.rb +1 -1
  47. data/tools/prepare_redhat_for_box.sh +1 -2
  48. metadata +6 -5
  49. data/lib/vagrant-libvirt/action/connect_libvirt.rb +0 -51
  50. data/lib/vagrant-libvirt/action/read_ssh_info.rb +0 -68
  51. data/lib/vagrant-libvirt/action/read_state.rb +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 354aaf9e080970fc3b9b0c6c2896f0a84bfc5c97
4
- data.tar.gz: 7aca0e64a6714b9ef17456cda7ac91677fe6c9b1
3
+ metadata.gz: ba233a0a466eeb2f28c391c799b1f3bb95f8299a
4
+ data.tar.gz: eb0fb23c0bbca79c7c30d39e5b1f813ceb78c3c5
5
5
  SHA512:
6
- metadata.gz: a9e8b0f86701dd6ddfe6d060ce4c6c90c0e0a8ac78e3128f964c31a8bec2d44dc73ed56e0e6d6b114988fbe40c67953ee30b46cbf7e90ec3651d1c0637d7a365
7
- data.tar.gz: 8b8b59bc7eb122a2d56fa72d1ea412fd59974152d76a00652a8782456dae65b229fbfc9c8a21775f10d1b8fd1115db1f9a5cf948d425c0fe386bf1d758590373
6
+ metadata.gz: 69f3a3f978ebdcc97186caa6bc73642b1fe023f0925bbcda6a343d15a4384f8a79dd8ab17c900d12d6fad99168b83f9ccf59823ef85a7d6784dbb955c8cea6a1
7
+ data.tar.gz: d850270fcf613717d7e1365ae0d786e35edc137bd6cb02c63307c84f536c927897743dd1202c90ac895ed0c59edcb55de45ba55433e293fcbdad0dafe5e90114
@@ -0,0 +1,20 @@
1
+ ---
2
+ language: ruby
3
+ before_install:
4
+ - sudo apt-get update -qq
5
+ - sudo apt-get install -y libvirt-dev
6
+ - gem install bundler --version $BUNDLER_VERSION
7
+ install: bundle _${BUNDLER_VERSION}_ install
8
+ script: bundle _${BUNDLER_VERSION}_ exec rspec --color --format documentation
9
+ notifications:
10
+ email: false
11
+ rvm:
12
+ - 2.0.0
13
+ env:
14
+ global:
15
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
16
+ matrix:
17
+ - VAGRANT_VERSION=v1.5.4 BUNDLER_VERSION=1.5.3
18
+ - VAGRANT_VERSION=v1.6.5 BUNDLER_VERSION=1.6.9
19
+ - VAGRANT_VERSION=v1.7.0 BUNDLER_VERSION=1.7.9
20
+ - VAGRANT_VERSION= BUNDLER_VERSION=1.7.9
data/Gemfile CHANGED
@@ -7,7 +7,12 @@ group :development do
7
7
  # We depend on Vagrant for development, but we don't add it as a
8
8
  # gem dependency because we expect to be installed within the
9
9
  # Vagrant environment itself using `vagrant plugin`.
10
- gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git'
10
+ if ENV['VAGRANT_VERSION']
11
+ gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git',
12
+ tag: ENV['VAGRANT_VERSION']
13
+ else
14
+ gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git'
15
+ end
11
16
  gem 'pry'
12
17
  end
13
18
 
data/README.md CHANGED
@@ -7,6 +7,35 @@ control and provision machines via Libvirt toolkit.
7
7
  **Note:** Actual version is still a development one. Feedback is
8
8
  welcome and can help a lot :-)
9
9
 
10
+ - [Features](#)
11
+ - [Future work](#)
12
+ - [Installation](#)
13
+ - [Possible problems with plugin installation on Linux](#)
14
+ - [Vagrant Project Preparation](#)
15
+ - [Add Box](#)
16
+ - [Create Vagrantfile](#)
17
+ - [Start VM](#)
18
+ - [How Project Is Created](#)
19
+ - [Libvirt Configuration](#)
20
+ - [Provider Options](#)
21
+ - [Domain Specific Options](#)
22
+ - [Networks](#)
23
+ - [Private Network Options](#)
24
+ - [Public Network Options](#)
25
+ - [Management Network](#)
26
+ - [Additional Disks](#)
27
+ - [CDROMs](#)
28
+ - [Input](#)
29
+ - [No box and PXE boot](#)
30
+ - [SSH Access To VM](#)
31
+ - [Forwarded Ports](#)
32
+ - [Synced Folders](#)
33
+ - [Customized Graphics](#)
34
+ - [Box Format](#)
35
+ - [Create Box](#)
36
+ - [Development](#)
37
+ - [Contributing](#)
38
+
10
39
  ## Features
11
40
 
12
41
  * Control local Libvirt hypervisors.
@@ -22,6 +51,7 @@ welcome and can help a lot :-)
22
51
  * Snapshots via [sahara](https://github.com/jedi4ever/sahara).
23
52
  * Package caching via [vagrant-cachier](http://fgrehm.viewdocs.io/vagrant-cachier/).
24
53
  * Use boxes from other Vagrant providers via [vagrant-mutate](https://github.com/sciurus/vagrant-mutate).
54
+ * Support VMs with no box for PXE boot purposes (Vagrant 1.6 and up)
25
55
 
26
56
  ## Future work
27
57
 
@@ -155,7 +185,8 @@ end
155
185
  * `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
156
186
  * `cpus` - Number of virtual cpus. Defaults to 1 if not set.
157
187
  * `nested` - [Enable nested virtualization](https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt). Default is false.
158
- * `cpu_mode` - What cpu mode to use for nested virtualization. Defaults to 'host-model' if not set.
188
+ * `cpu_mode` - [What cpu type to emulate](https://libvirt.org/formatdomain.html#elementsCPU). Defaults to 'host-model' if not set. Allowed values: host-model, host-passthrough.
189
+ * `loader` - Sets path to custom UEFI loader.
159
190
  * `volume_cache` - Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
160
191
  * `kernel` - To launch the guest with a kernel residing on host filesystems. Equivalent to qemu `-kernel`.
161
192
  * `initrd` - To specify the initramfs/initrd to use for the guest. Equivalent to qemu `-initrd`.
@@ -170,7 +201,9 @@ end
170
201
  * `video_vram` - Used by some graphics card types to vary the amount of RAM dedicated to video. Defaults to 9216.
171
202
  * `machine` - Sets machine type. Equivalent to qemu `-machine`. Use `qemu-system-x86_64 -machine help` to get a list of supported machines.
172
203
  * `machine_arch` - Sets machine architecture. This helps libvirt to determine the correct emulator type. Possible values depend on your version of qemu. For possible values, see which emulator executable `qemu-system-*` your system provides. Common examples are `aarch64`, `alpha`, `arm`, `cris`, `i386`, `lm32`, `m68k`, `microblaze`, `microblazeel`, `mips`, `mips64`, `mips64el`, `mipsel`, `moxie`, `or32`, `ppc`, `ppc64`, `ppcemb`, `s390x`, `sh4`, `sh4eb`, `sparc`, `sparc64`, `tricore`, `unicore32`, `x86_64`, `xtensa`, `xtensaeb`.
173
- * `boot` - Change the boot order and enables the boot menu. Possible options are "hd" or "network". Defaults to "hd" with boot menu disabled.
204
+ * `machine_virtual_size` - Sets the disk size in GB for the machine overriding the default specified in the box. Allows boxes to defined with a minimal size disk by default and to be grown to a larger size at creation time. Will ignore sizes smaller than the size specified by the box metadata. Note that currently there is no support for automatically resizing the filesystem to take advantage of the larger disk.
205
+ * `boot` - Change the boot order and enables the boot menu. Possible options are "hd", "network", "cdrom". Defaults to "hd" with boot menu disabled. When "network" is set without "hd", only all NICs will be tried; see below for more detail.
206
+ * `nic_adapter_count` - Defaults to '8'. Only use case for increasing this count is for VMs that virtualize switches such as Cumulus Linux. Max value for Cumulus Linux VMs is 33.
174
207
 
175
208
 
176
209
  Specific domain settings can be set for each domain separately in multi-VM
@@ -194,7 +227,8 @@ Vagrant.configure("2") do |config|
194
227
 
195
228
  The following example shows part of a Vagrantfile that enables the VM to
196
229
  boot from a network interface first and a hard disk second. This could be
197
- used to run VMs that are meant to be a PXE booted machines.
230
+ used to run VMs that are meant to be a PXE booted machines. Be aware that
231
+ if `hd` is not specified as a boot option, it will never be tried.
198
232
 
199
233
  ```ruby
200
234
  Vagrant.configure("2") do |config|
@@ -212,7 +246,16 @@ Vagrant.configure("2") do |config|
212
246
  ## Networks
213
247
 
214
248
  Networking features in the form of `config.vm.network` support private networks
215
- concept.
249
+ concept. It supports both the virtual network switch routing types and the point to
250
+ point Guest OS to Guest OS setting using UDP/Mcast/TCP tunnel interfaces.
251
+
252
+ http://wiki.libvirt.org/page/VirtualNetworking
253
+
254
+ https://libvirt.org/formatdomain.html#elementsNICSTCP
255
+
256
+ http://libvirt.org/formatdomain.html#elementsNICSMulticast
257
+
258
+ http://libvirt.org/formatdomain.html#elementsNICSUDP _(in libvirt v1.2.20 and higher)_
216
259
 
217
260
  Public Network interfaces are currently implemented using the macvtap driver. The macvtap
218
261
  driver is only available with the Linux Kernel version >= 2.6.24. See the following libvirt
@@ -220,14 +263,33 @@ documentation for the details of the macvtap usage.
220
263
 
221
264
  http://www.libvirt.org/formatdomain.html#elementsNICSDirect
222
265
 
266
+
223
267
  An examples of network interface definitions:
224
268
 
225
269
  ```ruby
226
- # Private network
270
+ # Private network using virtual network switching
227
271
  config.vm.define :test_vm1 do |test_vm1|
228
272
  test_vm1.vm.network :private_network, :ip => "10.20.30.40"
229
273
  end
230
274
 
275
+ # Private network. Point to Point between 2 Guest OS using a TCP tunnel
276
+ # Guest 1
277
+ config.vm.define :test_vm1 do |test_vm1|
278
+ test_vm1.vm.network :private_network,
279
+ :libvirt__tunnel_type => 'server',
280
+ # default is 127.0.0.1 if omitted
281
+ # :libvirt__tunnel_ip => '127.0.0.1',
282
+ :libvirt__tunnel_port => '11111'
283
+
284
+ # Guest 2
285
+ config.vm.define :test_vm2 do |test_vm2|
286
+ test_vm2.vm.network :private_network,
287
+ :libvirt__tunnel_type => 'client',
288
+ # default is 127.0.0.1 if omitted
289
+ # :libvirt__tunnel_ip => '127.0.0.1',
290
+ :libvirt__tunnel_port => '11111'
291
+
292
+
231
293
  # Public Network
232
294
  config.vm.define :test_vm1 do |test_vm1|
233
295
  test_vm1.vm.network :public_network,
@@ -289,9 +351,29 @@ starts with 'libvirt__' string. Here is a list of those options:
289
351
  * `:libvirt__forward_device` - Name of interface/device, where network should
290
352
  be forwarded (NATed or routed). Used only when creating new network. By
291
353
  default, all physical interfaces are used.
354
+ * `:libvirt__tunnel_type` - Set to 'udp' if using UDP unicast tunnel mode (libvirt v1.2.20 or higher).
355
+ Set this to either "server" or "client" for tcp tunneling. Set this to 'mcast' if using multicast
356
+ tunneling. This configuration type uses tunnels to
357
+ generate point to point connections between Guests. Useful for Switch VMs like
358
+ Cumulus Linux. No virtual switch setting like "libvirt__network_name" applies with
359
+ tunnel interfaces and will be ignored if configured.
360
+ * `:libvirt__tunnel_ip` - Sets the source IP of the libvirt tunnel interface. By
361
+ default this is `127.0.0.1` for TCP and UDP tunnels and `239.255.1.1` for Multicast
362
+ tunnels. It populates the address field in the `<source address="XXX">` of the
363
+ interface xml configuration.
364
+ * `:libvirt__tunnel_port` - Sets the source port the tcp/udp/mcast tunnel
365
+ with use. This port information is placed in the `<source port=XXX/>` section of
366
+ interface xml configuration.
367
+ * `:libvirt__tunnel_local_port` - Sets the local port used by the udp tunnel
368
+ interface type. It populates the port field in the `<local port=XXX">` section of the
369
+ interface xml configuration. _(This feature only works in libvirt 1.2.20 and higher)_
370
+ * `:libvirt__tunnel_local_ip` - Sets the local IP used by the udp tunnel
371
+ interface type. It populates the ip entry of the `<local address=XXX">` section of
372
+ the interface xml configuration. _(This feature only works in libvirt 1.2.20 and higher)_
292
373
  * `:mac` - MAC address for the interface.
293
374
  * `:model_type` - parameter specifies the model of the network adapter when you create a domain value by default virtio KVM believe possible values, see the documentation for libvirt
294
375
 
376
+
295
377
  When the option `:libvirt__dhcp_enabled` is to to 'false' it shouldn't matter
296
378
  whether the virtual network contains a DHCP server or not and vagrant-libvirt
297
379
  should not fail on it. The only situation where vagrant-libvirt should fail
@@ -336,7 +418,7 @@ You can create and attach additional disks to a VM via `libvirt.storage :file`.
336
418
  * `type` - Type of disk image to create. Defaults to *qcow2*.
337
419
  * `bus` - Type of bus to connect device to. Defaults to *virtio*.
338
420
  * `cache` - Cache mode to use, e.g. `none`, `writeback`, `writethrough` (see the [libvirt documentation for possible values](http://libvirt.org/formatdomain.html#elementsDisks) or [here](https://www.suse.com/documentation/sles11/book_kvm/data/sect1_chapter_book_kvm.html) for a fuller explanation). Defaults to *default*.
339
- * `allow_existing` - Set to true if you want to allow the VM to use a pre-existing disk. This is useful for sharing disks between VMs, e.g. in order to simulate shared SAN storage. Shared disks removed only manualy.If not exists - will created. If exists - using existed.
421
+ * `allow_existing` - Set to true if you want to allow the VM to use a pre-existing disk. This is useful for sharing disks between VMs, e.g. in order to simulate shared SAN storage. Shared disks removed only manually. If not exists - will created. If exists - using existed.
340
422
 
341
423
  The following example creates two additional disks.
342
424
 
@@ -369,6 +451,64 @@ Vagrant.configure("2") do |config|
369
451
  end
370
452
  ```
371
453
 
454
+ ## Input
455
+
456
+ You can specify multiple inputs to the VM via `libvirt.input`. Available options are
457
+ listed below. Note that both options are required:
458
+
459
+ * `type` - The type of the input
460
+ * `bus` - The bust of the input
461
+
462
+ ```ruby
463
+ Vagrant.configure("2") do |config|
464
+ config.vm.provider :libvirt do |libvirt|
465
+ # this is the default
466
+ # libvirt.input :type => "mouse", :bus => "ps2"
467
+
468
+ # very useful when having mouse issues when viewing VM via VNC
469
+ libvirt.input :type => "tablet", :bus => "usb"
470
+ end
471
+ end
472
+ ```
473
+
474
+ ## No box and PXE boot
475
+
476
+ There is support for PXE booting VMs with no disks as well as PXE booting VMs with blank disks. There are some limitations:
477
+
478
+ * Requires Vagrant 1.6.0 or newer
479
+ * No provisioning scripts are ran
480
+ * No network configuration is being applied to the VM
481
+ * No SSH connection can be made
482
+ * ```vagrant halt``` will only work cleanly if the VM handles ACPI shutdown signals
483
+
484
+ In short, VMs without a box can be created, halted and destroyed but all other functionality cannot be used.
485
+
486
+ An example for a PXE booted VM with no disks whatsoever:
487
+
488
+ ```ruby
489
+ Vagrant.configure("2") do |config|
490
+ config.vm.define :pxeclient do |pxeclient|
491
+ pxeclient.vm.provider :libvirt do |domain|
492
+ domain.boot 'network'
493
+ end
494
+ end
495
+ end
496
+ ```
497
+
498
+ And an example for a PXE booted VM with no box but a blank disk which will boot from this HD if the NICs fail to PXE boot:
499
+
500
+ ```ruby
501
+ Vagrant.configure("2") do |config|
502
+ config.vm.define :pxeclient do |pxeclient|
503
+ pxeclient.vm.provider :libvirt do |domain|
504
+ domain.storage :file, :size => '100G', :type => 'qcow2'
505
+ domain.boot 'network'
506
+ domain.boot 'hd'
507
+ end
508
+ end
509
+ end
510
+ ```
511
+
372
512
  ## SSH Access To VM
373
513
 
374
514
  vagrant-libvirt supports vagrant's [standard ssh settings](https://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html).
@@ -39,7 +39,7 @@ Vagrant.configure("2") do |config|
39
39
  libvirt.driver = "kvm"
40
40
 
41
41
  # The name of the server, where libvirtd is running.
42
- libvirt.host = "localhost"
42
+ # libvirt.host = "localhost"
43
43
 
44
44
  # If use ssh tunnel to connect to Libvirt.
45
45
  libvirt.connect_via_ssh = false
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "provider" : "libvirt",
3
3
  "format" : "qcow2",
4
- "virtual_size" : 40
4
+ "virtual_size" : 16
5
5
  }
@@ -1,5 +1,4 @@
1
1
  require 'pathname'
2
- require 'vagrant-libvirt/plugin'
3
2
 
4
3
  module VagrantPlugins
5
4
  module ProviderLibvirt
@@ -8,22 +7,11 @@ module VagrantPlugins
8
7
  autoload :Errors, lib_path.join('errors')
9
8
  autoload :Util, lib_path.join('util')
10
9
 
11
- # Hold connection handler so there is no need to connect more times than
12
- # one. This can be annoying when there are more machines to create, or when
13
- # doing state action first and then some other.
14
- #
15
- # TODO Don't sure if this is the best solution
16
- @@libvirt_connection = nil
17
- def self.libvirt_connection
18
- @@libvirt_connection
19
- end
20
-
21
- def self.libvirt_connection=(conn)
22
- @@libvirt_connection = conn
23
- end
24
-
25
10
  def self.source_root
26
11
  @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
27
12
  end
28
13
  end
29
14
  end
15
+
16
+ # make sure base module class defined before loading plugin
17
+ require 'vagrant-libvirt/plugin'
@@ -19,32 +19,40 @@ module VagrantPlugins
19
19
  def self.action_up
20
20
  Vagrant::Action::Builder.new.tap do |b|
21
21
  b.use ConfigValidate
22
- b.use ConnectLibvirt
23
22
  b.use Call, IsCreated do |env, b2|
24
23
  # Create VM if not yet created.
25
24
  if !env[:result]
26
25
  b2.use SetNameOfDomain
27
- b2.use HandleStoragePool
28
- b2.use HandleBox
29
- b2.use HandleBoxImage
30
- b2.use CreateDomainVolume
31
- b2.use CreateDomain
32
-
33
- b2.use Provision
34
- b2.use PrepareNFSValidIds
35
- b2.use SyncedFolderCleanup
36
- b2.use SyncedFolders
37
- b2.use PrepareNFSSettings
38
- b2.use ShareFolders
39
- b2.use CreateNetworks
40
- b2.use CreateNetworkInterfaces
41
-
42
- b2.use StartDomain
43
- b2.use WaitTillUp
44
-
45
- b2.use ForwardPorts
46
- b2.use SetHostname
47
- # b2.use SyncFolders
26
+ if !env[:machine].box
27
+ b2.use CreateDomain
28
+ b2.use CreateNetworks
29
+ b2.use CreateNetworkInterfaces
30
+ b2.use SetBootOrder
31
+ b2.use StartDomain
32
+ else
33
+ b2.use HandleStoragePool
34
+ b2.use HandleBox
35
+ b2.use HandleBoxImage
36
+ b2.use CreateDomainVolume
37
+ b2.use CreateDomain
38
+
39
+ b2.use Provision
40
+ b2.use PrepareNFSValidIds
41
+ b2.use SyncedFolderCleanup
42
+ b2.use SyncedFolders
43
+ b2.use PrepareNFSSettings
44
+ b2.use ShareFolders
45
+ b2.use CreateNetworks
46
+ b2.use CreateNetworkInterfaces
47
+ b2.use SetBootOrder
48
+
49
+ b2.use StartDomain
50
+ b2.use WaitTillUp
51
+
52
+ b2.use ForwardPorts
53
+ b2.use SetHostname
54
+ # b2.use SyncFolders
55
+ end
48
56
  else
49
57
  b2.use action_start
50
58
  end
@@ -58,7 +66,6 @@ module VagrantPlugins
58
66
  def self.action_start
59
67
  Vagrant::Action::Builder.new.tap do |b|
60
68
  b.use ConfigValidate
61
- b.use ConnectLibvirt
62
69
  b.use Call, IsRunning do |env, b2|
63
70
  # If the VM is running, then our work here is done, exit
64
71
  next if env[:result]
@@ -70,27 +77,35 @@ module VagrantPlugins
70
77
  next
71
78
  end
72
79
 
73
- # VM is not running or suspended.
80
+ if !env[:machine].box
81
+ # With no box, we just care about network creation and starting it
82
+ b3.use CreateNetworks
83
+ b3.use SetBootOrder
84
+ b3.use StartDomain
85
+ else
86
+ # VM is not running or suspended.
74
87
 
75
- b3.use Provision
88
+ b3.use Provision
76
89
 
77
- # Ensure networks are created and active
78
- b3.use CreateNetworks
90
+ # Ensure networks are created and active
91
+ b3.use CreateNetworks
92
+ b3.use SetBootOrder
79
93
 
80
- b3.use PrepareNFSValidIds
81
- b3.use SyncedFolderCleanup
82
- b3.use SyncedFolders
94
+ b3.use PrepareNFSValidIds
95
+ b3.use SyncedFolderCleanup
96
+ b3.use SyncedFolders
83
97
 
84
- # Start it..
85
- b3.use StartDomain
98
+ # Start it..
99
+ b3.use StartDomain
86
100
 
87
- # Machine should gain IP address when comming up,
88
- # so wait for dhcp lease and store IP into machines data_dir.
89
- b3.use WaitTillUp
101
+ # Machine should gain IP address when comming up,
102
+ # so wait for dhcp lease and store IP into machines data_dir.
103
+ b3.use WaitTillUp
90
104
 
91
- b3.use ForwardPorts
92
- b3.use PrepareNFSSettings
93
- b3.use ShareFolders
105
+ b3.use ForwardPorts
106
+ b3.use PrepareNFSSettings
107
+ b3.use ShareFolders
108
+ end
94
109
  end
95
110
  end
96
111
  end
@@ -101,7 +116,6 @@ module VagrantPlugins
101
116
  def self.action_halt
102
117
  Vagrant::Action::Builder.new.tap do |b|
103
118
  b.use ConfigValidate
104
- b.use ConnectLibvirt
105
119
  b.use ClearForwardedPorts
106
120
  b.use Call, IsCreated do |env, b2|
107
121
  if !env[:result]
@@ -144,7 +158,6 @@ module VagrantPlugins
144
158
  def self.action_package
145
159
  Vagrant::Action::Builder.new.tap do |b|
146
160
  b.use ConfigValidate
147
- b.use ConnectLibvirt
148
161
  b.use PackageDomain
149
162
  end
150
163
  end
@@ -157,9 +170,10 @@ module VagrantPlugins
157
170
  b.use Call, IsCreated do |env, b2|
158
171
  if !env[:result]
159
172
  # Try to remove stale volumes anyway
160
- b2.use ConnectLibvirt
161
173
  b2.use SetNameOfDomain
162
- b2.use RemoveStaleVolume
174
+ if env[:machine].box
175
+ b2.use RemoveStaleVolume
176
+ end
163
177
  if !env[:result]
164
178
  b2.use MessageNotCreated
165
179
  end
@@ -167,11 +181,11 @@ module VagrantPlugins
167
181
  next
168
182
  end
169
183
 
170
- b2.use ConnectLibvirt
171
184
  b2.use ClearForwardedPorts
172
185
  # b2.use PruneNFSExports
173
186
  b2.use DestroyDomain
174
187
  b2.use DestroyNetworks
188
+ b2.use ProvisionerCleanup
175
189
  end
176
190
  end
177
191
  end
@@ -186,7 +200,6 @@ module VagrantPlugins
186
200
  next
187
201
  end
188
202
 
189
- b2.use ConnectLibvirt
190
203
  b2.use Call, IsRunning do |env2, b3|
191
204
  if !env2[:result]
192
205
  b3.use MessageNotRunning
@@ -209,7 +222,6 @@ module VagrantPlugins
209
222
  next
210
223
  end
211
224
 
212
- b2.use ConnectLibvirt
213
225
  b2.use Call, IsRunning do |env2, b3|
214
226
  if !env2[:result]
215
227
  b3.use MessageNotRunning
@@ -234,7 +246,6 @@ module VagrantPlugins
234
246
  next
235
247
  end
236
248
 
237
- b2.use ConnectLibvirt
238
249
  b2.use Call, IsRunning do |env2, b3|
239
250
  if !env2[:result]
240
251
  b3.use MessageNotRunning
@@ -257,7 +268,6 @@ module VagrantPlugins
257
268
  next
258
269
  end
259
270
 
260
- b2.use ConnectLibvirt
261
271
  b2.use Call, IsSuspended do |env2, b3|
262
272
  if !env2[:result]
263
273
  b3.use MessageNotSuspended
@@ -269,31 +279,9 @@ module VagrantPlugins
269
279
  end
270
280
  end
271
281
 
272
- # This action is called to read the state of the machine. The resulting
273
- # state is expected to be put into the `:machine_state_id` key.
274
- def self.action_read_state
275
- Vagrant::Action::Builder.new.tap do |b|
276
- b.use ConfigValidate
277
- b.use ConnectLibvirt
278
- b.use ReadState
279
- end
280
- end
281
-
282
- # This action is called to read the SSH info of the machine. The
283
- # resulting state is expected to be put into the `:machine_ssh_info`
284
- # key.
285
- def self.action_read_ssh_info
286
- Vagrant::Action::Builder.new.tap do |b|
287
- b.use ConfigValidate
288
- b.use ConnectLibvirt
289
- b.use ReadSSHInfo
290
- end
291
- end
292
-
293
282
  def self.action_read_mac_addresses
294
283
  Vagrant::Action::Builder.new.tap do |b|
295
284
  b.use ConfigValidate
296
- b.use ConnectLibvirt
297
285
  b.use ReadMacAddresses
298
286
  end
299
287
  end
@@ -308,7 +296,6 @@ module VagrantPlugins
308
296
  next
309
297
  end
310
298
 
311
- b2.use ConnectLibvirt
312
299
  b2.use Call, IsRunning do |env2, b3|
313
300
  if !env2[:result]
314
301
  b3.use MessageNotRunning
@@ -323,7 +310,6 @@ module VagrantPlugins
323
310
  end
324
311
 
325
312
  action_root = Pathname.new(File.expand_path('../action', __FILE__))
326
- autoload :ConnectLibvirt, action_root.join('connect_libvirt')
327
313
  autoload :PackageDomain, action_root.join('package_domain')
328
314
  autoload :CreateDomain, action_root.join('create_domain')
329
315
  autoload :CreateDomainVolume, action_root.join('create_domain_volume')
@@ -351,11 +337,10 @@ module VagrantPlugins
351
337
  autoload :PrepareNFSValidIds, action_root.join('prepare_nfs_valid_ids')
352
338
  autoload :PruneNFSExports, action_root.join('prune_nfs_exports')
353
339
 
354
- autoload :ReadSSHInfo, action_root.join('read_ssh_info')
355
340
  autoload :ReadMacAddresses, action_root.join('read_mac_addresses')
356
- autoload :ReadState, action_root.join('read_state')
357
341
  autoload :ResumeDomain, action_root.join('resume_domain')
358
342
  autoload :SetNameOfDomain, action_root.join('set_name_of_domain')
343
+ autoload :SetBootOrder, action_root.join('set_boot_order')
359
344
 
360
345
  # I don't think we need it anymore
361
346
  autoload :ShareFolders, action_root.join('share_folders')
@@ -370,6 +355,7 @@ module VagrantPlugins
370
355
  autoload :HandleBox, 'vagrant/action/builtin/handle_box'
371
356
  autoload :SyncedFolders, 'vagrant/action/builtin/synced_folders'
372
357
  autoload :SyncedFolderCleanup, 'vagrant/action/builtin/synced_folder_cleanup'
358
+ autoload :ProvisionerCleanup, 'vagrant/action/builtin/provisioner_cleanup'
373
359
  end
374
360
  end
375
361
  end