Commit Graph

1492 Commits

Author SHA1 Message Date
dependabot[bot]
2b9a0cc83d Bump rack from 2.2.6.2 to 2.2.6.4 in /docs (#1728) 2023-04-22 13:50:45 +00:00
dependabot[bot]
e612fa953c Bump actions/upload-artifact from 2 to 3 (#1726) 2023-04-22 13:30:05 +00:00
Darragh Bailey
b153539c90 Ensure tests block if a single matrix job fails (#1730)
Github will drop a required check if the job is skipped. This can happen
if a job is placed after a matrix execution with the intent to act as
the
required status check as well as complete a coverage report for this
repo.
2023-04-22 13:13:17 +00:00
Holger Finger
cb051a8277 specify qcow2 compatibility version to not use very old 0.10 fallback (#1731)
Libvirt creates qcow2 volumes with very old `compat` version `0.10` if
no `compat` version is specified in the xml (see
[here](https://libvirt.org/formatstorage.html#id11)). It seems libvirt
has backwards compatibility reasons to still use `0.10` if nothing is
specified in the xml.

Unfortunately this has the effect that VMs created by vagrant-libvirt
are using the 10 year old `0.10` qcow2 version, instead of the `1.1`
version that has **better performance and stability fixes**.
This is even happening when the backing file of the vagrant box is in
compat `1.1` format.

This is the `qemu-img info` of the backing file provided by the vagrant
box:
```
# qemu-img info /var/lib/libvirt/images/vagrant_box_image_0_box.img
[...]
Format specific information:
    compat: 1.1
    [...]
```
Although the backing file provided by the box is using compat `1.1`, the
created volume by vagrant-libvirt has only compat `0.1` as shown here:
```
# qemu-img info /var/lib/libvirt/images/vagrant-01-test_default.img
[...]
backing file: /var/lib/libvirt/images/vagrant_box_image_0_box.img
Format specific information:
    compat: 0.10
    [...]
```

With this MR, the volume of the VM will use the same `compat` version as
provided by the backing image of the vagrant box.
If `qemu-img info` does not return a `compat` flag, it falls back to the
very old `0.10` version.
2023-04-22 14:03:21 +01:00
kdunn926
f6126464f1 Feature: Allow specifying type for primary disk (#1729)
This PR has changes to allow specifying the `type` for
`disk_driver`, rather than hardcoding it to `qcow2`.
2023-04-22 13:43:38 +01:00
Conner Crosby
9e7d0f3ec8 Fix duplicate provisioning of running VMs (#1722)
Remove duplicate inclusion of Provision middleware when up is called
on an running machine resulting in a double provision.

Includes a unit test update to ensure expected actions are only called
once as well as a regression for calling up on a running machine.

Fixes #1710.
2023-02-16 18:13:31 +00:00
Darragh Bailey
33962dd40b Allow a mock object to receive synced_folders in config validation spec. (#1721)
This was found while updating the vagrant-libvirt package to 0.11.2 in
Fedora, where we use qemu:///session by default and run the tests with
that instead of qemu:///system from config files.
2023-02-13 17:02:16 +00:00
Jarek Prokop
75da39aba4 Allow a mock object to receive synced_folders in config validation spec.
When using qemu session, the config is checked
if there are 9p synced folders.
We do not care about synced folders when we want to check
if the MAC address is defined correctly.

The result is a failure from the mock object:
`#<Double "vm"> received unexpected message :synced_folders with (no args)`
2023-02-13 17:36:00 +01:00
dependabot[bot]
8fa764fd8a Bump github-pages from 227 to 228 in /docs (#1718) 2023-02-07 22:37:48 +00:00
dependabot[bot]
b6b2ad6dda Bump docker/build-push-action from 3 to 4 (#1719) 2023-02-07 17:18:52 +00:00
Darragh Bailey
b8afc8cae8 Try using ruby 2.7 for jekyll docs generation (#1720) 2023-02-07 16:38:59 +00:00
Darragh Bailey
1a59f0ddd8 Update doc generation to use ruby 3.1 (#1717) 2023-02-05 14:56:22 +00:00
Darragh Bailey
03f7bb7e31 Add feature-complete /domain/clock support (#1715)
Feature reference: https://libvirt.org/formatdomain.html#time-keeping
2023-02-05 13:03:46 +00:00
Bart Kus
2213314a5c Add a validator to prevent conflicting clock configs
This is a second layer of protection, to make the behavior minimally
surprising for the user.  The implementation of clock_* handlers follows
a precedence decision order in case of conflict, but that shouldn't be
relied on as the only layer of defense against bad configs.
2023-02-01 10:40:15 -08:00
Bart Kus
78e46979e0 Add feature-complete /domain/clock support
Feature reference: https://libvirt.org/formatdomain.html#time-keeping
2023-01-26 00:47:15 -08:00
Darragh Bailey
6b907ab6e0 Use append to a truncated file to retain owner (#1677)
Change the default behaviour when logging output from the console to a
file to ensure the file is pre-created and unless append is explicitly
set to true in the source config, truncate the file. Combined with
having the domain template default to enabling append, this causes
libvirt/qemu to not attempt to create the file and thus retains the
owner/group and permissions of the original file.

Relates-to: #1385
2023-01-22 21:22:29 +00:00
dependabot[bot]
9aab9b7d03 Bump rack from 2.2.4 to 2.2.6.2 in /docs (#1707) 2023-01-22 21:11:49 +00:00
Arjen Verstoep
81ea287835 Make NIC model type for management interface configurable (#1711)
This change adds a configuration option for setting the NIC model type for
the management interface, which defaults to `virtio` (the current value)

The context for this change is that I was having severe speed issues
with `virtio` (which have now disappeared, probably after a QEMU update)
and the `e1000e` NIC was doing much better.
2023-01-22 15:23:47 +00:00
Darragh Bailey
0d2b2fcd02 [Fix] forward_ports.rb: no implicit conversion of String into Array (#1706)
Fixes a TypeError due to attempting to add a string to an array instead of
appending as a new element when gateway ports are set.
2023-01-22 14:00:54 +00:00
Babacar TALL
c9cb598d70 [Fix] forward_ports.rb@redirect_port: no implicit conversion of String into Array (TypeError) 2023-01-19 17:20:42 +00:00
Arjen Verstoep
98e674d270 Fix issue where "iommu" was configured for non-virtio network devices (#1702)
When setting the `model_type` of a network to something else than
`virtio`, the `iommu` parameter was still set for the device which isn't
allowed.

The if-statement for setting the parameter was looking at the default NIC
model type (in `@nic_model_type`) instead of final, configured value in `@model_type`.
2023-01-19 15:29:55 +00:00
Darragh Bailey
d4520bedb5 bundle exec rspec fix for ruby3.2 (#1709)
Replace File.exists? with File.exist? and
set empty host when nil on finalize_from_uri

Closes #1708
2023-01-19 15:21:27 +00:00
Mamoru TASAKA
578d3ae429 Set empty host when nil on finalize_from_uri
With ruby3.2, URI.parse now sets empty host instead of nil via:
dd5118f852

Adjust test case so, also with ruby <= 3.1, forcely set empty string for host
when nil to make finalize_from_uri behavior consistent between different
host ruby versions.
2023-01-19 17:07:39 +09:00
Mamoru TASAKA
517bf7792a Replace File.exists? with File.exist?
File.exists? is deprecated since ruby2.1 and is removed with ruby3.2.
Replace with File.exist? .
2023-01-19 16:39:17 +09:00
Yevgeniy Kuksenko
ee06cd0a22 Support setting mtu on public interfaces (#1700)
Setting mtu on management and private interfaces is supported. It should
also be supported on public interfaces.
2022-12-23 11:10:33 +00:00
dependabot[bot]
748e2ccb77 Bump nokogiri from 1.13.9 to 1.13.10 in /docs (#1697) 2022-12-15 15:49:54 +00:00
Darragh Bailey
7f7706fe82 Create codeql.yml (#1698) 2022-12-15 14:04:42 +00:00
Darragh Bailey
0755974be0 Avoid creating extra connection mocks unless needed (#1696)
Remove duplication of connection/machine mocks except for the tests
exercising multi machine related tests.
2022-12-14 14:16:54 +00:00
Darragh Bailey
d8c8d3d85f Support setting iface name for target dev on private networks (#1692)
Allow for iface_name to be set on public_network configurations to
control the name of the interface created by libvirt. This overrides the
default that would be created automatically, but cannot use a reserved
name as it will be ignored.

Closes: #799
2022-12-11 11:21:34 +00:00
Darragh Bailey
1741ee2f6d Use configured_networks helper in validate (#1695)
Switch to configured networks helper in validate to ensure that that the
validation checks the final list of networks that will be used, not just
those initial configured.

This will help ensure the management network is validated in addition to
the user specified networks.
2022-12-09 17:10:33 +00:00
Darragh Bailey
7a8306745b Handle autoport when port explicit set (#1693)
Better handle setting the autoport value when the port is explicitly set
to ensure that the XML sent to update the VM is correct and will be the
XML that is reflected in the defined machine.

By prioritizing checking if the port is provided, graphics_autoport =
"yes" is ignored.

Fixes: #1687
2022-12-09 07:48:08 +00:00
Darragh Bailey
1733e1cc19 Drop testing against ruby 2.2 for vagrant 2.0.4 (#1694)
Vagrant 2.0.4 no longer appears in any supported release of a distro,
therefore drop testing of it in CI along with the version of ruby
needed.
2022-12-08 23:17:54 +00:00
Darragh Bailey
e0b17b34f5 Ensure iommu XML is only set for virtio nics (#1690)
Skip setting iommu option on the drive unless it's for virtio model type
nics.

Fixes: #1688
0.11.2
2022-12-04 16:19:43 +00:00
Darragh Bailey
5f324e9cf3 Include resume domain spec missed (#1689)
Add the resume domain spec tests missed when updating to support
pmsuspended.
2022-12-04 15:54:34 +00:00
Darragh Bailey
431cf867ba Handle pmsuspended resume and add state translation message (#1686)
Ensure there is a translation message for state and call the correct
wakeup depending on which form of suspend/pause the machine is in.

Closes: #1200
2022-12-03 08:05:58 +00:00
Darragh Bailey
612eb67f5f Correct destroy method call logic (#1684)
Actual implementation of the flags behaviour was different than the code
expected. Update to use the correct behaviour.
0.11.1 0.11.0
2022-12-02 00:08:12 +00:00
Darragh Bailey
1f6309b0bf Add docs to install latest development version (#1683)
Provide directions in both the issue template for bug reports and in the
main README to help users install the very latest development version of
the plugin.

Include a warning about the token getting embedded in the vagrant
plugins.json file.
2022-12-01 23:33:50 +00:00
Darragh Bailey
07e4a69a50 Ensure dependency on ip tool is satisfied (#1681)
Additionally ensure that the default docker run commands allow vagrant
to request user input by allocating a tty.
2022-11-24 10:48:45 +00:00
Darragh Bailey
6bbde74be0 Ensure acceptance tests are executed (#1680)
Ensure the acceptance tests are actually executed and resolve any issues
that have crept in since they were not running as expected.

Call the ResolveDiskSettings on reload to ensure that the start domain
action will have all of the necessary configuration for any additional
storage disks added.

Tidy up create domain output when disks are attached.

Fixes: #1678
2022-11-23 17:33:10 +00:00
Darragh Bailey
f25a375d18 Clear and create forwarded ports on suspend/resume (#1679)
Ensure forwarded ports are cleared on suspend and recreated on resume.
Included tests to exercise the entire up/start behaviour to ensure the
expected actions are called in various scenarios, moving config validate
to only occur at the entrypoints and dropping it from being called
during start. Also eliminate a duplicate SetupComplete call.

Fixes: #1115
2022-11-23 13:44:32 +00:00
David Davis
451c6f6c53 Add libvirt-dev to Ubuntu install (#1676)
Installation of vagrant-libvirt requires the libvirt-dev package.
2022-11-21 11:15:24 +00:00
Uli Fahrer
0363459bec feat: add websocket graphics config (#1672)
This adds websocket functionality for VNC. The websocket attribute may 
be used to specify the port to listen on (with -1 meaning 
auto-allocation and autoport having no effect due to security reasons).
2022-11-21 11:05:51 +00:00
Bram de Greve
6c4b7758aa Adding disk_address_type option. (#954)
This patch allows to specify the virtio-mmio address type, which is
needed for debian guests on virt machines that don't support the PCI
address type.

See also 
https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/
where it is explicitly said to use `virtio-blk-device` and
`virtio-net-device` instead of `virtio-blk-pci` and `virtio-net-pci`, for
that reason.

Apparently, libvirt will use the `virtio-blk-pci` and `virtio-net-pci`
by default. By setting address type to `virtio-mmio`, it uses
`virtio-blk-device` instead. It seems not necessary to do the same for
the network controller, since libvirt will also use `virtio-net-device`
if the disk address type is set to `virtio-mmio`.

While this should help with ARM machines, it won't solve all issues
as some machines will boot perfectly with the existing defaults
provided the correct loader binary is used.

Relates-to: #1608
2022-11-14 12:52:22 +00:00
Darragh Bailey
df41f6f037 Ensure default public_network :dev shown on error (#1670)
During validation ensure that the default value for public network
devices is selected and shown on error if it's not one of the host
devices that are currently discovered.
2022-11-10 18:49:46 +00:00
Darragh Bailey
980db1049a Adding SEV support (#1664)
Secure Encryption Virtualization is supported by libvirt and this
change adds support for vagrant-libvirt to enable it.

It requires a UEFI base box and needs a combination of options to be
configured for it to work.

Co-authored-by: PELLET Norman <norman.pellet@csem.ch>
Co-authored-by: MUNTANÉ CALVO Enric <emc@csem.ch>
Co-authored-by: Darragh Bailey <daragh.bailey@gmail.com>
Closes: #1372
2022-11-10 12:22:37 +00:00
Darragh Bailey
4fe53477b2 Support running tests in parallel (#1667)
To allow for faster execution of the unit tests locally, allow running
them in parallel.
2022-11-08 16:28:32 +00:00
Darragh Bailey
1c7e9d8bd0 Use ruby 3.1.2 by default for development (#1666)
Update to recent ruby for main development env.
2022-11-08 15:21:04 +00:00
Darragh Bailey
4be8c8ada4 Include distro matrix status badge from qa project (#1665) 2022-11-07 14:53:13 +01:00
Darragh Bailey
cb93b5a168 Tweak fedora installation instructions (#1663)
To ensure dependencies are installed from fedora install
of directly from rubygems, restore retrieval of the
dependencies from repositories, with adjustments now
that vagrant-libvirt is marked as disabled.
2022-11-06 13:38:33 +00:00
Darragh Bailey
d384e63235 Reject cpu features enabled without model (#1658)
Recent Libvirt will silently drop cpu features set without a model
defined. Ensure this scenario is flagged as being invalid up front.

Fixes: #996
2022-11-04 17:21:42 +00:00