vagrant-libvirt 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile +4 -0
- data/README.md +146 -22
- data/lib/vagrant-libvirt/action/create_domain.rb +35 -0
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +1 -0
- data/lib/vagrant-libvirt/action/create_networks.rb +2 -0
- data/lib/vagrant-libvirt/action/forward_ports.rb +2 -2
- data/lib/vagrant-libvirt/action/handle_box_image.rb +3 -1
- data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +9 -9
- data/lib/vagrant-libvirt/action/set_name_of_domain.rb +6 -4
- data/lib/vagrant-libvirt/action/start_domain.rb +136 -30
- data/lib/vagrant-libvirt/action/wait_till_up.rb +22 -14
- data/lib/vagrant-libvirt/cap/nic_mac_addresses.rb +7 -1
- data/lib/vagrant-libvirt/cap/synced_folder.rb +6 -3
- data/lib/vagrant-libvirt/config.rb +109 -0
- data/lib/vagrant-libvirt/plugin.rb +3 -0
- data/lib/vagrant-libvirt/templates/domain.xml.erb +57 -7
- data/lib/vagrant-libvirt/templates/interface.xml.erb +5 -1
- data/lib/vagrant-libvirt/templates/private_network.xml.erb +1 -1
- data/lib/vagrant-libvirt/templates/tunnel_interface.xml.erb +6 -0
- data/lib/vagrant-libvirt/util/network_util.rb +2 -0
- data/lib/vagrant-libvirt/version.rb +1 -1
- data/locales/en.yml +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/libvirt_context.rb +28 -0
- data/spec/support/sharedcontext.rb +34 -0
- data/spec/{vagrant-libvirt → unit}/action/set_name_of_domain_spec.rb +0 -0
- data/spec/unit/action/wait_till_up_spec.rb +128 -0
- data/tools/create_box.sh +3 -1
- data/vagrant-libvirt.gemspec +4 -4
- metadata +21 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe4ab377dd5768297a0cb9741ee25e889b2d57b
|
4
|
+
data.tar.gz: 3aa4b4af095858c8fdf2b44860c4435d0a42ad19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05011cb3bd79c255dc215abfd05726738b95fa4c81cfecbe3a30c0d93b56ab3a898bca198502464440a7677345a60494a5d1a264dffdf1e5b05cad20a5aa2d72
|
7
|
+
data.tar.gz: ad8badd8f73e38d599a7ca614e362efa2202da9226c5c99f885178687873f3108b0dd3ca0749062bbff273e6bb804470ebf5759a280ea117f6db1c3a0168dbd1
|
data/.travis.yml
CHANGED
@@ -3,6 +3,7 @@ language: ruby
|
|
3
3
|
before_install:
|
4
4
|
- sudo apt-get update -qq
|
5
5
|
- sudo apt-get install -y libvirt-dev
|
6
|
+
- gem update --system 2.4.8
|
6
7
|
- gem install bundler --version $BUNDLER_VERSION
|
7
8
|
install: bundle _${BUNDLER_VERSION}_ install
|
8
9
|
script: bundle _${BUNDLER_VERSION}_ exec rspec --color --format documentation
|
data/Gemfile
CHANGED
@@ -13,6 +13,10 @@ group :development do
|
|
13
13
|
else
|
14
14
|
gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git'
|
15
15
|
end
|
16
|
+
|
17
|
+
gem 'vagrant-spec', :github => 'mitchellh/vagrant-spec',
|
18
|
+
tag: ENV['VAGRANT_SPEC_VERSION'] || "9bba7e1228379c0a249a06ce76ba8ea7d276afbe"
|
19
|
+
|
16
20
|
gem 'pry'
|
17
21
|
end
|
18
22
|
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Vagrant Libvirt Provider
|
2
|
+
[![Build Status](https://travis-ci.org/pradels/vagrant-libvirt.svg)](https://travis-ci.org/pradels/vagrant-libvirt)
|
2
3
|
|
3
4
|
This is a [Vagrant](http://www.vagrantup.com) plugin that adds an
|
4
5
|
[Libvirt](http://libvirt.org) provider to Vagrant, allowing Vagrant to
|
@@ -28,6 +29,8 @@ welcome and can help a lot :-)
|
|
28
29
|
- [Reload behavior](#reload-behavior-1)
|
29
30
|
- [CDROMs](#cdroms)
|
30
31
|
- [Input](#input)
|
32
|
+
- [PCI device passthrough](#pci-device-passthrough)
|
33
|
+
- [CPU Features](#cpu-features)
|
31
34
|
- [No box and PXE boot](#no-box-and-pxe-boot)
|
32
35
|
- [SSH Access To VM](#ssh-access-to-vm)
|
33
36
|
- [Forwarded Ports](#forwarded-ports)
|
@@ -78,12 +81,12 @@ missing development libraries for libxslt, libxml2 and libvirt.
|
|
78
81
|
|
79
82
|
In Ubuntu, Debian, ...
|
80
83
|
```
|
81
|
-
$ sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev
|
84
|
+
$ sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
|
82
85
|
```
|
83
86
|
|
84
87
|
In RedHat, Centos, Fedora, ...
|
85
88
|
```
|
86
|
-
# yum install libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
|
89
|
+
# yum install libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c ruby-devel
|
87
90
|
```
|
88
91
|
|
89
92
|
If have problem with installation - check your linker. It should be ld.gold:
|
@@ -100,12 +103,13 @@ sudo ln -fs /usr/bin/ld.gold /usr/bin/ld
|
|
100
103
|
After installing the plugin (instructions above), the quickest way to get
|
101
104
|
started is to add Libvirt box and specify all the details manually within
|
102
105
|
a `config.vm.provider` block. So first, add Libvirt box using any name you
|
103
|
-
want. This is just an example of Libvirt CentOS
|
106
|
+
want. This is just an example of Libvirt CentOS 7 box available in
|
107
|
+
https://atlas.hashicorp.com :
|
104
108
|
|
105
109
|
```
|
106
|
-
vagrant
|
110
|
+
vagrant init fedora/23-cloud-base
|
107
111
|
# or
|
108
|
-
vagrant
|
112
|
+
vagrant init centos/7
|
109
113
|
```
|
110
114
|
|
111
115
|
### Create Vagrantfile
|
@@ -187,7 +191,9 @@ end
|
|
187
191
|
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
188
192
|
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
|
189
193
|
* `nested` - [Enable nested virtualization](https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt). Default is false.
|
190
|
-
* `cpu_mode` - [CPU emulation mode](https://libvirt.org/formatdomain.html#elementsCPU). Defaults to 'host-model' if not set. Allowed values: host-model, host-passthrough.
|
194
|
+
* `cpu_mode` - [CPU emulation mode](https://libvirt.org/formatdomain.html#elementsCPU). Defaults to 'host-model' if not set. Allowed values: host-model, host-passthrough, custom.
|
195
|
+
* `cpu_model` - CPU Model. Defaults to 'qemu64' if not set. This can really only be used when setting `cpu_mode` to `custom`.
|
196
|
+
* `cpu_fallback` - Whether to allow libvirt to fall back to a CPU model close to the specified model if features in the guest CPU are not supported on the host. Defaults to 'allow' if not set. Allowed values: `allow`, `forbid`.
|
191
197
|
* `loader` - Sets path to custom UEFI loader.
|
192
198
|
* `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).
|
193
199
|
* `kernel` - To launch the guest with a kernel residing on host filesystems. Equivalent to qemu `-kernel`.
|
@@ -196,20 +202,26 @@ end
|
|
196
202
|
* `cmd_line` - Arguments passed on to the guest kernel initramfs or initrd to use. Equivalent to qemu `-append`.
|
197
203
|
* `graphics_type` - Sets the protocol used to expose the guest display. Defaults to `vnc`. Possible values are "sdl", "curses", "none", "gtk", "vnc" or "spice".
|
198
204
|
* `graphics_port` - Sets the port for the display protocol to bind to. Defaults to 5900.
|
199
|
-
* `graphics_ip` - Sets the IP for the display protocol to bind to. Defaults to "127.0.0.
|
205
|
+
* `graphics_ip` - Sets the IP for the display protocol to bind to. Defaults to "127.0.0.1".
|
200
206
|
* `graphics_passwd` - Sets the password for the display protocol. Working for vnc and spice. by default working without passsword.
|
201
207
|
* `graphics_autoport` - Sets autoport for graphics, libvirt in this case ignores graphics_port value, Defaults to 'yes'. Possible value are "yes" and "no"
|
202
208
|
* `keymap` - Set keymap for vm. default: en-us
|
209
|
+
* `kvm_hidden` - [Hide the hypervisor from the guest](https://libvirt.org/formatdomain.html#elementsFeatures). Useful for GPU passthrough on stubborn drivers. Default is false.
|
203
210
|
* `video_type` - Sets the graphics card type exposed to the guest. Defaults to "cirrus". [Possible values](http://libvirt.org/formatdomain.html#elementsVideo) are "vga", "cirrus", "vmvga", "xen", "vbox", or "qxl".
|
204
211
|
* `video_vram` - Used by some graphics card types to vary the amount of RAM dedicated to video. Defaults to 9216.
|
205
|
-
* `
|
212
|
+
* `machine_type` - Sets machine type. Equivalent to qemu `-machine`. Use `qemu-system-x86_64 -machine help` to get a list of supported machines.
|
206
213
|
* `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`.
|
207
214
|
* `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.
|
215
|
+
* `emulator_path` - Explicitly select which device model emulator to use by providing the path, e.g. `/usr/bin/qemu-system-x86_64`. This is especially useful on systems that fail to select it automatically based on `machine_arch` which then results in a capability error.
|
208
216
|
* `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.
|
209
217
|
* `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.
|
210
218
|
* `uuid` - Force a domain UUID. Defaults to autogenerated value by libvirt if not set.
|
211
219
|
* `suspend_mode` - What is done on vagrant suspend. Possible values: 'pause', 'managedsave'. Pause mode executes a la `virsh suspend`, which just pauses execution of a VM, not freeing resources. Managed save mode does a la `virsh managedsave` which frees resources suspending a domain.
|
212
|
-
|
220
|
+
* `tpm_model` - The model of the TPM to which you wish to connect.
|
221
|
+
* `tpm_type` - The type of TPM device to which you are connecting.
|
222
|
+
* `tpm_path` - The path to the TPM device on the host system.
|
223
|
+
* `dtb` - The device tree blob file, mostly used for non-x86 platforms. In case the device tree isn't added in-line to the kernel, it can be manually specified here.
|
224
|
+
* `autostart` - Automatically start the domain when the host boots. Defaults to 'false'.
|
213
225
|
|
214
226
|
|
215
227
|
Specific domain settings can be set for each domain separately in multi-VM
|
@@ -266,6 +278,9 @@ On vagrant reload the following domain specific attributes are updated in define
|
|
266
278
|
* `keymap` - Updated.
|
267
279
|
* `video_type` - Updated.
|
268
280
|
* `video_vram` - Updated.
|
281
|
+
* `tpm_model` - Updated.
|
282
|
+
* `tpm_type` - Updated.
|
283
|
+
* `tpm_path` - Updated.
|
269
284
|
|
270
285
|
|
271
286
|
## Networks
|
@@ -301,26 +316,26 @@ An examples of network interface definitions:
|
|
301
316
|
# Guest 1
|
302
317
|
config.vm.define :test_vm1 do |test_vm1|
|
303
318
|
test_vm1.vm.network :private_network,
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
319
|
+
:libvirt__tunnel_type => 'server',
|
320
|
+
# default is 127.0.0.1 if omitted
|
321
|
+
# :libvirt__tunnel_ip => '127.0.0.1',
|
322
|
+
:libvirt__tunnel_port => '11111'
|
308
323
|
|
309
324
|
# Guest 2
|
310
325
|
config.vm.define :test_vm2 do |test_vm2|
|
311
326
|
test_vm2.vm.network :private_network,
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
327
|
+
:libvirt__tunnel_type => 'client',
|
328
|
+
# default is 127.0.0.1 if omitted
|
329
|
+
# :libvirt__tunnel_ip => '127.0.0.1',
|
330
|
+
:libvirt__tunnel_port => '11111'
|
316
331
|
|
317
332
|
|
318
333
|
# Public Network
|
319
334
|
config.vm.define :test_vm1 do |test_vm1|
|
320
335
|
test_vm1.vm.network :public_network,
|
321
|
-
|
322
|
-
|
323
|
-
|
336
|
+
:dev => "virbr0",
|
337
|
+
:mode => "bridge",
|
338
|
+
:type => "bridge"
|
324
339
|
end
|
325
340
|
```
|
326
341
|
|
@@ -395,6 +410,9 @@ starts with 'libvirt__' string. Here is a list of those options:
|
|
395
410
|
* `:libvirt__tunnel_local_ip` - Sets the local IP used by the udp tunnel
|
396
411
|
interface type. It populates the ip entry of the `<local address=XXX">` section of
|
397
412
|
the interface xml configuration. _(This feature only works in libvirt 1.2.20 and higher)_
|
413
|
+
* `:libvirt__guest_ipv6` - Enable or disable guest-to-guest IPv6 communication.
|
414
|
+
See [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and [here](http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=705e67d40b09a905cd6a4b8b418d5cb94eaa95a8) for for more information.
|
415
|
+
* `:libvirt__iface_name` - Define a name for the private network interface. With this feature one can [simulate physical link failures](https://github.com/pradels/vagrant-libvirt/pull/498)
|
398
416
|
* `:mac` - MAC address for the interface.
|
399
417
|
* `: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
|
400
418
|
|
@@ -424,6 +442,7 @@ configurable at the provider level.
|
|
424
442
|
|
425
443
|
* `management_network_name` - Name of libvirt network to which all VMs will be connected. If not specified the default is 'vagrant-libvirt'.
|
426
444
|
* `management_network_address` - Address of network to which all VMs will be connected. Must include the address and subnet mask. If not specified the default is '192.168.121.0/24'.
|
445
|
+
* `management_network_guest_ipv6` - Enable or disable guest-to-guest IPv6 communication. See [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and [here](http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=705e67d40b09a905cd6a4b8b418d5cb94eaa95a8) for for more information.
|
427
446
|
|
428
447
|
You may wonder how vagrant-libvirt knows the IP address a VM received.
|
429
448
|
Libvirt doesn't provide a standard way to find out the IP address of a running
|
@@ -502,6 +521,77 @@ Vagrant.configure("2") do |config|
|
|
502
521
|
end
|
503
522
|
```
|
504
523
|
|
524
|
+
## PCI device passthrough
|
525
|
+
|
526
|
+
You can specify multiple PCI devices to passthrough to the VM via `libvirt.pci`. Available options are listed below. Note that all options are required:
|
527
|
+
|
528
|
+
* `bus` - The bus of the PCI device
|
529
|
+
* `slot` - The slot of the PCI device
|
530
|
+
* `function` - The function of the PCI device
|
531
|
+
|
532
|
+
You can extract that information from output of `lspci` command. First characters of each line are in format `[<bus>]:[<slot>].[<func>]`. Example
|
533
|
+
|
534
|
+
```
|
535
|
+
$ lspci| grep NVIDIA
|
536
|
+
03:00.0 VGA compatible controller: NVIDIA Corporation GK110B [GeForce GTX TITAN Black] (rev a1)
|
537
|
+
```
|
538
|
+
|
539
|
+
In that case `bus` is `0x03`, `slot` is `0x00` and `function` is `0x0`.
|
540
|
+
|
541
|
+
```ruby
|
542
|
+
Vagrant.configure("2") do |config|
|
543
|
+
config.vm.provider :libvirt do |libvirt|
|
544
|
+
libvirt.pci :bus => '0x06', :slot => '0x12', :function => '0x5'
|
545
|
+
|
546
|
+
# Add another one if it is neccessary
|
547
|
+
libvirt.pci :bus => '0x03', :slot => '0x00', :function => '0x0'
|
548
|
+
end
|
549
|
+
end
|
550
|
+
```
|
551
|
+
|
552
|
+
## CPU features
|
553
|
+
|
554
|
+
You can specify CPU feature policies via `libvirt.cpu_feature`. Available options are
|
555
|
+
listed below. Note that both options are required:
|
556
|
+
|
557
|
+
* `name` - The name of the feature for the chosen CPU (see libvirts `cpu_map.xml`)
|
558
|
+
* `policy` - The policy for this feature (one of `force`, `require`, `optional`, `disable` and `forbid` - see libvirt documentation)
|
559
|
+
|
560
|
+
```ruby
|
561
|
+
Vagrant.configure("2") do |config|
|
562
|
+
config.vm.provider :libvirt do |libvirt|
|
563
|
+
# The feature will not be supported by virtual CPU.
|
564
|
+
libvirt.cpu_feature :name => 'hypervisor', :policy => 'disable'
|
565
|
+
# Guest creation will fail unless the feature is supported by host CPU.
|
566
|
+
libvirt.cpu_feature :name => 'vmx', :policy => 'require'
|
567
|
+
# The virtual CPU will claim the feature is supported regardless of it being supported by host CPU.
|
568
|
+
libvirt.cpu_feature :name => 'pdpe1gb', :policy => 'force'
|
569
|
+
end
|
570
|
+
end
|
571
|
+
```
|
572
|
+
|
573
|
+
## USB device passthrough
|
574
|
+
|
575
|
+
You can specify multiple USB devices to passthrough to the VM via `libvirt.usb`. The device can be specified by the following options:
|
576
|
+
|
577
|
+
* `bus` - The USB bus ID, e.g. "1"
|
578
|
+
* `device` - The USB device ID, e.g. "2"
|
579
|
+
* `vendor` - The USB devices vendor ID (VID), e.g. "0x1234"
|
580
|
+
* `product` - The USB devices product ID (PID), e.g. "0xabcd"
|
581
|
+
|
582
|
+
At least one of these has to be specified, and `bus` and `device` may only be used together.
|
583
|
+
|
584
|
+
The example values above match the device from the following output of `lsusb`:
|
585
|
+
|
586
|
+
```
|
587
|
+
Bus 001 Device 002: ID 1234:abcd Example device
|
588
|
+
```
|
589
|
+
|
590
|
+
Additionally, the following options can be used:
|
591
|
+
|
592
|
+
* `startupPolicy` - Is passed through to libvirt and controls if the device has to exist.
|
593
|
+
libvirt currently allows the following values: "mandatory", "requisite", "optional".
|
594
|
+
|
505
595
|
## No box and PXE boot
|
506
596
|
|
507
597
|
There is support for PXE booting VMs with no disks as well as PXE booting VMs with blank disks. There are some limitations:
|
@@ -554,6 +644,8 @@ you want the forwarded port to be accessible from outside the Vagrant
|
|
554
644
|
host. In this case you should also set the `host_ip` option to `'*'`
|
555
645
|
since it defaults to `'localhost'`.
|
556
646
|
|
647
|
+
You can also provide a custom adapter to forward from by 'adapter' option. Default is 'eth0'.
|
648
|
+
|
557
649
|
## Synced Folders
|
558
650
|
|
559
651
|
vagrant-libvirt supports bidirectional synced folders via nfs or 9p and
|
@@ -570,6 +662,12 @@ it an setting the type, e.g.
|
|
570
662
|
|
571
663
|
config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "vagrant"
|
572
664
|
|
665
|
+
or
|
666
|
+
|
667
|
+
config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "mapped", mount: false
|
668
|
+
|
669
|
+
For 9p shares, a `mount: false` option allows to define synced folders without mounting them at boot.
|
670
|
+
|
573
671
|
**SECURITY NOTE:** for remote libvirt, nfs synced folders requires a bridged public network interface and you must connect to libvirt via ssh.
|
574
672
|
|
575
673
|
|
@@ -591,6 +689,32 @@ Vagrant.configure("2") do |config|
|
|
591
689
|
end
|
592
690
|
```
|
593
691
|
|
692
|
+
## TPM Devices
|
693
|
+
|
694
|
+
Modern versions of Libvirt support connecting to TPM devices on the host
|
695
|
+
system. This allows you to enable Trusted Boot Extensions, among other
|
696
|
+
features, on your guest VMs.
|
697
|
+
|
698
|
+
In general, you will only need to modify the `tpm_path` variable in your guest
|
699
|
+
configuration. However, advanced usage, such as the application of a Software
|
700
|
+
TPM, may require modifying the `tpm_model` and `tpm_type` variables.
|
701
|
+
|
702
|
+
The TPM options will only be used if you specify a TPM path. Declarations of
|
703
|
+
any TPM options without specifying a path will result in those options being
|
704
|
+
ignored.
|
705
|
+
|
706
|
+
Here is an example of using the TPM options:
|
707
|
+
|
708
|
+
```ruby
|
709
|
+
Vagrant.configure("2") do |config|
|
710
|
+
config.vm.provider :libvirt do |libvirt|
|
711
|
+
libvirt.tpm_model = 'tpm-tis'
|
712
|
+
libvirt.tpm_type = 'passthrough'
|
713
|
+
libvirt.tpm_path = '/dev/tpm0'
|
714
|
+
end
|
715
|
+
end
|
716
|
+
```
|
717
|
+
|
594
718
|
## Box Format
|
595
719
|
|
596
720
|
You can view an example box in the [example_box/directory](https://github.com/pradels/vagrant-libvirt/tree/master/example_box). That directory also contains instructions on how to build a box.
|
@@ -621,10 +745,10 @@ $ cd vagrant-libvirt
|
|
621
745
|
$ bundle install
|
622
746
|
```
|
623
747
|
|
624
|
-
Once you have the dependencies, verify the unit tests pass with `
|
748
|
+
Once you have the dependencies, verify the unit tests pass with `rspec`:
|
625
749
|
|
626
750
|
```
|
627
|
-
$ bundle exec
|
751
|
+
$ bundle exec rspec spec/
|
628
752
|
```
|
629
753
|
|
630
754
|
If those pass, you're ready to start developing the plugin. You can test
|
@@ -33,7 +33,10 @@ module VagrantPlugins
|
|
33
33
|
@name = env[:domain_name]
|
34
34
|
@uuid = config.uuid
|
35
35
|
@cpus = config.cpus.to_i
|
36
|
+
@cpu_features = config.cpu_features
|
36
37
|
@cpu_mode = config.cpu_mode
|
38
|
+
@cpu_model = config.cpu_model
|
39
|
+
@cpu_fallback = config.cpu_fallback
|
37
40
|
@loader = config.loader
|
38
41
|
@machine_type = config.machine_type
|
39
42
|
@machine_arch = config.machine_arch
|
@@ -44,7 +47,9 @@ module VagrantPlugins
|
|
44
47
|
@domain_volume_cache = config.volume_cache
|
45
48
|
@kernel = config.kernel
|
46
49
|
@cmd_line = config.cmd_line
|
50
|
+
@emulator_path = config.emulator_path
|
47
51
|
@initrd = config.initrd
|
52
|
+
@dtb = config.dtb
|
48
53
|
@graphics_type = config.graphics_type
|
49
54
|
@graphics_autoport = config.graphics_autoport
|
50
55
|
@graphics_port = config.graphics_port
|
@@ -57,6 +62,11 @@ module VagrantPlugins
|
|
57
62
|
@video_type = config.video_type
|
58
63
|
@video_vram = config.video_vram
|
59
64
|
@keymap = config.keymap
|
65
|
+
@kvm_hidden = config.kvm_hidden
|
66
|
+
|
67
|
+
@tpm_model = config.tpm_model
|
68
|
+
@tpm_type = config.tpm_type
|
69
|
+
@tpm_path = config.tpm_path
|
60
70
|
|
61
71
|
# Boot order
|
62
72
|
@boot_order = config.boot_order
|
@@ -69,6 +79,12 @@ module VagrantPlugins
|
|
69
79
|
# Input
|
70
80
|
@inputs = config.inputs
|
71
81
|
|
82
|
+
# PCI device passthrough
|
83
|
+
@pcis = config.pcis
|
84
|
+
|
85
|
+
# USB device passthrough
|
86
|
+
@usbs = config.usbs
|
87
|
+
|
72
88
|
config = env[:machine].provider_config
|
73
89
|
@domain_type = config.driver
|
74
90
|
|
@@ -139,6 +155,9 @@ module VagrantPlugins
|
|
139
155
|
end
|
140
156
|
env[:ui].info(" -- Domain type: #{@domain_type}")
|
141
157
|
env[:ui].info(" -- Cpus: #{@cpus}")
|
158
|
+
@cpu_features.each do |cpu_feature|
|
159
|
+
env[:ui].info(" -- CPU Feature: name=#{cpu_feature[:name]}, policy=#{cpu_feature[:policy]}")
|
160
|
+
end
|
142
161
|
env[:ui].info(" -- Memory: #{@memory_size / 1024}M")
|
143
162
|
env[:ui].info(" -- Management MAC: #{@management_network_mac}")
|
144
163
|
env[:ui].info(" -- Loader: #{@loader}")
|
@@ -157,6 +176,7 @@ module VagrantPlugins
|
|
157
176
|
env[:ui].info(" -- Video Type: #{@video_type}")
|
158
177
|
env[:ui].info(" -- Video VRAM: #{@video_vram}")
|
159
178
|
env[:ui].info(" -- Keymap: #{@keymap}")
|
179
|
+
env[:ui].info(" -- TPM Path: #{@tpm_path}")
|
160
180
|
|
161
181
|
@boot_order.each do |device|
|
162
182
|
env[:ui].info(" -- Boot device: #{device}")
|
@@ -180,9 +200,24 @@ module VagrantPlugins
|
|
180
200
|
@cdroms.each do |cdrom|
|
181
201
|
env[:ui].info(" -- CDROM(#{cdrom[:dev]}): #{cdrom[:path]}")
|
182
202
|
end
|
203
|
+
|
183
204
|
@inputs.each do |input|
|
184
205
|
env[:ui].info(" -- INPUT: type=#{input[:type]}, bus=#{input[:bus]}")
|
185
206
|
end
|
207
|
+
|
208
|
+
@pcis.each do |pci|
|
209
|
+
env[:ui].info(" -- PCI passthrough: #{pci[:bus]}:#{pci[:slot]}.#{pci[:function]}")
|
210
|
+
end
|
211
|
+
|
212
|
+
@usbs.each do |usb|
|
213
|
+
usb_dev = []
|
214
|
+
usb_dev.push("bus=#{usb[:bus]}") if usb[:bus]
|
215
|
+
usb_dev.push("device=#{usb[:device]}") if usb[:device]
|
216
|
+
usb_dev.push("vendor=#{usb[:vendor]}") if usb[:vendor]
|
217
|
+
usb_dev.push("product=#{usb[:product]}") if usb[:product]
|
218
|
+
env[:ui].info(" -- USB passthrough: #{usb_dev.join(', ')}")
|
219
|
+
end
|
220
|
+
|
186
221
|
env[:ui].info(" -- Command line : #{@cmd_line}")
|
187
222
|
|
188
223
|
# Create libvirt domain.
|
@@ -69,6 +69,7 @@ module VagrantPlugins
|
|
69
69
|
@network_name = iface_configuration[:network_name]
|
70
70
|
@mac = iface_configuration.fetch(:mac, false)
|
71
71
|
@model_type = iface_configuration.fetch(:model_type, @nic_model_type)
|
72
|
+
@device_name = iface_configuration.fetch(:iface_name, false)
|
72
73
|
template_name = 'interface'
|
73
74
|
# Configuration for public interfaces which use the macvtap driver
|
74
75
|
if iface_configuration[:iface_type] == :public_network
|
@@ -58,6 +58,7 @@ module VagrantPlugins
|
|
58
58
|
created: false,
|
59
59
|
active: false,
|
60
60
|
autostart: false,
|
61
|
+
guest_ipv6: @options[:guest_ipv6] || 'yes',
|
61
62
|
libvirt_network: nil
|
62
63
|
}
|
63
64
|
|
@@ -270,6 +271,7 @@ module VagrantPlugins
|
|
270
271
|
@network_bridge_name = @interface_network[:bridge_name]
|
271
272
|
@network_address = @interface_network[:ip_address]
|
272
273
|
@network_netmask = @interface_network[:netmask]
|
274
|
+
@guest_ipv6 = @interface_network[:guest_ipv6]
|
273
275
|
|
274
276
|
@network_forward_mode = @options[:forward_mode]
|
275
277
|
if @options[:forward_device]
|
@@ -38,7 +38,7 @@ module VagrantPlugins
|
|
38
38
|
def forward_ports
|
39
39
|
@env[:forwarded_ports].each do |fp|
|
40
40
|
message_attributes = {
|
41
|
-
adapter: 'eth0',
|
41
|
+
adapter: fp[:adapter] || 'eth0',
|
42
42
|
guest_port: fp[:guest],
|
43
43
|
host_port: fp[:host]
|
44
44
|
}
|
@@ -98,7 +98,7 @@ module VagrantPlugins
|
|
98
98
|
PasswordAuthentication=no
|
99
99
|
ForwardX11=#{ssh_info[:forward_x11] ? 'yes' : 'no'}
|
100
100
|
) + ssh_info[:private_key_path].map do |pk|
|
101
|
-
"IdentityFile
|
101
|
+
"IdentityFile='\"#{pk}\"'"
|
102
102
|
end).map { |s| s.prepend('-o ') }.join(' ')
|
103
103
|
|
104
104
|
options += " -o ProxyCommand=\"#{ssh_info[:proxy_command]}\"" if machine.provider_config.connect_via_ssh
|