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
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
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>
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.
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.
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.
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.
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.
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: #1191Closes: #1254
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: #759Fixes: #765Fixes: #1013Fixes: #994
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
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>
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.
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.
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
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.
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.
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
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.
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