From 19eb62a93bef7bd03f36f04ca09b79cbaf0e3cc3 Mon Sep 17 00:00:00 2001 From: anonym Date: Wed, 17 Feb 2016 22:34:01 +0100 Subject: [PATCH 1/3] Make it possible to set the path to the device model emulator. On some systems (e.g. Debian) omitting this setting results in the following error: Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: invalid argument: could not find capabilities for domaintype=kvm Which has been reported as: https://github.com/pradels/vagrant-libvirt/issues/539 --- lib/vagrant-libvirt/config.rb | 2 ++ lib/vagrant-libvirt/templates/domain.xml.erb | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index 1742c41..82f517f 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -71,6 +71,7 @@ module VagrantPlugins attr_accessor :kernel attr_accessor :cmd_line attr_accessor :initrd + attr_accessor :emulator_path attr_accessor :graphics_type attr_accessor :graphics_autoport attr_accessor :graphics_port @@ -144,6 +145,7 @@ module VagrantPlugins @kernel = UNSET_VALUE @initrd = UNSET_VALUE @cmd_line = UNSET_VALUE + @emulator_path = UNSET_VALUE @graphics_type = UNSET_VALUE @graphics_autoport = UNSET_VALUE @graphics_port = UNSET_VALUE diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb index 5c9cf29..971e4b5 100644 --- a/lib/vagrant-libvirt/templates/domain.xml.erb +++ b/lib/vagrant-libvirt/templates/domain.xml.erb @@ -55,6 +55,9 @@ + <% if @emulator_path %> + <%= @emulator_path %> + <% end %> <% if @domain_volume_path %> From 586881aedd5551ead3c360684edbd5326cf2bc90 Mon Sep 17 00:00:00 2001 From: anonym Date: Wed, 17 Feb 2016 23:24:07 +0100 Subject: [PATCH 2/3] Document the emulator_path option. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c0caf06..ed3b652 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ end * `machine` - Sets machine type. Equivalent to qemu `-machine`. Use `qemu-system-x86_64 -machine help` to get a list of supported machines. * `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`. * `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. +* `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. * `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. * `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. * `uuid` - Force a domain UUID. Defaults to autogenerated value by libvirt if not set. From 59ab65523a41fe05030b66098be5feded7d148a3 Mon Sep 17 00:00:00 2001 From: anonym Date: Thu, 10 Mar 2016 03:19:24 +0100 Subject: [PATCH 3/3] Fixup on emulator_path configuration. Thanks to Gerben Meijer for the fix! --- lib/vagrant-libvirt/action/create_domain.rb | 1 + lib/vagrant-libvirt/config.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb index 0c34674..5be6bef 100644 --- a/lib/vagrant-libvirt/action/create_domain.rb +++ b/lib/vagrant-libvirt/action/create_domain.rb @@ -45,6 +45,7 @@ module VagrantPlugins @domain_volume_cache = config.volume_cache @kernel = config.kernel @cmd_line = config.cmd_line + @emulator_path = config.emulator_path @initrd = config.initrd @graphics_type = config.graphics_type @graphics_autoport = config.graphics_autoport diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index 82f517f..b9eafc8 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -444,6 +444,7 @@ module VagrantPlugins @tpm_type = 'passthrough' if @tpm_type == UNSET_VALUE @tpm_path = nil if @tpm_path == UNSET_VALUE @nic_adapter_count = 8 if @nic_adapter_count == UNSET_VALUE + @emulator_path = nil if @emulator_path == UNSET_VALUE # Boot order @boot_order = [] if @boot_order == UNSET_VALUE