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.
Qemu has supported tpm 2 and the ability to start swtpm. Additionally
it expands the tests for the tpm configuration to ensure that only when
the options cause a change to the domain XML will the domain be updated
on a subsequent start. This change just allows passing through the
necessary config.
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.tpm_model = "tpm-crb"
libvirt.tpm_type = "emulator"
libvirt.tpm_version = "2.0"
end
end
closes#965
Adds support for exposing the correct version via export-subst for
git-archive constructed tarballs to make it easier to consume directly
from source.
Will check in the following order of preference:
- version file
- format string containing "Tag:"
- clone remote to describe commit
When using qemu:///session, it's necessary to ensure the correct
user/group is passed in when creating additional volume storage as
otherwise the default is to attempt to chown/chgrp it to 0:0 which will
fail.
With this in place and recent changes around uri/qemu_use_session,
remove the checks guarding retrieving the storage pool as it is also
possible for it to be created as expected for the session.
Update create domain tests to check for the correct settings such as
storage path and user/group id's passed to the volume create call for
the additional disks.
Fixes: #986
Various checks in the start domain action were accidentally causing a
redefine right after initial create. Update to provide debug output when
the domain needs to be changed to allow capture of the redefines
occurring in the future and to make it easy for the tests to pick up
where the redefine was triggered by setting an expectation on the log
output.
Include a small fix to avoid running strip on what might be a nil object
returned for elements without any text attributes.
Fix a bug where changes to tpm settings made to the config after an
initial domain creation where there was previously no tpm defined, would
be ignored.
Adds a logger double and updates other tests that trigger log calls.
should fix#1176
If planning to repackage a machine that is brought up with vagrant and
modified, it is necessary to avoid the default ssh replacement that
normally takes place to ensure the subsequent box that is halted and
packaged can be accessed by vagrant using the default ssh key
subsequently.
Add some small documentation notes to help users be aware to this so
that they know to set `config.ssh.insert_key = false` when using vagrant
to build a box.
Fixes: #1116
hashicorp/vagrant#11465 introduced a new option --no-tty which silences
progress bars so they don't spam logs when Vagrant is used
non-interactively. First Vagrant version with this change is v2.2.8.
However, existing code needs to be slightly updated to cooperate with
the new option correctly, otherwise the progress bars spam the logs with
empty lines/warnings instead of remaining silent.
Fixes: #1106
Provides steps for how to build and copy across the required libraries
to avoid a number of runtime failures on Fedora when using upstream
releases of vagrant.
These steps also remove the need to provide `CONFIGURE_ARGS=..`
as part of the install process.
Github supports attaching files, therefore switch to suggesting users attach the
debug output instead of inserting to make it easier to quickly read over the issue.
Add default domain start spec test and fix bug triggered by whitespace
mismatch in string comparison that would trigger unexpected domain
undefine and recreate.
fixes `bundle install` step from the README, currently broken by https://github.com/hashicorp/vagrant-spec/issues/41
```
~/src/vagrant-libvirt $ bundle install
....
Fetching git://github.com/hashicorp/vagrant-spec.git
fatal: Needed a single revision
Revision master does not exist in the repository git://github.com/hashicorp/vagrant-spec.git. Maybe you misspelled it?
```
Works fine now on my workstation with the new name:
```
Using vagrant-spec 0.0.1 from git://github.com/hashicorp/vagrant-spec.git (at main@b6b56c8)
Bundle complete! 10 Gemfile dependencies, 73 gems now installed.
```
With the switch to using git to resolve the version it's necessary to
ensure the history is available in the clone during the github action.
Add the `context: .` setting to work around a bug in the docker github
action. Based on docker/build-push-action#162
Switch to looking up the version from a file with a fall back to get
it directly from git tags if the file isn't available.
The version file is automatically generated by a task of building of the
gem and included in the package release to prevent reading from git.
Should allow the release process to be automated from pushing of a git
tag.
Add support for a pool setting for additional disks, example:
Vagrant.configure("2") do |config|
config.vm.box = "generic/centos8"
config.vm.provider :libvirt do |domain|
domain.storage :file, :size => '20G', :pool=>'default'
domain.snapshot_pool_name='cache'
end
end
this allows to place the virtual machines snapshot in the "cache" pool,
while additional disks are created in the "default" storage pool.
Provide a simple create domain test that uncovered a bug with an
exception in addition to fixing the tests to avoid unnecessary output
when the code sends messages via the UI.
Ensure the release workflow will work consistently by limiting the
number of issues that are checked in addition to making use of a cache.
This should keep the requests below the API limit and overtime may be
increased should the cache be retained.
Add checks to determine the correct default branch and look to establish
if the tag that was created is reachable from this branch, using it as
the value for `commitish` to the create release action so that it
retains the `x commits since release` text and link.
In the case the workflow is re-run for a release after another release
look to pick up the next tag after this release in order to limit the
release notes from updating with additional fixes.
Tweak workflow to skip attempting to push the docker image without
credentials additionally modify to allow the dockerhub organization to
be managed via a secret so that forked repos may push locally modified
images to their own dockerhub with a minimum of effort.
Additionally given the way github status checks works, this should allow
maintainers of this project to push the same commit to a local branch in
order to build and publish the image to the org dockerhub repository to
allow testing of the image before merging. Based on having first
reviewed and decided it was safe to allow access to any secrets.
Pushing the PR to a local branch will not result in getting a tag with the
pr<num> as the version, however this is a reasonable starting position.
Erubis is dead upstream, therefore it is good idea to avoid its usage.
Also, this allows to drop explicit dependency on Erubis, which is not
specified anywhere and may cause issues when Vagrant changes its
renderer.
Fixes#1142.
Add github actions to automatically populate release notes on tag push.
This should make it easier to show what new functionality/improvements
have been added by populating the release page based on PRs and issues.
Provide a docker image that supports execution of vagrant-libvirt
provided the host system has docker and libvirt installed. This can help
side step many of the library compatibility issues experienced by users
by providing an alternative way to run the latest code should their
distribution not have a natively packaged vagrant.
Users are allowed to set a LIBVIRT_DEFAULT_URI environment variable that
controls tools (i.e. virsh, virt-install, etc) that communicate with
libvirt. Let's allow for that mechanism to be used here.