Although it is possible to attach additional images (disk or cdrom) the
cdrom functionality doesn't allow setting the :type - it defaults to
'raw' since vagrant-libvirt is assuming cdrom images are in ISO9660
format.
This assumption breaks down when using vagrant-mutate to convert a box
with multiple storage devices. A common situation is the Ubuntu boxes
built for VirtualBox that contain a cloud-init ISO9660 image with
user-data. vagrant-mutate converts the image to qcow* format (not
ISO9660) in order to not have to deal with what is inside.
This means the resulting libvirt domain needs to be told the type is
'qcow2' in order for the guest to see it as an ISO9660 image.
This patch adds the required option along with a sensible default.
When a cd-rom is attached as an additional storage, listing the volumes
can include a nil element. Make sure to check that the element is valid
before attempting to access the attribute.
Update the test to better match the observed behaviour.
Fixes: #1209, #1262
Vagrant subcommand halt accepts an argument -f that should result in
VMs being halted immediately instead of attempting a graceful shutdown.
Add support for this option and include tests to cover the rest of the
halt behaviour.
Fixes: #1265
Adds support for a new multi disk box format and handling to upload the
multiple disks to the storage pool.
New format is:
{
'disks': [
{
'name': 'disk1.img',
'virtual_size': 10,
'format': 'qcow2'
},
{
'name': 'disk2.img',
'virtual_size': 15,
'format': 'qcow2'
},
{
'name': 'disk3.img',
}
],
'provider': 'libvirt',
'format': 'qcow2'
}
It is expected to remove format from being set at the top level when
using the new format, with the assuming that qcow2 should be the default
format, and other formats should be permitted to be specified as needed.
Includes tests for handling the box images and creation of domain
volumes. Additionally includes an integration test to ensure a box with
2 disks will work as expected.
Partially fixes: #602
Co-authored-by: Richard Turc <richard.turc@stormshield.eu>
Adds support for a new multi disk box format and handling to upload the
multiple disks to the storage pool.
New format is:
{
'disks': [
{
'name': 'disk1.img',
'virtual_size': 10,
'format': 'qcow2'
},
{
'name': 'disk2.img',
'virtual_size': 15,
'format': 'qcow2'
},
{
'name': 'disk3.img',
}
],
'provider': 'libvirt',
'format': 'qcow2'
}
It is expected to remove format from being set at the top level when
using the new format, with the assuming that qcow2 should be the default
format, and other formats should be permitted to be specified as needed.
Includes tests for handling the box images and creation of domain
volumes. Additionally includes an integration test to ensure a box with
2 disks will work as expected.
Partially fixes: #602
The #1249 introduce a change of behaviour on auto_config to skip if it
was any kind of false, where as the correct behaviour is to only skip if
explicitly set to false.
Fix interaction with reload plugin.
The existing hardcoded timeout doesn't allow for VMs that take longer
to shutdown for a reboot, thus breaking the reload plugin for them.
This switches to retrieve the value for graceful shutdown timeout that
can be set by Vagrantfile authors to facilitate.
Original PR: #1038
From <https://virtio-fs.gitlab.io/index.html#overview>:
> Virtio-fs is a shared file system that lets virtual machines access a directory tree on the host. Unlike existing approaches, it is designed to offer local file system semantics and performance.
From <https://virtio-fs.gitlab.io/index.html#faq>:
> Existing solutions to this problem, such as virtio-9p, are based on existing network protocols that are not optimized for virtualization use cases. As a result they do not perform as well as local file systems and do not provide the semantics that some applications rely on.
This PR add `virtiofs` support to vagrant-libvirt, which simply clone-and-hack from our existing 9p implementation. It also tidy up and synchronize naming for 9p implementation.
Tested with:
- Host: Ubuntu 20.10 + Linux 5.10.30 + QEMU 5.0.0 + Libvirt 6.6.0 + Vagrant 2.2.15
- Guest: Ubuntu 20.04 + Linux 5.4.0
Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
Retrieve vagrant and ruby-libvirt dependencies and modify as needed to
allow testing against ruby 3.0 until released versions support.
Use conditionals to skip steps when not needed.
Note that in order to use the locally built gem added to the cache
manually, need to disable checksums. However as all other ruby
versions will continue to use it, shouldn't be an issue as long as the
cache for ruby 3.0.0 is wiped clean before being used for anything such
as publishing.
Fixes: #1244
With the refactor to where the domain addresses are looked up, a log
message was added in case of timeout, however it was missed that when
this occurs still need to raise the exception to ensure that checks for
this timeout can occur within the original calling function.
Update tests to ensure that the code will retry the expected number of
times before triggering the expected failure message and aborting the
machine bring up.
Additionally to allow running the wait_till_up_spec.rb separately,
needed to ensure the plugin.rb which is loaded by the code pulls in the
action.rb to ensure `Action.remove_libvirt_image` can be correctly
resolved when the rest of the test suite is not running.
Fixes: #1239
Migrate the proxy_command specification to the config and add support
for user override template to be used for edge cases. Moving it to the
config allows mistakes in the interpolation to be caught before the
machine is brought up.
Note this uses a more restrictive replacement to avoid requiring
escaping of '%' or '$'.
Issue #921 already partially resolved thanks to @ElArtista, this
completes the fix by allowing users to override as needed.
Fixes: #921
When working with multi machine configurations, various provisioners may
query the IP addresses of all of the other machines from the current
provider, in which case it is necessary to ensure that calls to the
driver use the provided context and not it's current instance variables
as these may reference a different machine.
Allows to spin up vagrant boxes via vagrant-libvirt in CI replacing the
need for vagrant-libvirt-qa to be executed separately before/after
releases.
* Adds a github integration tests workflow
* Installs the needed toolset in separate groups for easier tracking
* Add Vagrantfile definitions for the first simple test cases in tests/
using tinycore linux, using the installed master version these boxes
are spun up and destroyed via a test matrix.
Should help reduce effort for new maintainers to help with #1069
Auto enable ssh connections if the ssh keyfile has been explicitly set
and switch a number of settings from being explicitly set until after
attempts to resolve the values have failed in order to allow decisions
to be main on whether to set them based on inferred values only if not
explicitly provided elsewhere.
Add some additional tests and transport modes to expand the coverage of
what is accepted to align as close to what libvirt will accept as
possible.
Move finalizing the id_ssh_key_file based on how other settings are
currently defined to a separate private function and extend the tests to
accept defining additional expects/allows within the table.
This should apply a consistent set of rules where if the user explicitly
supplies the key, it will attempt to resolve it based on the expected
ssh directory, and will always retain the explicit setting even if it
doesn't exist. Where connect_via_ssh is enabled, it will attempt to
detect if the default key exists, otherwise it will disable the setting.
If the user does not want automatic guesses, they can explicitly disable
by setting it to `nil`.
Fixes: #1228
Skip setting various additional connection params if the transport for
the libvirt connection is not ssh based as these will be ignored and may
cause confusion as to why they do not apply.
Switch to only picking up LIBVIRT_DEFAULT_URI if no settings that could
affect the uri have been explicitly set. Some of these may not actually
appear in the URI depending on what is actually set or not set, however
it is important that should only use the env variable if the user has
not explicitly configured options relevant and instead allow them to
configure as needed.
One can now set `LIBVIRT_DEFAULT_URI` to something like
`qemu+ssh://user@beefy/system` along with `connect_via_ssh` option to
true and use vagrant on remote machines, without needing to
duplicate/hardcode remote server username and identity key inside the
Vagrantfile.
Partial Fixes: #1217
Solves vagrant not detecting end of ssh connection when a proxy is
used, described in #921
Allows ssh argument population to append arguments only when
respective values are not nil, avoiding creation of invalid
proxy_command when ssh-agent or ssh config based connections are used
Refactor WaitTillUp action to make use of the domain IP address
retrieval code in the driver to ensure a single place to maintain.
Remove references to machine option for driver where already should be
available as an instance variable.
Update config tests replacing the multiple sets of tests exercising
aspects of how the uri setting should be constructed with a single table
of tests including some pending tests to describe how the code should
work not just how it currently works.
This should make it easier to identify and describe the correct
behaviour that should occur and then ensure the code in the future
implements the needed changes.
Adds notes on how to download the SRPMS for CentOS 8 stream to
facilitate rebuilding.
Inspiration came from the following email chain
https://www.spinics.net/lists/centos-devel/msg19439.html, which only
provides part of the solution.
It appears that the suggestion that flag-name should be set when doing
parallel builds, appears to lead to incorrect reporting by coveralls of
the overall coverage of all runs combined back onto the PR.
Migrate to github actions as travis has switched to a process that will
require requesting minutes regularly for open source projects, and
current development is slow enough that this additional overhead is too
much.
Correct the generation of the line coverage following the example at
coverallsapp/github-action#29. Remove dependency on coveralls
gem as no longer needed if using the action.
Patch older versions of simplecov to contain a branch_coverage?
method to ensure working with simplecov-lcov.
After working with `virt-sysprep`, it is a good idea to make the disk image
sparse with `virt-sparsify`. This reduces the size of the resulting box.
See https://libguestfs.org/virt-sparsify.1.html
Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
Switch using "$@" to ensure that options provided on the command line to
be interpreted by vagrant are correctly passed on with appropriate
quoting. This fixes the issue where running the docker container with
`vagrant ssh -c 'ls -la'` would fail as the `-la` option was interpreted
by vagrant instead of being passed as part of the value for the `-c`
option.
To be able to use 'vagrant ssh' from within the docker container, it is
necessary to run within the host network context.
Include a helper alias suggestion and a note about a current issue in
passing arguments to vagrant options which impacts the 'vagrant ssh -c
...' syntax with an alternative.
Adds disk driver options: io, copy_on_read, discard and detect_zeroes
for both the primary vm disk and additional disks.
Minor refactor of existing volume_cache to deprecate and replace with a
single call to disk_driver that contains all of the options. Usage of
the volume_cache option will now result in a message to ui that it has
been replaced, as well as a warning that it is ignored if disk_driveris
set.
The old option volume_cache is only used if disk_driver is not present
(even if :cache is not set - in that case, the hypervisor default is
always used).
Resolves#998
virt-sysprep by default enable the `customize` operation, which will
regenerate the `/etc/machine-id` by the end of the operation. This
cause all newly created VMs by `vagrant up` coming with idential
`/etc/machine-id` and so receive conflicted IP from DHCP.
This PR disable `customize` as per
https://github.com/vagrant-libvirt/vagrant-libvirt/issues/851#issuecomment-520799720
recommendation.
Fixes#851
Allow configuration of various memballoon-related settings. It was
discovered that it may be needed to be able to control the memballoon's
PCI slot/bus location in order to prevent it from conflicting with
other explicit PCI location assignments. For example when configuring
the management network NIC to go to slot 0x05, libvirt would try to put
the memballoon there as well and resulting in a fatal error.
Filter out spec helpers and test code from coverage reports.
This will prevent future changes reporting reduction in coverage
even when only adding additional tests.