vagrant-libvirt 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +212 -27
  3. data/lib/vagrant-libvirt/action.rb +6 -0
  4. data/lib/vagrant-libvirt/action/clean_machine_folder.rb +28 -0
  5. data/lib/vagrant-libvirt/action/create_domain.rb +26 -10
  6. data/lib/vagrant-libvirt/action/create_domain_volume.rb +57 -55
  7. data/lib/vagrant-libvirt/action/create_network_interfaces.rb +0 -3
  8. data/lib/vagrant-libvirt/action/create_networks.rb +11 -4
  9. data/lib/vagrant-libvirt/action/destroy_domain.rb +1 -1
  10. data/lib/vagrant-libvirt/action/forward_ports.rb +36 -37
  11. data/lib/vagrant-libvirt/action/halt_domain.rb +25 -9
  12. data/lib/vagrant-libvirt/action/handle_box_image.rb +162 -74
  13. data/lib/vagrant-libvirt/action/is_running.rb +1 -3
  14. data/lib/vagrant-libvirt/action/is_suspended.rb +4 -4
  15. data/lib/vagrant-libvirt/action/wait_till_up.rb +1 -25
  16. data/lib/vagrant-libvirt/cap/{mount_p9.rb → mount_9p.rb} +2 -2
  17. data/lib/vagrant-libvirt/cap/mount_virtiofs.rb +37 -0
  18. data/lib/vagrant-libvirt/cap/{synced_folder.rb → synced_folder_9p.rb} +4 -5
  19. data/lib/vagrant-libvirt/cap/synced_folder_virtiofs.rb +109 -0
  20. data/lib/vagrant-libvirt/config.rb +24 -2
  21. data/lib/vagrant-libvirt/errors.rb +24 -1
  22. data/lib/vagrant-libvirt/plugin.rb +13 -5
  23. data/lib/vagrant-libvirt/templates/domain.xml.erb +7 -6
  24. data/lib/vagrant-libvirt/templates/private_network.xml.erb +1 -1
  25. data/lib/vagrant-libvirt/util/network_util.rb +21 -3
  26. data/lib/vagrant-libvirt/version +1 -1
  27. data/locales/en.yml +12 -0
  28. data/spec/spec_helper.rb +9 -1
  29. data/spec/support/matchers/have_file_content.rb +63 -0
  30. data/spec/unit/action/clean_machine_folder_spec.rb +48 -0
  31. data/spec/unit/action/create_domain_spec.rb +6 -0
  32. data/spec/unit/action/create_domain_volume_spec.rb +102 -0
  33. data/spec/unit/action/create_domain_volume_spec/one_disk_in_storage.xml +21 -0
  34. data/spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_0.xml +21 -0
  35. data/spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_1.xml +21 -0
  36. data/spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_2.xml +21 -0
  37. data/spec/unit/action/destroy_domain_spec.rb +1 -1
  38. data/spec/unit/action/forward_ports_spec.rb +202 -0
  39. data/spec/unit/action/halt_domain_spec.rb +90 -0
  40. data/spec/unit/action/handle_box_image_spec.rb +363 -0
  41. data/spec/unit/action/wait_till_up_spec.rb +1 -23
  42. data/spec/unit/templates/domain_all_settings.xml +8 -0
  43. data/spec/unit/templates/domain_spec.rb +20 -1
  44. metadata +41 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cce5cc2c14c33a541cb2c0a446dd76692685131abbff67992976e736cd0f04e
4
- data.tar.gz: 4abe7566cc6269cb8c9fa4cac79cdfe6a1d5919e7305ffec1a214e937853c4ea
3
+ metadata.gz: af89387fcdeb6518bd31879ac2eaa00373c3af1c02613b389868eb6c656b5f2b
4
+ data.tar.gz: 82fa3560eb88abac51088e894d8e475bbf4dbcda4b10596b43e7fc41d158945a
5
5
  SHA512:
6
- metadata.gz: 2eb5a19c0aa21eccd856d8056270669d201ceec6f3f6cfb209ec7e6185bfcca0a25fd1b60556bef4ea92ed261b6069c17011c2c0083999c146065dc216656beb
7
- data.tar.gz: c3ffc56e5e8d680f87541be65a9990fd77a0e8235c070a413eb5d44d63f7cb1b5bbc712ea6c8b5fb8fe45ef85d72a967e31f241ea0461a9b943f7cd79eb6151b
6
+ metadata.gz: 53d1714279eaa3ed9c0434b891bad6bc03b4f52a0c2a5aed6e0736cefa89a3f66243ec3d04e2bf1bb707f76169e2f799ffa98e63f3cfdc3c91ee0d56e5332695
7
+ data.tar.gz: 15ea6d1ce672545f14f3886a6d945f2349c85cca61a63604abf30f5a716b9665c65ea181fd2dcb96c39321567725911b230d22d1c589c888a2b05ec9c7715b13
data/README.md CHANGED
@@ -55,6 +55,7 @@ can help a lot :-)
55
55
  * [No box and PXE boot](#no-box-and-pxe-boot)
56
56
  * [SSH Access To VM](#ssh-access-to-vm)
57
57
  * [Forwarded Ports](#forwarded-ports)
58
+ * [Forwarding the ssh-port](#forwarding-the-ssh-port)
58
59
  * [Synced Folders](#synced-folders)
59
60
  * [QEMU Session Support](#qemu-session-support)
60
61
  * [Customized Graphics](#customized-graphics)
@@ -62,7 +63,9 @@ can help a lot :-)
62
63
  * [Memory balloon](#memory-balloon)
63
64
  * [Libvirt communication channels](#libvirt-communication-channels)
64
65
  * [Custom command line arguments and environment variables](#custom-command-line-arguments-and-environment-variables)
65
- * [Box Format](#box-format)
66
+ * [Box Formats](#box-formats)
67
+ * [Version 1](#version-1)
68
+ * [Version 2 (Experimental)](#version-2-experimental)
66
69
  * [Create Box](#create-box)
67
70
  * [Package Box from VM](#package-box-from-vm)
68
71
  * [Troubleshooting VMs](#troubleshooting-vms)
@@ -83,7 +86,7 @@ can help a lot :-)
83
86
  * SSH into domains.
84
87
  * Setup hostname and network interfaces.
85
88
  * Provision domains with any built-in Vagrant provisioner.
86
- * Synced folder support via `rsync`, `nfs` or `9p`.
89
+ * Synced folder support via `rsync`, `nfs`, `9p` or `virtiofs`.
87
90
  * Snapshots via [sahara](https://github.com/jedi4ever/sahara).
88
91
  * Package caching via
89
92
  [vagrant-cachier](http://fgrehm.viewdocs.io/vagrant-cachier/).
@@ -892,6 +895,8 @@ used by this network are configurable at the provider level.
892
895
  * `management_network_pci_slot` - The slot of the PCI device.
893
896
  * `management_network_mac` - MAC address of management network interface.
894
897
  * `management_network_domain` - Domain name assigned to the management network.
898
+ * `management_network_mtu` - MTU size of management network. If not specified,
899
+ the Libvirt default (1500) will be used.
895
900
 
896
901
  You may wonder how vagrant-libvirt knows the IP address a VM received. Libvirt
897
902
  doesn't provide a standard way to find out the IP address of a running domain.
@@ -1256,6 +1261,8 @@ Vagrant.configure("2") do |config|
1256
1261
  libvirt.hyperv_feature :name => 'relaxed', :state => 'on'
1257
1262
  # Enable virtual APIC
1258
1263
  libvirt.hyperv_feature :name => 'vapic', :state => 'on'
1264
+ # Enable spinlocks (requires retries to be specified)
1265
+ libvirt.hyperv_feature :name => 'spinlocks', :state => 'on', :retries => '8191'
1259
1266
  end
1260
1267
  end
1261
1268
  ```
@@ -1412,40 +1419,157 @@ Default is `eth0`.
1412
1419
 
1413
1420
  `config.vm.network :forwarded_port, guest: 80, host: 2000, host_ip: "0.0.0.0"`
1414
1421
 
1422
+ ### Forwarding the ssh-port
1423
+
1424
+ Vagrant-libvirt now supports forwarding the standard ssh-port on port 2222 from
1425
+ the localhost to allow for consistent provisioning steps/ports to be used when
1426
+ defining across multiple providers.
1427
+
1428
+ To enable, set the following:
1429
+ ```ruby
1430
+ Vagrant.configure("2") do |config|
1431
+ config.vm.provider :libvirt do |libvirt|
1432
+ # Enable forwarding of forwarded_port with id 'ssh'.
1433
+ libvirt.forward_ssh_port = true
1434
+ end
1435
+ end
1436
+ ```
1437
+
1438
+ Previously by default libvirt skipped the forwarding of the ssh-port because
1439
+ you can access the machine directly. In the future it is expected that this
1440
+ will be enabled by default once autocorrect support is added to handle port
1441
+ collisions for multi machine environments gracefully.
1442
+
1415
1443
  ## Synced Folders
1416
1444
 
1417
- Vagrant automatically syncs the project folder on the host to `/vagrant` in the guest. You can also configure
1418
- additional synced folders.
1445
+ Vagrant automatically syncs the project folder on the host to `/vagrant` in
1446
+ the guest. You can also configure additional synced folders.
1419
1447
 
1420
- `vagrant-libvirt` supports bidirectional synced folders via [NFS](https://en.wikipedia.org/wiki/Network_File_System) or [VirtFS](http://www.linux-kvm.org/page/VirtFS) ([9p or Plan 9](https://en.wikipedia.org/wiki/9P_(protocol))) and
1421
- unidirectional via rsync. The default is NFS. Difference between NFS and 9p is explained [here](https://unix.stackexchange.com/questions/240281/virtfs-plan-9-vs-nfs-as-tool-for-share-folder-for-virtual-machine).
1448
+ **SECURITY NOTE:** for remote Libvirt, nfs synced folders requires a bridged
1449
+ public network interface and you must connect to Libvirt via ssh.
1422
1450
 
1423
- You can change the synced folder type for `/vagrant` by explicity configuring
1424
- it an setting the type, e.g.
1451
+ **NFS**
1425
1452
 
1426
- ```shell
1427
- config.vm.synced_folder './', '/vagrant', type: 'rsync'
1428
- ```
1453
+ `vagrant-libvirt` supports
1454
+ [NFS](https://www.vagrantup.com/docs/synced-folders/nfs) as default with
1455
+ bidirectional synced folders.
1429
1456
 
1430
- or
1457
+ Example with NFS:
1431
1458
 
1432
- ```shell
1433
- config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "1000"
1459
+ ``` ruby
1460
+ Vagrant.configure("2") do |config|
1461
+ config.vm.synced_folder "./", "/vagrant"
1462
+ end
1434
1463
  ```
1435
1464
 
1436
- or
1465
+ **RSync**
1437
1466
 
1438
- ```shell
1439
- config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "mapped", mount: false
1467
+ `vagrant-libvirt` supports
1468
+ [rsync](https://www.vagrantup.com/docs/synced-folders/rsync) with
1469
+ unidirectional synced folders.
1470
+
1471
+ Example with rsync:
1472
+
1473
+ ``` ruby
1474
+ Vagrant.configure("2") do |config|
1475
+ config.vm.synced_folder "./", "/vagrant", type: "rsync"
1476
+ end
1440
1477
  ```
1441
1478
 
1479
+ **9P**
1480
+
1481
+ `vagrant-libvirt` supports [VirtFS](http://www.linux-kvm.org/page/VirtFS) ([9p
1482
+ or Plan 9](https://en.wikipedia.org/wiki/9P_\(protocol\))) with bidirectional
1483
+ synced folders.
1484
+
1485
+ Difference between NFS and 9p is explained
1486
+ [here](https://unix.stackexchange.com/questions/240281/virtfs-plan-9-vs-nfs-as-tool-for-share-folder-for-virtual-machine).
1487
+
1442
1488
  For 9p shares, a `mount: false` option allows to define synced folders without
1443
1489
  mounting them at boot.
1444
1490
 
1445
- Further documentation on using 9p can be found in [kernel docs](https://www.kernel.org/doc/Documentation/filesystems/9p.txt) and in [QEMU wiki](https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly). Please do note that 9p depends on support in the guest and not all distros come with the 9p module by default.
1491
+ Example for `accessmode: "squash"` with 9p:
1446
1492
 
1447
- **SECURITY NOTE:** for remote Libvirt, nfs synced folders requires a bridged
1448
- public network interface and you must connect to Libvirt via ssh.
1493
+ ``` ruby
1494
+ Vagrant.configure("2") do |config|
1495
+ config.vm.synced_folder "./", "/vagrant", type: "9p", disabled: false, accessmode: "squash", owner: "1000"
1496
+ end
1497
+ ```
1498
+
1499
+ Example for `accessmode: "mapped"` with 9p:
1500
+
1501
+ ``` ruby
1502
+ Vagrant.configure("2") do |config|
1503
+ config.vm.synced_folder "./", "/vagrant", type: "9p", disabled: false, accessmode: "mapped", mount: false
1504
+ end
1505
+ ```
1506
+
1507
+ Further documentation on using 9p can be found in [kernel
1508
+ docs](https://www.kernel.org/doc/Documentation/filesystems/9p.txt) and in
1509
+ [QEMU
1510
+ wiki](https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly).
1511
+
1512
+ Please do note that 9p depends on support in the guest and not all distros
1513
+ come with the 9p module by default.
1514
+
1515
+ **Virtio-fs**
1516
+
1517
+ `vagrant-libvirt` supports [Virtio-fs](https://virtio-fs.gitlab.io/) with
1518
+ bidirectional synced folders.
1519
+
1520
+ For virtiofs shares, a `mount: false` option allows to define synced folders
1521
+ without mounting them at boot.
1522
+
1523
+ So far, passthrough is the only supported access mode and it requires running
1524
+ the virtiofsd daemon as root.
1525
+
1526
+ QEMU needs to allocate the backing memory for all the guest RAM as shared
1527
+ memory, e.g. [Use file-backed
1528
+ memory](https://libvirt.org/kbase/virtiofs.html#host-setup) by enable
1529
+ `memory_backing_dir` option in `/etc/libvirt/qemu.conf`:
1530
+
1531
+ ``` shell
1532
+ memory_backing_dir = "/dev/shm"
1533
+ ```
1534
+
1535
+ Example for Libvirt \>= 6.2.0 (e.g. Ubuntu 20.10 with Linux 5.8.0 + QEMU 5.0 +
1536
+ Libvirt 6.6.0, i.e. NUMA nodes required) with virtiofs:
1537
+
1538
+ ``` ruby
1539
+ Vagrant.configure("2") do |config|
1540
+ config.vm.provider :libvirt do |libvirt|
1541
+ libvirt.cpus = 2
1542
+ libvirt.numa_nodes = [{ :cpus => "0-1", :memory => 8192, :memAccess => "shared" }]
1543
+ libvirt.memorybacking :access, :mode => "shared"
1544
+ end
1545
+ config.vm.synced_folder "./", "/vagrant", type: "virtiofs"
1546
+ end
1547
+ ```
1548
+
1549
+ Example for Libvirt \>= 6.9.0 (e.g. Ubuntu 21.04 with Linux 5.11.0 + QEMU 5.2 +
1550
+ Libvirt 7.0.0, or Ubuntu 20.04 + [PPA
1551
+ enabled](https://launchpad.net/~savoury1/+archive/ubuntu/virtualisation)) with
1552
+ virtiofs:
1553
+
1554
+ ``` ruby
1555
+ Vagrant.configure("2") do |config|
1556
+ config.vm.provider :libvirt do |libvirt|
1557
+ libvirt.cpus = 2
1558
+ libvirt.memory = 8192
1559
+ libvirt.memorybacking :access, :mode => "shared"
1560
+ end
1561
+ config.vm.synced_folder "./", "/vagrant", type: "virtiofs"
1562
+ end
1563
+ ```
1564
+
1565
+ Further documentation on using virtiofs can be found in [official
1566
+ HowTo](https://virtio-fs.gitlab.io/index.html#howto) and in [Libvirt
1567
+ KB](https://libvirt.org/kbase/virtiofs.html).
1568
+
1569
+ Please do note that virtiofs depends on:
1570
+
1571
+ - Host: Linux \>= 5.4, QEMU \>= 4.2 and Libvirt \>= 6.2 (e.g. Ubuntu 20.10)
1572
+ - Guest: Linux \>= 5.4 (e.g. Ubuntu 20.04)
1449
1573
 
1450
1574
  ## QEMU Session Support
1451
1575
 
@@ -1652,7 +1776,11 @@ Vagrant.configure("2") do |config|
1652
1776
  end
1653
1777
  ```
1654
1778
 
1655
- ## Box Format
1779
+ ## Box Formats
1780
+
1781
+ ### Version 1
1782
+
1783
+ This is the original format that most boxes currently use.
1656
1784
 
1657
1785
  You can view an example box in the
1658
1786
  [`example_box/directory`](https://github.com/vagrant-libvirt/vagrant-libvirt/tree/master/example_box).
@@ -1666,6 +1794,45 @@ The box is a tarball containing:
1666
1794
  * `Vagrantfile` that does default settings for the provider-specific
1667
1795
  configuration for this provider
1668
1796
 
1797
+
1798
+ ### Version 2 (Experimental)
1799
+
1800
+ Due to the limitation of only being able to handle a single disk with the version 1 format, a new
1801
+ format was added to support boxes that need to specify multiple disks. This is still currently
1802
+ experimental and as such support for packaging has yet to be added. There is a script in the tools
1803
+ folder (tools/create_box_with_two_disks.sh) that should provide a guideline on how to create such
1804
+ a box for those that wish to experiment and provide early feedback.
1805
+
1806
+ At it's most basic, it expects an array of disks to allow a specific order to be presented. Disks
1807
+ will be attached in this order and as such assume device names base on this within the VM. The
1808
+ 'path' attribute is required, and is expected to be relative to the base of the box. This should
1809
+ allow placing the disk images within a nested directory within the box if it useful for those
1810
+ with a larger number of disks. The name allows overriding the target volume name that will be
1811
+ used in the libvirt storage pool. Note that vagrant-libvirt will still prefix the volume name
1812
+ with `#{box_name}_vagrant_box_image_#{box_version}_` to avoid accidental clashes with other boxes.
1813
+
1814
+ Format and virtual size need no longer be specified as they are now retrieved directly from the
1815
+ provided image using `qemu-img info ...`.
1816
+
1817
+ Example format:
1818
+ ```json
1819
+ {
1820
+ 'disks': [
1821
+ {
1822
+ 'path': 'disk1.img'
1823
+ },
1824
+ {
1825
+ 'path': 'disk2.img',
1826
+ 'name': 'secondary_disk'
1827
+ },
1828
+ {
1829
+ 'path': 'disk3.img'
1830
+ }
1831
+ ],
1832
+ 'provider': 'libvirt'
1833
+ }
1834
+ ```
1835
+
1669
1836
  ## Create Box
1670
1837
 
1671
1838
  If creating a box from a modified vagrant-libvirt machine, ensure that
@@ -1782,14 +1949,32 @@ $ bundle install
1782
1949
  Once you have the dependencies, verify the unit tests pass with `rspec`:
1783
1950
 
1784
1951
  ```shell
1785
- $ bundle exec rspec spec/
1952
+ $ export VAGRANT_HOME=$(mktemp -d)
1953
+ $ bundle exec rspec --fail-fast --color --format documentation
1786
1954
  ```
1787
1955
 
1788
- If those pass, you're ready to start developing the plugin. You can test the
1789
- plugin without installing it into your Vagrant environment by just creating a
1790
- `Vagrantfile` in the top level of this directory (it is gitignored) that uses
1791
- it. You can add the following line to your Vagrantfile while in development to
1792
- ensure vagrant checks that the plugin is installed:
1956
+ If those pass, you're ready to start developing the plugin.
1957
+
1958
+ Setting `VAGRANT_HOME` is to avoid issues with conflicting with other
1959
+ plugins/gems or data already present under `~/.vagrant.d`.
1960
+
1961
+ Additionally if you wish to test against a specific version of vagrant you
1962
+ can control the version using the following before running the tests:
1963
+
1964
+ ```shell
1965
+ $ export VAGRANT_VERSION=v2.2.14
1966
+ ```
1967
+
1968
+ **Note** rvm is used by the maintainers to help provide an environment to test
1969
+ against multiple ruby versions that align with the ones used by vagrant for
1970
+ their embedded ruby depending on the release. You can see what version is used
1971
+ by looking at the current [unit tests](.github/workflows/unit-tests.yml)
1972
+ workflow.
1973
+
1974
+ You can test the plugin without installing it into your Vagrant environment by
1975
+ just creating a `Vagrantfile` in the top level of this directory (it is
1976
+ gitignored) that uses it. You can add the following line to your Vagrantfile
1977
+ while in development to ensure vagrant checks that the plugin is installed:
1793
1978
 
1794
1979
  ```ruby
1795
1980
  Vagrant.configure("2") do |config|
@@ -49,6 +49,7 @@ module VagrantPlugins
49
49
 
50
50
  b2.use StartDomain
51
51
  b2.use WaitTillUp
52
+ b2.use WaitForCommunicator, [:running]
52
53
 
53
54
  b2.use ForwardPorts
54
55
  b2.use SetHostname
@@ -107,6 +108,7 @@ module VagrantPlugins
107
108
  # Machine should gain IP address when comming up,
108
109
  # so wait for dhcp lease and store IP into machines data_dir.
109
110
  b3.use WaitTillUp
111
+ b3.use WaitForCommunicator, [:running]
110
112
 
111
113
  b3.use ForwardPorts
112
114
  b3.use PrepareNFSSettings
@@ -179,6 +181,7 @@ module VagrantPlugins
179
181
  # Try to remove stale volumes anyway
180
182
  b2.use SetNameOfDomain
181
183
  b2.use RemoveStaleVolume if env[:machine].config.vm.box
184
+ b2.use CleanMachineFolder, quiet: true
182
185
  b2.use MessageNotCreated unless env[:result]
183
186
 
184
187
  next
@@ -191,6 +194,7 @@ module VagrantPlugins
191
194
  b3.use PruneNFSExports
192
195
  b3.use DestroyDomain
193
196
  b3.use DestroyNetworks
197
+ b3.use CleanMachineFolder
194
198
  else
195
199
  b3.use MessageWillNotDestroy
196
200
  end
@@ -324,6 +328,7 @@ module VagrantPlugins
324
328
  autoload :CreateDomainVolume, action_root.join('create_domain_volume')
325
329
  autoload :CreateNetworkInterfaces, action_root.join('create_network_interfaces')
326
330
  autoload :CreateNetworks, action_root.join('create_networks')
331
+ autoload :CleanMachineFolder, action_root.join('clean_machine_folder')
327
332
  autoload :DestroyDomain, action_root.join('destroy_domain')
328
333
  autoload :DestroyNetworks, action_root.join('destroy_networks')
329
334
  autoload :ForwardPorts, action_root.join('forward_ports')
@@ -366,6 +371,7 @@ module VagrantPlugins
366
371
  autoload :SyncedFolders, 'vagrant/action/builtin/synced_folders'
367
372
  autoload :SyncedFolderCleanup, 'vagrant/action/builtin/synced_folder_cleanup'
368
373
  autoload :ProvisionerCleanup, 'vagrant/action/builtin/provisioner_cleanup'
374
+ autoload :WaitForCommunicator, 'vagrant/action/builtin/wait_for_communicator'
369
375
  end
370
376
  end
371
377
  end
@@ -0,0 +1,28 @@
1
+ require 'log4r'
2
+
3
+ module VagrantPlugins
4
+ module ProviderLibvirt
5
+ module Action
6
+ class CleanMachineFolder
7
+
8
+ def initialize(app, env, options=nil)
9
+ @logger = Log4r::Logger.new('vagrant_libvirt::action::create_domain')
10
+ @app = app
11
+ @ui = env[:ui]
12
+ @quiet = (options || {}).fetch(:quiet, false)
13
+ end
14
+
15
+ def call(env)
16
+ machine_folder = env[:machine].data_dir
17
+
18
+ @ui.info("Deleting the machine folder") unless @quiet
19
+
20
+ @logger.debug("Recursively removing: #{machine_folder}")
21
+ FileUtils.rm_rf(machine_folder, :secure => true)
22
+
23
+ @app.call(env)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -92,6 +92,7 @@ module VagrantPlugins
92
92
  # Storage
93
93
  @storage_pool_name = config.storage_pool_name
94
94
  @snapshot_pool_name = config.snapshot_pool_name
95
+ @domain_volumes = []
95
96
  @disks = config.disks
96
97
  @cdroms = config.cdroms
97
98
 
@@ -141,19 +142,28 @@ module VagrantPlugins
141
142
  else
142
143
  pool_name = @storage_pool_name
143
144
  end
144
- @logger.debug "Search for volume in pool: #{pool_name}"
145
- domain_volume = env[:machine].provider.driver.connection.volumes.all(
146
- name: "#{@name}.img"
147
- ).find { |x| x.pool_name == pool_name }
148
- raise Errors::DomainVolumeExists if domain_volume.nil?
149
- @domain_volume_path = domain_volume.path
145
+ @logger.debug "Search for volumes in pool: #{pool_name}"
146
+ env[:box_volumes].each_index do |index|
147
+ suffix_index = index > 0 ? "_#{index}" : ''
148
+ domain_volume = env[:machine].provider.driver.connection.volumes.all(
149
+ name: "#{@name}#{suffix_index}.img"
150
+ ).find { |x| x.pool_name == pool_name }
151
+ raise Errors::DomainVolumeExists if domain_volume.nil?
152
+ @domain_volumes.push({
153
+ :dev => (index+1).vdev.to_s,
154
+ :cache => @domain_volume_cache,
155
+ :bus => @disk_bus,
156
+ :path => domain_volume.path,
157
+ :virtual_size => env[:box_volumes][index][:virtual_size]
158
+ })
159
+ end
150
160
  end
151
161
 
152
162
  # If we have a box, take the path from the domain volume and set our storage_prefix.
153
163
  # If not, we dump the storage pool xml to get its defined path.
154
164
  # the default storage prefix is typically: /var/lib/libvirt/images/
155
165
  if env[:machine].config.vm.box
156
- storage_prefix = File.dirname(@domain_volume_path) + '/' # steal
166
+ storage_prefix = File.dirname(@domain_volumes[0][:path]) + '/' # steal
157
167
  else
158
168
  storage_prefix = get_disk_storage_prefix(env, @storage_pool_name)
159
169
  end
@@ -188,7 +198,7 @@ module VagrantPlugins
188
198
  path: disk[:absolute_path],
189
199
  capacity: disk[:size],
190
200
  owner: storage_uid(env),
191
- group: storage_uid(env),
201
+ group: storage_gid(env),
192
202
  #:allocation => ?,
193
203
  pool_name: disk_pool_name
194
204
  )
@@ -227,7 +237,11 @@ module VagrantPlugins
227
237
  env[:ui].info(" -- Feature: #{feature}")
228
238
  end
229
239
  @features_hyperv.each do |feature|
230
- env[:ui].info(" -- Feature (HyperV): name=#{feature[:name]}, state=#{feature[:state]}")
240
+ if feature[:name] == 'spinlocks'
241
+ env[:ui].info(" -- Feature (HyperV): name=#{feature[:name]}, state=#{feature[:state]}, retries=#{feature[:retries]}")
242
+ else
243
+ env[:ui].info(" -- Feature (HyperV): name=#{feature[:name]}, state=#{feature[:state]}")
244
+ end
231
245
  end
232
246
  env[:ui].info(" -- Clock offset: #{@clock_offset}")
233
247
  @clock_timers.each do |timer|
@@ -250,7 +264,9 @@ module VagrantPlugins
250
264
  env[:ui].info(" -- Base box: #{env[:machine].box.name}")
251
265
  end
252
266
  env[:ui].info(" -- Storage pool: #{@storage_pool_name}")
253
- env[:ui].info(" -- Image: #{@domain_volume_path} (#{env[:box_virtual_size]}G)")
267
+ @domain_volumes.each do |volume|
268
+ env[:ui].info(" -- Image(#{volume[:device]}): #{volume[:path]}, #{volume[:virtual_size]}G")
269
+ end
254
270
 
255
271
  if not @disk_driver_opts.empty?
256
272
  env[:ui].info(" -- Disk driver opts: #{@disk_driver_opts.reject { |k,v| v.nil? }.map { |k,v| "#{k}='#{v}'"}.join(' ')}")