From 7d2c600a40a192de105f6e280bb55a60b9cfd4d1 Mon Sep 17 00:00:00 2001 From: dima Date: Fri, 7 Oct 2016 17:08:09 +0200 Subject: [PATCH 01/12] version 0.0.36 --- lib/vagrant-libvirt/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/version.rb b/lib/vagrant-libvirt/version.rb index 78dfa32..5c3f5fa 100644 --- a/lib/vagrant-libvirt/version.rb +++ b/lib/vagrant-libvirt/version.rb @@ -1,5 +1,5 @@ module VagrantPlugins module ProviderLibvirt - VERSION = '0.0.35' + VERSION = '0.0.36' end end From 6b2d5ef65062e646a9744443e4fc66aa2dd81e5e Mon Sep 17 00:00:00 2001 From: Gerben Meijer Date: Fri, 7 Oct 2016 18:53:29 +0200 Subject: [PATCH 02/12] Update 9p docs; fixes #503 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42cf399..6d2cadd 100644 --- a/README.md +++ b/README.md @@ -842,7 +842,7 @@ config.vm.synced_folder './', '/vagrant', type: 'rsync' or ```shell -config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "vagrant" +config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "1000" ``` or @@ -854,6 +854,8 @@ config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmod For 9p shares, a `mount: false` option allows to define synced folders without mounting them at boot. +Further documentation on using 9p can be found [here](https://www.kernel.org/doc/Documentation/filesystems/9p.txt). Please do note that 9p depends on support in the guest and not all distros come with the 9p module by default. + **SECURITY NOTE:** for remote libvirt, nfs synced folders requires a bridged public network interface and you must connect to libvirt via ssh. From bae6a12ed64337cc3c47b19e036d277ac334672b Mon Sep 17 00:00:00 2001 From: Gerben Meijer Date: Fri, 7 Oct 2016 19:25:42 +0200 Subject: [PATCH 03/12] Document management_network_mode. Fixes #473 --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6d2cadd..a0d667c 100644 --- a/README.md +++ b/README.md @@ -564,6 +564,9 @@ provider level. * `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'. +* `management_network_mode` - Network mode for the libvirt management network. + Specify one of veryisolated, none, nat or route options. Further documentated + under [Private Networks](#private-network-options) * `management_network_guest_ipv6` - Enable or disable guest-to-guest IPv6 communication. See [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and From 1a856ec4f11b466071acb0f04f6580c9f14cdcaa Mon Sep 17 00:00:00 2001 From: Gerben Meijer Date: Sat, 8 Oct 2016 00:02:03 +0200 Subject: [PATCH 04/12] Update install/build instructions --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a0d667c..fb9842b 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,27 @@ kvm type virtual machines with `virsh` or `virt-manager`. Next, you must have [Vagrant installed](http://docs.vagrantup.com/v2/installation/index.html). -Vagrant-libvirt supports Vagrant 1.5, 1.6, 1.7 and 1.8. +Vagrant-libvirt supports Vagrant 1.5, 1.6, 1.7 and 1.8. +*We only test with the upstream version!* If you decide to install your distros +version and you run into problems, as a first step you should switch to upstream. + +Now you need to make sure your have all the build dependencies installed for +vagrant-libvirt. This depends on your distro. An overview: + +* Ubuntu 12.04/14.04/16.04, Debian: +```shell +apt-get build-dep vagrant ruby-libvirt; apt-get install qemu libvirt-bin ebtables dnsmasq +``` + +* CentOS 6, 7, Fedora 21: +```shell +yum install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm +``` + +* Fedora 22 and up: +```shell +dnf -y install qemu libvirt libvirt-devel ruby-devel gcc +``` Now you're ready to install vagrant-libvirt using standard [Vagrant plugin](http://docs.vagrantup.com/v2/plugins/usage.html) installation methods. @@ -114,6 +134,11 @@ sudo alternatives --set ld /usr/bin/ld.gold sudo ln -fs /usr/bin/ld.gold /usr/bin/ld ``` +If you have issues building ruby-libvirt, try the following: +```shell +CONFIGURE_ARGS='with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib' GEM_HOME=~/.vagrant.d/gems GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems PATH=/opt/vagrant/embedded/bin:$PATH vagrant plugin install vagrant-libvirt +``` + ## Vagrant Project Preparation ### Add Box From 6c11ae7684c92275629150721b35eff966263d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Str=C3=A1nsk=C3=BD?= Date: Sun, 9 Oct 2016 21:34:57 +0200 Subject: [PATCH 05/12] Fix default_prefix behavior Call `dup` on default prefix before amending it via `concat` and `<<`. Previously when default_prefix was used, it was amended in place, so it was changing with every VM definition and kept getting longer, leading to wrong domain names. --- lib/vagrant-libvirt/action/set_name_of_domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/action/set_name_of_domain.rb b/lib/vagrant-libvirt/action/set_name_of_domain.rb index c3062b6..0e29c40 100644 --- a/lib/vagrant-libvirt/action/set_name_of_domain.rb +++ b/lib/vagrant-libvirt/action/set_name_of_domain.rb @@ -51,7 +51,7 @@ module VagrantPlugins # don't have any prefix, not even "_" "" else - config.default_prefix.to_s.concat("_") + config.default_prefix.to_s.dup.concat("_") end domain_name << env[:machine].name.to_s domain_name.gsub!(/[^-a-z0-9_\.]/i, '') From 6ee6be2f496319d4be44f5f1b156c910cb77b7f8 Mon Sep 17 00:00:00 2001 From: Maxim Petrunin Date: Tue, 18 Oct 2016 20:05:02 +0300 Subject: [PATCH 06/12] [Docs] Add instructions for Arch Linux --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index fb9842b..fa1e49f 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,12 @@ yum install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm dnf -y install qemu libvirt libvirt-devel ruby-devel gcc ``` +* Arch linux: look at tips and solutions from Arch wiki. +```shell +pacman -Sy vagrant +``` + + Now you're ready to install vagrant-libvirt using standard [Vagrant plugin](http://docs.vagrantup.com/v2/plugins/usage.html) installation methods. @@ -126,6 +132,8 @@ $ sudo dnf install libxslt-devel libxml2-devel libvirt-devel \ libguestfs-tools-c ruby-devel gcc ``` +On Arch linux it is recommended to follow [steps from ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt). + If have problem with installation - check your linker. It should be `ld.gold`: ```shell From 3fe434afe67684620c4171c3e9896fd48db0cacc Mon Sep 17 00:00:00 2001 From: Maxim Petrunin Date: Tue, 18 Oct 2016 20:24:19 +0300 Subject: [PATCH 07/12] [Docs] add important notes to GPU passthrough section --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb9842b..bd4b3dd 100644 --- a/README.md +++ b/README.md @@ -292,7 +292,7 @@ end * `keymap` - Set keymap for vm. default: en-us * `kvm_hidden` - [Hide the hypervisor from the guest](https://libvirt.org/formatdomain.html#elementsFeatures). Useful for - GPU passthrough on stubborn drivers. Default is false. + [GPU passthrough](#pci-device-passthrough) on stubborn drivers. Default is false. * `video_type` - Sets the graphics card type exposed to the guest. Defaults to "cirrus". [Possible values](http://libvirt.org/formatdomain.html#elementsVideo) are "vga", @@ -730,6 +730,10 @@ Vagrant.configure("2") do |config| end ``` +Note! Above options affect configuration only at domain creation. It won't change VM behaviour on `vagrant reload` after domain was created. + +Don't forget to [set](#domain-specific-options) `kvm_hidden` option to `true` especially if you are passthroughing NVIDIA GPUs. Otherwise GPU is visible from VM but cannot be operated. + ## Random number generator passthrough You can pass through `/dev/random` to your VM by configuring the domain like this: From 517da85cee990578e3bf384fd118775bdbc27170 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 23 Oct 2016 16:29:33 +0200 Subject: [PATCH 08/12] only set the cpu model when using a custom cpu mode according to https://libvirt.org/formatdomain.html#elementsCPU setting the model is not supported when using "host-model" and with recent libvirt this actually results in errors like this: Call to virDomainCreateWithFlags failed: the CPU is incompatible with host CPU: Host CPU does not provide required features: svm --- lib/vagrant-libvirt/templates/domain.xml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb index 7a83c65..9c53a1f 100644 --- a/lib/vagrant-libvirt/templates/domain.xml.erb +++ b/lib/vagrant-libvirt/templates/domain.xml.erb @@ -7,7 +7,7 @@ <% if @cpu_mode != 'host-passthrough' %> - <%= @cpu_model %> + <% if @cpu_mode == 'custom' %><%= @cpu_model %><% end %> <% if @nested %> From 7ec7b8e35ef750f8d0d6a7e9b30393855340afb5 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 23 Oct 2016 16:55:27 +0200 Subject: [PATCH 09/12] also set the cpu_model in the config accordingly to the cpu_mode --- lib/vagrant-libvirt/config.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index eafdae8..3ffe6e9 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -502,7 +502,8 @@ module VagrantPlugins @memory = 512 if @memory == UNSET_VALUE @cpus = 1 if @cpus == UNSET_VALUE @cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE - @cpu_model = 'qemu64' if @cpu_model == UNSET_VALUE + @cpu_model = 'qemu64' if (@cpu_model == UNSET_VALUE and @cpu_mode == 'custom') + @cpu_model = '' if (@cpu_mode != 'custom') @cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE @cpu_features = [] if @cpu_features == UNSET_VALUE @numa_nodes = @numa_nodes == UNSET_VALUE ? nil : _generate_numa() From 7f11cb1e1f4ebed3681ed15559b40bf1c710f340 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 23 Oct 2016 17:17:05 +0200 Subject: [PATCH 10/12] adjust README.md to reflect latest defaults changes --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b8244bc..dd58565 100644 --- a/README.md +++ b/README.md @@ -266,8 +266,9 @@ end mode](https://libvirt.org/formatdomain.html#elementsCPU). Defaults to 'host-model' if not set. Allowed values: host-model, host-passthrough, custom. -* `cpu_model` - CPU Model. Defaults to 'qemu64' if not set. This can really - only be used when setting `cpu_mode` to `custom`. +* `cpu_model` - CPU Model. Defaults to 'qemu64' if not set and `cpu_mode` is + `custom` and to '' otherwise. This can really only be used when setting + `cpu_mode` to `custom`. * `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`. From bdab8612d8e6bffac15eed9d434c74723bbf2a91 Mon Sep 17 00:00:00 2001 From: Trapier Marshall Date: Wed, 26 Oct 2016 18:40:38 -0400 Subject: [PATCH 11/12] readme: spelling correction --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8244bc..32f9e44 100644 --- a/README.md +++ b/README.md @@ -693,7 +693,7 @@ You can specify multiple inputs to the VM via `libvirt.input`. Available options are listed below. Note that both options are required: * `type` - The type of the input -* `bus` - The bust of the input +* `bus` - The bus of the input ```ruby Vagrant.configure("2") do |config| From 5091844c70870b11ec2547f5d032b5f322930417 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 28 Oct 2016 22:48:37 +0200 Subject: [PATCH 12/12] fold cpu_model assignment into one --- lib/vagrant-libvirt/config.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index 3ffe6e9..ad7a5cf 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -502,8 +502,11 @@ module VagrantPlugins @memory = 512 if @memory == UNSET_VALUE @cpus = 1 if @cpus == UNSET_VALUE @cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE - @cpu_model = 'qemu64' if (@cpu_model == UNSET_VALUE and @cpu_mode == 'custom') - @cpu_model = '' if (@cpu_mode != 'custom') + @cpu_model = if (@cpu_model == UNSET_VALUE and @cpu_mode == 'custom') + 'qemu64' + elsif (@cpu_mode != 'custom') + '' + end @cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE @cpu_features = [] if @cpu_features == UNSET_VALUE @numa_nodes = @numa_nodes == UNSET_VALUE ? nil : _generate_numa()