Commit Graph

1516 Commits

Author SHA1 Message Date
castorsky
a94ce0d7b6
Add support for qemu-img v8 to create_box.sh (#1790)
Since version 8 of qemu-img tool it produces more verbose JSON-output
with multiple `virtual-size` keys which leads to incorrect generation of
`metadata.json` file (all values of `virtual-size` are placed into file
and it becomes non-valid JSON).

This behavious was described in #1746 .

Example of old JSON output:
{
    "virtual-size": 34359738368,
    "filename": "vm-100-disk-0.qcow2",
    "cluster-size": 65536,
    "format": "qcow2",
    "actual-size": 2941440,
    "format-specific": {
        "type": "qcow2",
        "data": {
            "compat": "1.1",
            "compression-type": "zlib",
            "lazy-refcounts": false,
            "refcount-bits": 16,
            "corrupt": false,
            "extended-l2": false
        }
    },
    "dirty-flag": false
}

Example of new JSON output:
{
    "children": [
        {
            "name": "file",
            "info": {
                "children": [
                ],
                "virtual-size": 42956488704,
                "filename": "/var/lib/libvirt/images/proxmox_6.4.qcow2",
                "format": "file",
                "actual-size": 1305301504,
                "format-specific": {
                    "type": "file",
                    "data": {
                    }
                },
                "dirty-flag": false
            }
        }
    ],
    "virtual-size": 42949672960,
    "filename": "/var/lib/libvirt/images/proxmox_6.4.qcow2",
    "cluster-size": 65536,
    "format": "qcow2",
    "actual-size": 1305301504,
    "format-specific": {
        "type": "qcow2",
        "data": {
            "compat": "1.1",
            "compression-type": "zlib",
            "lazy-refcounts": true,
            "refcount-bits": 16,
            "corrupt": false,
            "extended-l2": false
        }
    },
    "dirty-flag": false
}

This change adds comatibility in a fast-fix-way: awk regex gets in account
only `virtual-size` key on the first level of `qemu-img info`
JSON-output.
2023-12-27 21:45:00 +00:00
dependabot[bot]
cf37fd44f6
Bump actions/upload-artifact from 2 to 3 (#1772) 2023-09-07 17:32:54 +00:00
dependabot[bot]
1a19f88556
Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3 (#1764) 2023-09-07 15:01:09 +00:00
y-hashida
b8c2f14435
Allow non drvfs on wsl environment (#1755) 2023-09-07 15:42:51 +01:00
Darragh Bailey
42429f7ba4
Add acceptance tests around halt behaviour (#1773)
Ensure acceptance tests capture halt behaviour to prevent future
regression around graceful and forced halt.

Related-to: #1765
2023-09-07 15:40:29 +01:00
Darragh Bailey
271ca70da7
Ensure publish docs runs on workflow changes (#1771)
Include dependent workflow and github action as part of the path check
for when to trigger the workflow.
2023-08-30 11:14:20 +01:00
Darragh Bailey
abf8e68505
Update deploy-docs.yml (#1770)
Correct inputs syntax
2023-08-29 21:47:00 +00:00
Darragh Bailey
4687a9be0d
Use correct syntax for reusable workflows (#1769) 2023-08-29 21:40:30 +00:00
Darragh Bailey
2b5ba02227
Ensure deploy docs workflow callable (#1768)
Checkout current repository in order to call the reusable workflow.

Remove the now duplicated checkout from the called workflow.
2023-08-29 20:49:00 +00:00
Kristupas Antanavicius
574de06f4f
Poweroff domain on vagrant halt -f (#1766)
`vagrant halt -f` is supposed to poweroff the domain without attempting
graceful shutdown. Before, `vagrant halt -f` was attempting to send ACPI
and waiting for timeout before actually powering off the domain.

Fix a bug where ACPI timeout code would cause an exception to be thrown,
instead of setting :result to false and proceeding to poweroff the
domain.

The before behaviour:

`vagrant halt`:
    - attempt graceful shutdown (/sbin/shutdown)
        ERROR: next action
    - attempt sending ACPI (domain.shutdown)
        ERROR: timeout exception

`vagrant halt -f`:
    - attempt sending ACPI (domain.shutdown)
        ERROR: timeout exception

The after behaviour:

`vagrant halt`:
    - attempt graceful shutdown (/sbin/shutdown)
        ERROR: next action
    - attempt sending ACPI (domain.shutdown)
        ERROR: next action
    - poweroff the machine (domain.poweroff)
        ERROR: hopefully never

`vagrant halt -f`:
    - poweroff the machine (domain.poweroff)
        ERROR: hopefully never

Fixes #1765
2023-08-29 20:43:01 +01:00
dependabot[bot]
f5e22f8547
Bump commonmarker from 0.23.9 to 0.23.10 in /docs (#1758) 2023-08-29 15:19:57 +00:00
Darragh Bailey
2cb600388b
Ensure extra docs config is appended (#1767)
Use of tee requires the argument '-a' to append, as current behaviour
will result in replacing the contents which is not intended. The config
settings should be in addition to the configured values.
2023-08-29 16:03:48 +01:00
Darragh Bailey
06fa756b98
Update publish docs workflows (#1762)
Switch to standard workflow for building the documentation from pull
requests and use a workflow call to trigger the deployment for write
access. This should limit the ability to compromise documentation site
from forked PRs while allow validation of dependency changes as well as
more of the actions that impact the deploy.
2023-08-28 20:41:36 +01:00
Darragh Bailey
1783e762d5
Revert "Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3" (#1760)
Reverts vagrant-libvirt/vagrant-libvirt#1751
2023-08-15 23:18:50 +00:00
dependabot[bot]
13acc0500b
Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3 (#1751) 2023-08-15 12:09:19 +00:00
Darragh Bailey
1ebfacf979
Adjust groups to reduce test dependencies (#1748)
Switch around the groups defined in the Gemfile to allow execution
without installing additional tools that are useful for development but
not needed for testing or packaging.
2023-08-15 11:19:09 +00:00
Anabelle
284b52f57c
Fix broken links (#1756)
Four links on the doc-site's homepage are 404'ing because their
href/URI's fragment identifier is preceded with a /.

Removal of the extra slash fixes.

Closes: #1759
2023-08-15 11:09:11 +00:00
Darragh Bailey
844e2bb989
Update docs source path (#1754)
Update docs to fix edit link to refer to the correct path.

Fixes: #1752
2023-07-18 23:11:57 +01:00
dependabot[bot]
448ed69f0c
Bump JamesIves/github-pages-deploy-action from 4.4.1 to 4.4.2 (#1745) 2023-06-20 22:13:28 +00:00
Darragh Bailey
889b13d636
Handle nic model type updating during start (#1747)
Start domain added some support to update the nic model type if it
changed to avoid needing to completely destroy and recreate the domain.
Additionally support for setting the management network nic model type
was added, however the default value did not correctly reflect expected.

This updates `management_network_model_type` to default to
`nic_model_type`, which in turn defaults to `virtio`. This has now been
moved from the create network interfaces action into the config object
to allow chained resolving. This should ensure that setting
`nic_model_type` will correctly cause all networks to use the model
unless explicitly specified to use a different model.

Additionally the start domain action for updating the interfaces has
been modified to loop over all interfaces and all configured adapters in
the order they should have been added. This allows for checking whether
the model type needs to be updated based on the
`management_network_model_type` config option for the first network,
assuming the management network has been attached, and otherwise to fall
back to the default from `nic_model_type` for all other interfaces.

Finally ensure the iommu attribute is removed from the nic driver if
the model type is switched to anything other virtio to avoid issues with
attempting to enable invalid settings.

Fixes: #1743
2023-06-20 15:46:05 +01:00
mattkeeler
df1dd25e1e
Update libvirt anchor links in documentation (#1741)
Many of the libvirt anchor links in the docs are out of date. This PR
updates those.
2023-05-07 09:50:45 +01:00
Darragh Bailey
99ac328621
Support iface_name setting for management network (#1739)
Allow setting the interface name that appears on the host for the
management network interface in the guest. This allows for more complex
networking layouts by allowiing matching against devices for vlan
configurations.

Fixes: #1701
2023-05-01 13:12:14 +00:00
dependabot[bot]
768e18f086
Bump nokogiri from 1.14.1 to 1.14.3 in /docs (#1733) 2023-04-22 18:05:55 +00:00
dependabot[bot]
0be30d3ae2
Bump commonmarker from 0.23.8 to 0.23.9 in /docs (#1732) 2023-04-22 16:46:12 +00:00
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