Commit Graph

1238 Commits

Author SHA1 Message Date
Darragh Bailey
605aabcd98
Support provider URI per machine definition (#1363)
Save the variables on the instance to allow for different connection
settings to be specified on a per machine basis.

Provide some rudimentary tests that ensure that the different URIs are
used when constructing connections, and additionally the connection is
created only once, no matter how many times it is subsequently called.

Fixes: #1358
2021-09-27 18:11:29 +01:00
Darragh Bailey
de4721f62e
Ensure sensible default USB controller model used (#1362)
When users adding devices either via the pass through or USB redirector
approach, ensure a default controller is added using the xhci stack.
This should work for all versions of USB, where as the previous default
of piix3-uhci appears to only work for some USB 1 controllers.

Fixes: #1346
2021-09-27 16:49:15 +01:00
Michael Ablassmeier
5a51c6c617
Merge pull request #1361 from abbbi/1341_poc
#1341 fix condition check on @qemu_use_agent
2021-09-27 16:06:15 +02:00
Michael Ablassmeier
edf392c0b8
Merge branch 'master' into 1341_poc 2021-09-27 15:37:34 +02:00
ma
5f38f8f2a0 #1341 fix condition check on @qemu_use_agent 2021-09-27 13:45:01 +02:00
Darragh Bailey
c3e96d149e
Avoid blanking username if set by user (#1352)
While the username may not be used unless the connection is via ssh,
should avoid forcing to nil by accident when re-parsing from the uri.
2021-09-25 10:24:00 +01:00
Darragh Bailey
da2674b9af
Update to vagrant 2.2.18 for docker image (#1354) 2021-09-24 13:11:51 +01:00
Michael Ablassmeier
e9213b6caa
Merge pull request #1343 from abbbi/1341_poc
Retrieve IP Address of management interface using qemu-guest-agent commands #1341
2021-09-24 11:12:17 +02:00
ma
6c5ecf09af Retrieve IP Address of management interface using qemu-guest-agent commands #1341 2021-09-22 11:41:19 +02:00
Darragh Bailey
d1bad669b6
Merge pull request #1349 from mmguero-dev/topic/docker-entrypoint-fix
Fix variable in entrypoint.sh when determining user based on Vagrantfile ownership
2021-09-14 17:47:22 +01:00
SG
75467924e1 Fix entrypoint.sh determining user based on Vagrantfile ownership
In the entrypoint.sh script, the "$1" variable was used incorrectly
when determining default user based on the ownership of the vagrantfile
(or parents). The "$vagrantfile" variable should have been used
instead, as it was just set.

Signed-off-by: SG <13872653+mmguero@users.noreply.github.com>
2021-09-13 10:48:45 -06:00
Darragh Bailey
b49b1991b9
Improve handling of cpu model and initrd settings (#1333)
Avoid triggering a reconfig of the domain when the cpu model and the
initrd haven't been set via the config.
2021-09-11 22:00:33 +01:00
Darragh Bailey
0756362b84
Output XML elements to debug logs (#1345)
Because libvirt may handle updating the XML of components differently
across different versions and user environments, add the generated
contents to the debug log to assist in understanding what is happening
for different users.
2021-09-11 19:29:45 +01:00
Darragh Bailey
90e89de969
Support dev setting vagrant-spec version from env (#1344)
Allow control of the reference or version of vagrant-spec to be used
from the dev environment where it is necessary to test with older
versions of the plugin which may depend on different versions of
dependencies compared to vagrant-spec.

In this case the latest vagrant-spec has rolled forward the rspec core
version to 3.10, which works with the latest vagrant-libvirt. However
previous versions of vagrant-libvirt require 3.5, which was the previous
minor version pinned.

Adding the option of VAGRANT_SPEC_VERSION that can be set as an
environment variable should help control this explicitly when needed in
the future the same as how VAGRANT_VERSION is handled.
2021-09-11 14:32:42 +01:00
Darragh Bailey
b3ae12d5bc
Merge pull request #1332 from guss77/bugfix-package-domain
Fixed handling of nil volumes
2021-08-21 11:41:08 +01:00
Oded Arbel
bc1e6c3a8c added test for nil volume (verified that it fails without the bugfix) 2021-08-19 22:38:12 +03:00
Oded Arbel
3ec2128c3c fixed handling of nil volumes 2021-08-18 13:15:12 +03:00
Darragh Bailey
2e8df0fa1b
Merge pull request #1310 from chrisroberts/builtin-graceful
Use GracefulHalt builtin action
2021-08-14 00:17:44 +01:00
Darragh Bailey
2ae1421421 Ensure shutdown timeout adjusted if graceful halt fails 2021-08-14 00:13:44 +01:00
Chris Roberts
dd6b17ff9a Add coverage on the ShutdownDomain action 2021-08-14 00:12:58 +01:00
Chris Roberts
9acfd16dfc Add ShutdownDomain action and use during halt sequence
This adds in a ShutdownDomain action which allows for the
    GracefulHalt action to attempt to shutdown the domain. If
    it does not transition to domain successfully to a shutoff
    state, the ShutdownDomain action is used to "nicely" shutdown
    the domain. Likewise, if that action fails to transition the
    domain, the HaltDomain action will be used to forcibly stop it.
2021-08-14 00:12:58 +01:00
Chris Roberts
44d7c5526d Update HaltDomain spec to cover updated implementation 2021-08-14 00:12:58 +01:00
Chris Roberts
64d087d2f9 Use builtin GracefulHalt action on halt
Updates the halt action to use the GracefulHalt builtin action.
    If the GracefulHalt builtin action fails to properly transition
    the state of the guest, it will use the HaltDomain action to
    forcibly stop it.
2021-08-14 00:12:58 +01:00
Chris Roberts
32f69c5361 Update HaltDomain action to only forcibly halt domain 2021-08-14 00:12:58 +01:00
Darragh Bailey
cf51e451a0
Merge pull request #1331 from gmmephisto/fix-update-disk-bus
Fixes typo in start domain that would trigger an exception and prevent
adjustments to the disk bus from being applied.
2021-08-04 14:00:14 +01:00
Mikhail Ushanov
5019e282f2 fix(action): fix typo in change domain disk_bus
Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
2021-08-04 13:41:27 +03:00
Darragh Bailey
319c4f14c3
Merge pull request #1330 from dcermak/bump-rspec
Unrestrict rspec-* version to >= 3.5 to sync with vagrant
2021-08-04 08:56:11 +01:00
Dan Čermák
d6c603b163
Unrestrict rspec-* version to >= 3.5 to sync with vagrant
Vagrant recently bumped its minimum rspec version to 3.10. This commit
unrestricts the version so that the requirements from old and new vagrant
versions can be accommodated.
2021-08-04 09:27:14 +02:00
Darragh Bailey
4feb0424cd
Bump vagrant version and update README (#1321)
Update to the latest vagrant release and adjust README to align for
latest changes for the docker container.
2021-07-01 10:53:50 +01:00
Darragh Bailey
1f51841678
Use working directory for user/group resolution (#1320)
To handle where the ~/.vagrant.d global state directory for a user
doesn't exist, and thus specifying it as part of the docker run command
will result in the docker daemon creating it with root ownership.

Switch to using the working directory for user/group resolution,
searching for the Vagrantfile in the starting path and then working
up the tree. If it's not found default to the original starting path.

Combined with checking if the mounted vdir is empty, use the resolved
user/group based on the Vagrantfile and working directory to modify the
newly created directory to belong to the running user. Subsequently
ensure that the directories referenced via symlinks are created if they
don't exist.

Fixes: #1191
Closes: #1254
2021-06-30 17:56:09 +01:00
Darragh Bailey
18ebb9d9ed
Enable frozen string across project (#1319)
Turn on frozen string support in all files by using a comment to avoid
enabling across dependencies where it may not work.

Fixes: #1177
2021-06-30 13:27:03 +01:00
Darragh Bailey
6dac9c9054
Remove debug statement accidentally left behind (#1318)
Prune debug print statement added by #1308.
2021-06-29 13:51:29 +01:00
Darragh Bailey
1174685e7b
Basic packaging tests and restructure action (#1307)
Restructure action to remove custom handling around packaging of the
box and instead use more of the built-in provided actions instead.

Includes some packaging tests to cover both simple where the public
key is retained (can't modify the tinycore VM without more complex
provisioning steps), and a more complex one that utilizes a script
and supports triggering regenerating the hosts on subsequent boots.

The use of the upstream packaging helpers means that when the
default insecure ssh key has been replaced, the packaging process
will automatically include the generated key.

Fixes: #759
Fixes: #765
Fixes: #1013
Fixes: #994
2021-06-25 20:01:02 +01:00
Darragh Bailey
192eefcfbf
Default to build and publish extendible image (#1246)
Switch to publishing the image containing all of the libraries and build
dependencies needed to support the plugin being reinstalled as that is
the default behaviour when vagrant installs a new plugin.

This should allow the default image to be extended with additional
plugins and if needed, the authors of the new image may follow and use
the slim version as a base to provide a reduced size docker image.

Fixes: #1198
2021-06-25 19:28:17 +01:00
Darragh Bailey
8defd28871
Disable removal of host keys by default (#1315)
Testing has shown that most boxes do not have the hosts keys removed as
it is non trivial to get them to regenerate on subsequent bring up.
Additionally vagrant uses `StrictHostKeyChecking=no` to ignore the host
keys so relying on them to provide any kind of security or identity of a
VM is pointless.

In the few cases where it is possible to have keys regenerate it should
be managed by how the box is cleaned up, and otherwise forced by a
provision script on first boot of the VM.

While it is possible to have a script executed via sysprep modify the
boot of the machine to ensure the keys are regenerated on the next boot,
this should either be built-in to occur automatically, and there by
assume the responsibility for ensuring host keys are replaced for each
VM packaged by vagrant-libvirt, or should default to the same behaviour
that appears to be common for many debian based boxes and simply not
attempt to remove the host keys. If removal is useful, it may be
re-enabled as needed. See #851 for a script that can be used to have
openssh-server reconfigured to trigger regenerating the keys.

A number of people have tried to fixed this previously and I failed to
understand then that they were correct. Have attributed co authorship of
this to all of the PRs authors that attempted to fix this over the
years.

Related: #759
Related: #873
Related: #955
Related: #994

Co-authored-by: Guillaume Penaud <gpenaud@xilopix.com>
Co-authored-by: Zak B. Elep <zakame@zakame.net>
2021-06-25 11:30:59 +01:00
Darragh Bailey
06fef8ba46
Allow rspec to float on minor releases (#1316)
To ensure the tests can be run across multiple vagrant releases, must
allow newer rspec minor releases. As these are for development, it
should be alright to allow a wider range.
2021-06-25 11:20:59 +01:00
Darragh Bailey
1e4eeb6f8b
Merge pull request #1309 from yamatoRT/dev/bugfix-1308
Uses the json output of qemu-img info for read virtual size of disk.
Adds new ByteNumber for convert the virtual size to gygabyte, byte
and megabyte. Internally virtual size is now byte and not gigabyte.
2021-06-11 22:32:29 +01:00
Richard Turc
00cd79aa35 Use qemu-img json output and compute virtual size #1308 2021-06-11 16:38:35 +02:00
Darragh Bailey
e9f5f028a3
Ensure open3 required and qemu-utils in docker (#1306)
Depending on load order of libraries as well as version of ruby, need to
require open3 before attempting to reference `Open3`.

There is an additional dependency on qemu-utils to dynamically retrieve
the image information to provide the virtual size and format
automatically. Add this to the docker image to ensure it's available for
users of this distribution format.

Fixes: #1305
2021-06-07 15:31:18 +01:00
Darragh Bailey
af738b84eb
Merge pull request #1304 from s-vx/patch-1
Fix minor typo in README.md
2021-06-04 20:14:32 +01:00
s-vx
e6c68358cf
Fix minor typo in README.md 2021-06-04 13:10:53 -04:00
Darragh Bailey
31cc8aa91e
Add basic vagrant package integration test (#1302)
Simple integration test for vagrant package to ensure the execution
completes successfully to allow for some refactoring to be performed.

Ensure libguestfs-tools installed to provide virt-sysprep for tests and
update docs to reflect.
2021-06-01 17:45:02 +01:00
Darragh Bailey
dbbfad2503
Generate test matrix dynamically from bats (#1303)
Extract the tests to be run and generate the matrix dynamically to avoid
needing to update the list within the workflow for each test added.
2021-06-01 17:21:15 +01:00
Darragh Bailey
0c35a1e275
Vagrant up expects machine data_dir to exist afterwards (#1298)
Ensure the machine data_dir is recreated after removal because vagrant
up expects the directory to exist even if there has been an exception
and the machine has been deleted subsequently.
2021-05-28 15:40:34 +01:00
Darragh Bailey
199bfe19f9
Provide Vagrantfile path in description by default (#1299)
Ensure the source Vagrantfile appears in the virtual machine description
to help people using virsh/virt-manager subsequently to understand where
machines have come from.

Fixes: #496
2021-05-28 14:46:57 +01:00
Darragh Bailey
994f95e24f
Handle extraction of keyfile from uri (#1297)
If the keyfile is specified as part of the URI provided, extract it and
set the appropriate option so that it can be provided to the proxy
command subsequently.
2021-05-27 18:28:12 +01:00
Darragh Bailey
daa8f8af55
Handle custom port for remote libvirt (#1296)
Extract the port number from the parsed URI as part of finalizing the
uri and associated options. Don't expose this as a separate item to be
set as it can be passed in as part of the host entry.

Closes: #789
2021-05-27 17:28:25 +01:00
Darragh Bailey
3ff5795528
Add myself to the gem authors (#1295)
So that it's reflected on rubygems.org, add myself to the gem authors.
2021-05-27 17:09:32 +01:00
Darragh Bailey
5fdda391e2
Merge pull request #1294 from rgl/rgl-add-public-network-boot
add support for boot 'network' from a vagrant public_network
2021-05-27 10:42:44 +01:00
Rui Lopes
c96364575a add pxe boot public_network example 2021-05-27 07:42:04 +01:00