Handle enabling and disabling of NVRAM during start domain.
This patch contains latent support for upstream PR fog-libvirt#102 to support destroy
with NVRAM enabled once that is merged.
Fixes#1027.
When assigning a pci passthrough device, the domain, bus, slot and
function parameters pertain to the host device address. Add guest_
flavours of these to allow setting the address of the device in the
guest as well.
Fixes: #1475
While trying to use the steps provided in the `Additional Notes for Fedora and
Similar Linux Distributions` I noticed that some of the versions referenced
there were not up-to-date, as well as a missing script call for the krb5.
Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
Using `autoload` fairly consistently results in 'constant not defined'
errors for each of HandleBox, SyncedFolders, WaitForCommunicator
when using ruby 3.1. Presumably there's some sort of race condition.
Explicitly using `require` for these three makes the problem go away.
It might be a bit ugly to have those `require` lines right at the
point where those symbols are used, vs. the neat `autoload` section
at the top of the file, but I'm not sure how better to structure this.
Suggestions most welcome :-)
Fixes: #1445
Signed-off-by: Tim Serong <tserong@suse.com>
Provisioning is executed on the out-call action, so it should be added
the call start before the configuration of the network interfaces is
scheduled via a guest capability as it is also executed out the out call
to allow the first part to be performed before the VM is booted and the
latter to be done after it is running.
Fixes: #1479
Avoid crash caused by power management suspension where fog fails to translate domain state pmsuspended.
Changed the driver.state() function so that it does not crash on undefined domain state. Just return nil :unknown instead.
Added unittests and made existing more general.
Closes#1472
Switch to the command as an array format when passing the port
forwarding ssh command to spawn to switch to execution of the ssh
process directly instead of being executed by the default shell.
Fixes: #1467
Bundler for older ruby versions uses anonymous git to clone ruby
dependencies directly from repos. Ensure these all use https by
configuring git to replace the URL automatically.
When running the docker container, only output what is returned by
vagrant to stdout, and redirect everything else to stderr to facilitate
anything parsing stdout.
Fixes: #1463
Facilitate disabling serial devices by allowing for the configuration to
explicitly set serials to an empty array and ignoring adding the default
serial if this is the case.
Autoloading interaction with threads can cause issues. Follow the best
practice of performing the autoloading early in the hope that this
avoids the issue with a symbol not being fully defined before
another thread attempts to use the symbol in the same file.
Fixes: #1445
Trying to create a routed network with just ipv6 fails with:
Error occurred while creating new network: Call to virNetworkDefineXML failed: XML error: Missing required address attribute in network 'test'.
Since an ipv4 address should be optional for this scenario, make it so.
This makes the following configuration work:
config.vm.network :private_network,
:libvirt__network_name => "test",
:libvirt__forward_mode => "route",
:libvirt__dhcp_enabled => false,
:libvirt__guest_ipv6 => "yes",
:libvirt__ipv6_address => "fc00::",
:libvirt__ipv6_prefix => "64"
When the :ip is ipv6, set the 'static6' type, so that we select the
correct _static6.erb template to configure the interface in the guest.
With the following configuration, ipv6 works out of the box on CentOS 8:
(1..2).each do |i|
config.vm.define "node#{i}" do |node|
node.vm.hostname = "node#{i}"
node.vm.network :private_network,
:ip => "fc00::#{i+9}",
:netmask => "64",
:libvirt__dhcp_enabled => false,
:libvirt__forward_mode => "veryisolated",
:libvirt__network_name => "test"
end
end
Fixes: #914
Libvirt did already change the current 9216kb
to 16384kb when starting a domain so in practice this is a no-op.
The libvirt default was changed in 2014 in 81ba2298b2
Starting from version 0.7.0 (https://newreleases.io/project/github/vagrant-libvirt/vagrant-libvirt/release/0.7.0), always_destroy is set to true by default for any network.
However, in certain cases, it would be useful to keep the management network, especially when it has been already configured (externally) with Static IP leases.
This option allows to change the always_destroy behaviour for the management network.
Reduce the patching needed should a distro wish to switch the default
from using the system connection by default to using a session
connection by default.
Should now only require patching the default value and a single test
checking the defaults.
When cpu mode was set to host-passthrough the template would skip
setting all other settings for the cpu, while it appears from the
documentation that it supports use of feature elements, and testing
confirms that it also supports the topology element.
https://libvirt.org/formatdomain.html#cpu-model-and-topologyFixes: #975
Adjust handling to use a method reference instead of attempting to
update the env value as that only appears to be available to actions
further down the chain and any changes are not visible during recovery
when exercised for real.
By passing a function reference can limit the actions that can be taken
to only allow a single call that will set a flag internal to the clean
up action.
Fixes: #1328
Switch to dedicated actions to trigger destroy/halt via the recovery
mechanism if the VM bring up has failed to complete the bring up of the
machine.
Fixes: #1328
Switch to using explicit references to objects to be partially mocked
and remove the need to resolve the string constants as this will catch
more instances of calls to invalid or missing methods.
Rework how the vm is added to the machine for one of the tests as it is
not a method and instead is provided via internal state being exposed
with a helper.
When the tests are executed and rsync is not installed on the machine executing
the tests, then vagrant-libvirt will automatically fallback to virtiofs or
9p. Both of these perform the following call to check the libvirt version:
libvirt_version = machine.provider.driver.connection.client.libversion
However, this mock was not setup and thus those tests would fail.
This fixes https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1415
In PrepareNFSSettings.read_host_ip we use a UDPSocket to connect to the host in
question. However, this fails completely if the system executing the tests has
no network adapters enable, like builders in OBS or Koji. If we double the calls
to this, then we no longer face that issue.
This requires that the qemu_use_agent is enabled and at least one
network is defined in the Vagrantfile that is either private or public.
The restriction that qemu_use_agent need be enabled may be removed
subsequently for networks using a static IP address. That should be
considered a subsequent problem.
Fixes: #1204Fixes: #1124Fixes: #1057
Consolidate actions around starting the VM into a single place, and
re-order the call to the CreateNetworkInterfaces to allow it to be used
during initial bring up without needing to duplicate the remaining start
actions in the up process.
Facilitate the injection of a default channel when qemu_agent is set to
true to make enabling it's use a simple `qemu_agent = true` for most
cases.
Where custom values are needed, they can be provided and the code will
skip adding a corresponding entry, or if necessary the user can add an
entry and mark it disabled similar to how synced folders work.
Closes: #1341
List network devices to trigger a side effect to ensure the
qemu-bridge-helper will run correctly for users of the modular daemons.
It is likely that this should be done for sessions to support resolving
the correct virtual bridge device anyway, however that is more involved
and maybe superseded by not needing a network interface should qemu
agent be able to act as a communicator. Or to perform port forwarding
using qemuargs to allow SSH access directly in.
Fixes: #1258
To make it easier to see when the XML generated has deviated from
expected, tidy up the emitted XML to use a more consistent formatting
that would be inline with what would be expected to be output by virsh
directly.
Re-enable handling of the disk_device domain volume setting to ensure it
can be overridden from the default of vda to a value chosen.
Provide a disk resolver to resolve devices after the box has been downloaded
so that initial devices can be correctly allocated and avoid conflicts with
additional disks added that would otherwise get assigned the same device.
Removes hack for destroy domain when more than one disk, as now devices
in the config are only present if provided by the configuration.
Fixes: #1353
When destroying domains were there are multiple box volumes to be
removed, need to perform a series of checks to establish that the
correct volumes are being removed.
- check if device aliases are in use
- process the box volume removals first
- detect if disks attached outside of vagrant-libvirt
- prefer aliases for additional disks
- avoid use of devices for multiple disks to detect as currently
assigned incorrectly.
- fallback to detecting number of box volumes to determine
point at which additional disks start
Attempts to flag a number of cases where behaviour might be incorrect to
help users spot when vagrant-libvirt may accidentally remove something
it shouldn't.
Upstream transitive dependency has dropped support for older rubies
without updating the minimum ruby version required.
Pin the max version of the dependency for older rubies to allow the
tests to run until the upstream project resolves.
To facilitate using session on a remote instance, ensure the system_uri
configuration attribute is by default derived from the default uri
provided or constructed based on other settings, so that it contains any
host and transport settings.
With the rework to use the default connection to retrieve the domain to
allow running of the qemu agent, no longer necessary to use a read
write system connection, and can revert to a read-only connection that
requires less privileges.
This should remove an occurrence of polkit requesting a password when
bringing a VM up using a session connection.
Fixes: #1342
Adjust the order of checks around use of qemu sessions to allow use of
the agent as a priority when enabled, which should remove the need to
retrieve the address from the system connection when enabled.
Additionally adjust the call to the agent to ensure it uses the default
connection to retrieve the correct domain, rather than forcing the
system connection, which will fail to find the domain if it was created
via a user session.
Add tests that validate most of this behaviour, as well as resulting in
some minor fixes around downcasing the mac address for comparisons, and
also using instance mocks with rspec instead of pure doubles to help
catch false positives where mocks are allowing calls that done exist.
Related: #1342