Reject any 9p synced folders that the user does not have read access to
the host path where using qemu sessions. This is because the VM will
launched with the user permissions instead of system permissions and
will fail to come up if trying to add a path that is not readable to be
mounted into the guest.
Additionally flag that virtiofs may not be supported with qemu sessions,
but do not reject in case support is added in the future.
Fixes: #1430
To allow for a different ssh port to be used when connecting to a
machine for NFS setup, use the port provided in the ssh_info hash
with a fallback to the default ssh port.
This may allow NFS mounting into Windows guests once support is added to
vagrant itself to handle NFS installation.
Fixes: #1640
Move the unit context to a name matching the other contexts. Remove some
unnecessary entries from it that are unused, and remove references to
the old name relying on spec helper to load all contexts.
If the graphics type is set to spice, then skip setting the autoport as
the attribute will be discarded by libvirt causing it to appear as
though not all of the XML sent to start the domain was accepted.
Ensure the same filtering for networks supported by vagrant-libvirt is
done for both driver and util by moving to call the same function with
filtering.
This avoids calls for the list of host devices from failing to parse
some networks that are not supported.
Fixes: #599
Save the triggering PR as an artifact when building the gem as it will
be required by the triggered workflow to determine the PR that triggered
it since Github does not populate the event data if the PR is a forked
PR.
Adds workflow to publish a link to the gem artifact built for the
current PR. Allows for contributors or those impacted by issues to have
an easier test mechanism.
If the network does not have a bridge name, ignore it and move onto the
next one. This allows for hostdev networks to exist without breaking.
Includes some rudimentary testing to exercise the lookup code along with
a small bit of refactoring based on the realisation that there is no
need to lookup the network information twice as it is available if the
list_all_networks API is used.
Fixes: #599
On some distros the libvirt does not appear to always return all of the
host interfaces. Switch to using 'ip -j link show' to read them directly
from the system in order to ensure all devices are read.
Refactor the driver tests to better isolate between test setup for the
different sets of functions and avoid accidental setting of
configuration details that may not be obvious.
Fixes: #1624
Depending on the installed packages present on the host system, vagrant
may select either nfs or rsync as the default synced_folder
implementation.
Fixes: #419
Reduce the number of other graphics settings that need to be adjusted
once the type has been set to spice by defaulting the remaining options
to ones better suited for spice, in addition to adding the required
channel automatically.
Fixes: #1482
Ensure the development steps can be successfully executed with system
ruby on Fedora 36 to try and help new contributors have an easier
on-ramp.
Support running acceptance tests locally, though note that it may
require rvm if vagrant doesn't support the ruby version used by the
distro.
Allow libvirt to start the domain before reading back the XML to
retrieve the port assigned automatically for subsequent graphics access
when autoport is enabled.
Fixes: #992
Ensure the bootmenu is disabled by default. When not specified it will
default to the hypervisor default behaviour, however this is not
necessarily defined consistently across different distros. Therefore for
a consistent behaviour, simply ensure it is always configured to be off,
unless explicitly required to be enabled when the boot order is
configured.
Fixes: #947
Provide a simple working example of how to set the kernel, initrd,
cmdline options and where to retrieve the required files when working
with disk images.
Fixes: #920
The 9p synced folder option :owner is better named as :access, which is
documented by 9p and less likely to cause confusion on the expected
behaviour as it does not control the owner of the files.
Relates-To: #378
The driver is created with a specific machine instance, use this in
stead of requiring a specific instance be passed in. Apply the same
approach to domain where possible which allows the same get ip address
function to be called with and without a domain being passed in to save
lookup during loops.
Allowing synced folders to be validated as part of the action tests can
cause an excessive amount of time to be consumed due to many calls to
systemd and distro packager to check if nfs is available on the host.
Change the release workflow and jobs to ensure more of it is always
exercised for any change and only the actual publishing of the release
is the only part that is limited to be run when tagged.
Additionally try to enable caching and save the generated notes as an
artifact in case the final step fails.
Normalise the XML to ensure the attributes for both documents have the
same ordering to prevent excessive noise when differences are detected.
Additionally sort various elements based on attributes that make
ordering irrelevant to allow for simpler comparison using xmlsimple.
Closes: #1583
Reference the correct download URL in the installation documents for
retrieving the install script from the vagrant-libvirt-qa repository.
Fixes: #1601
Multi-line RUN instructions are unsupported by default docker (works
with buildkit) and buildah, instead one has to use other tricks like
ANSI-C quoting for the shell via \n\ and multiple echo commands.
Includes a buildah github workflow to help ensure future
compatibility.
Updating the behaviour to only warn on the XML differing instead of
erroring missed updating the spec tests to replace the check for the
error message with a warn message.
When using `qemu_use_agent = true`, the provisioning of a Windows
machine was faling to get the IP address with the error:
```
`get_ipaddress_from_qemu_agent': undefined method `downcase' for nil:NilClass (NoMethodError)
```
```plain
Traceback (most recent call last):
18: from /opt/vagrant/embedded/gems/2.3.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
17: from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/action/builtin/wait_for_communicator.rb:16:in `block in call'
16: from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/plugins/communicators/winrm/communicator.rb:31:in `wait_for_ready'
15: from /opt/vagrant/embedded/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
14: from /opt/vagrant/embedded/lib/ruby/2.7.0/timeout.rb:33:in `catch'
13: from /opt/vagrant/embedded/lib/ruby/2.7.0/timeout.rb:33:in `catch'
12: from /opt/vagrant/embedded/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
11: from /opt/vagrant/embedded/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
10: from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/plugins/communicators/winrm/communicator.rb:37:in `block in wait_for_ready'
9: from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/plugins/communicators/winrm/helper.rb:21:in `winrm_info'
8: from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/plugins/communicators/winrm/helper.rb:35:in `winrm_address'
7: from /opt/vagrant/embedded/gems/2.3.0/gems/vagrant-2.3.0/lib/vagrant/machine.rb:452:in `ssh_info'
6: from /home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/provider.rb:58:in `ssh_info'
5: from /home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/provider.rb:98:in `state'
4: from /home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/driver.rb:194:in `state'
3: from /home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/driver.rb:103:in `get_domain_ipaddress'
2: from /home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/driver.rb:242:in `get_ipaddress_from_qemu_agent'
1: from /home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/driver.rb:242:in `each'
/home/rgl/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.10.7/lib/vagrant-libvirt/driver.rb:243:in `block in get_ipaddress_from_qemu_agent': undefined method `downcase' for nil:NilClass (NoMethodError)
```
This is due to Windows qemu-ga reporting interfaces that do not have a
`hardware-address`. For example, the `Loopback Pseudo-Interface 1` does
not have it:
```console
$ virsh qemu-agent-command openwrt-vagrant-windows '{"execute":"guest-network-get-interfaces"}' --pretty
{
"return": [
{
"name": "Ethernet 2",
"ip-addresses": [
{
"ip-address-type": "ipv4",
"ip-address": "10.0.20.11",
"prefix": 24
}
],
"statistics": {
"tx-packets": 3090,
"tx-errs": 0,
"rx-bytes": 50713786,
"rx-dropped": 0,
"rx-packets": 35116,
"rx-errs": 0,
"tx-bytes": 744040,
"tx-dropped": 0
},
"hardware-address": "08:00:27:00:00:0b"
},
{
"name": "Loopback Pseudo-Interface 1",
"ip-addresses": [
{
"ip-address-type": "ipv6",
"ip-address": "::1",
"prefix": 128
},
{
"ip-address-type": "ipv4",
"ip-address": "127.0.0.1",
"prefix": 8
}
],
"statistics": {
"tx-packets": 0,
"tx-errs": 0,
"rx-bytes": 0,
"rx-dropped": 0,
"rx-packets": 0,
"rx-errs": 0,
"tx-bytes": 0,
"tx-dropped": 0
}
}
]
}
```
With this change, the IP address can now be found without errors:
```plain
...
windows: WinRM address: 10.0.20.11:5985
windows: WinRM username: vagrant
...
```
- the sysprep.sh script was not executable (flagged by rpmlint)
- Need to explicitly `require 'tmpdir'` in `spec_helper.rb` on openSUSE
Tumbleweed,
otherwise you get tons of failures like:
```
An error occurred while loading ./spec/unit/action/prepare_nfs_settings_spec.rb.
Failure/Error: temp_dir = Dir.mktmpdir("rspec-")
NoMethodError:
undefined method `mktmpdir' for Dir:Class
temp_dir = Dir.mktmpdir("rspec-")
^^^^^^^^^
Did you mean? mkdir
# ./spec/spec_helper.rb:44:in `block in <top (required)>'
# ./spec/spec_helper.rb:41:in `<top (required)>'
# ./spec/unit/action/prepare_nfs_settings_spec.rb:3:in `require'
# ./spec/unit/action/prepare_nfs_settings_spec.rb:3:in `<top (required)>'
```
the message fills the screen with expected warnings messages
when we need to debug this problem the message is already logged, so
there is no need to show it in the normal case
these are the warning messages that were displayed:
```
==> debian: Waiting for domain to get an IP address...
Unable to receive IP via qemu agent: [Call to virDomainQemuAgentCommand failed: Guest agent is not responding: QEMU guest agent is not connected]
...
==> debian: Waiting for machine to boot. This may take a few minutes...
Unable to receive IP via qemu agent: [Call to virDomainQemuAgentCommand failed: Guest agent is not responding: QEMU guest agent is not connected]
...
```