Commit Graph

45268 Commits

Author SHA1 Message Date
Tim Wiederhake
8c6e726f7d datatypes: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
61d51f2d15 vbox_common: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
a38f4d53f8 qemu_agent: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
dd057af7ae node_device_udev: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
86f048c85e interface_backend_netcf: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
29bb566a22 node_device_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
1e4d85af32 bridge_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Tim Wiederhake
bc2d929e95 virnetdaemon: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
Andrew Melnychenko
4e4def21d3 qemu_command: Generate cmd line for virtio-net.rss hash properties
Also, validate that the requested feature is supported by QEMU.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:30 +02:00
Andrew Melnychenko
7ab013655d qemu_capabilities: Add capability for virtio-net "rss" and "hash".
Introduce QEMU_CAPS_VIRTIO_RSS capability which tracks
virtio-net.rss attribute introduced in qemu-5.2.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:29 +02:00
Andrew Melnychenko
a8b1cbe77e domain_conf: Add configs for virtio net RSS and Hash report.
Added "rss" and "rss_hash_report" configuration that should be
used with qemu virtio RSS. Both options are triswitches. Used as
"driver" options and affects only NIC with model type "virtio".
In other patches - options should turn on virtio-net RSS and hash
properties.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:27 +02:00
Andrea Bolognani
167ac6354c network: Convert managed property of hostdev-pci ports correctly
virNetworkForwardDef.managed is a bool but
virNetworkPortDef.hostdevpci.managed is a virTristateBool, which
means that the current code performs the following incorrect
conversion:

  false -> BOOL_ABSENT
  true  -> BOOL_YES

Using the virTristateBoolFromBool() helper solves the issue.

Fixes: 6cb0ec48bd
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:35 +02:00
Andrea Bolognani
06f5c092b8 conf: Format managed property of hostdev-pci ports correctly
The property is parsed using virTristateBoolTypeFromString() but
formatted as if it was a regular bool, which results in the
following incorrect conversion:

  BOOL_ABSENT -> managed='no'
  BOOL_YES    -> managed='yes'
  BOOL_NO     -> managed='yes'

Use the virTristateBoolTypeToString() helper to ensure the
setting can survive a roundtrip conversion.

Fixes: 4b4a981d60
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:33 +02:00
Andrea Bolognani
77c638c3c7 conf: Restore error checking in VideoAccelDefParseXML()
The check that ensures that at least one property among accel3d,
accel2d and rendernode has been provided by the user had been
lost during the conversion to virXMLPropTristateBool().

Fixes: 0fe2d8dd33
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:31 +02:00
Andrea Bolognani
2ad7039e7c qemu: Don't ignore XMLParseAllowReboot() errors
The function may fail and report an error, in which case we
should not just continue as if nothing happened.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:30 +02:00
Andrea Bolognani
d83d9dde1d qemu: Accept <allowReboot value='default'/>
Up until a few commits ago, libvirt produced this XML and so
we need to be able to read it back to prevent a bunch of

  error : virXMLPropEnumInternal:516 : XML error: Invalid value
  for attribute 'value' in element 'allowReboot': 'default'

messages from being logged on daemon upgrade when there are
running guests.

Fixes: 0fe2d8dd33
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:28 +02:00
Andrea Bolognani
fd3ca84c3e util: Introduce virXMLPropTristateBoolAllowDefault()
We need it for a single scenario in which prop='default' has to
be treated as valid input.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:24 +02:00
Andrea Bolognani
c49651ac17 qemu: Format <allowReboot> conditionally
If the value is VIR_TRISTATE_BOOL_ABSENT we should just omit
the element entirely.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:22 +02:00
Andrea Bolognani
817aa45025 conf: Use virTristateBoolToBool() more
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:21 +02:00
Andrea Bolognani
f655f27b66 conf: Don't pass PROP_NONZERO to virXMLPropTristateBool()
It's the default behavior.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:07 +02:00
Boris Fiuczynski
67c77744d7 tests: Fixing compiler warning in cputest
Found when building on Fedora 36 on s390x.

 C compiler for the host machine: gcc (gcc 12.0.1 "gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0)")
 C linker for the host machine: gcc ld.bfd 2.37-24

 In function ‘cpuTestUpdateLiveCompare’,
     inlined from ‘cpuTestUpdateLive’ at ../dist-unpack/libvirt-8.2.5/tests/cputest.c:784:12:
 ../dist-unpack/libvirt-8.2.5/tests/cputest.c:696:21: warning: potential null pointer dereference [-Wnull-dereference]
   696 |              featAct->policy == VIR_CPU_FEATURE_REQUIRE) ||
       |              ~~~~~~~^~~~~~~~

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 10:32:41 +02:00
Amneesh Singh
5d0eeb8cd7 virsh: Provide completer for PCI backend drivers
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-04 16:30:48 +02:00
Amneesh Singh
4f0480a11c virsh: Provide completer for CPU architectures
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-04 16:30:44 +02:00
Amneesh Singh
11ad758910 virsh: Provide completer for virtualization types
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-04 16:30:40 +02:00
Peter Krempa
5c03346184 qemu: capabilities: Retire QEMU_CAPS_STORAGE_WERROR and QEMU_CAPS_USB_STORAGE_WERROR
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
d3f7b6fe2f qemu: Always assume QEMU_CAPS_STORAGE_WERROR
All supported QEMUs now accept werror/rerror as argument for the
frontend disk device, so we can remove the old code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
cb1d044e38 qemu: capabilities: Retire QEMU_CAPS_OVERCOMMIT
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
edfd78d7f6 qemu: command: Always assume QEMU_CAPS_OVERCOMMIT
Starting with qemu-3.1 we always have the '-overcommit' argument and use
it instead of '-realtime'. Remove the capability check and fix all
fake-caps tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
22acc863c7 qemu: capabilities: Retire QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_MIGRATABLE
The flag was based on a version check which no longer made sense. Remove
the flag by replacing it's only use by an arch-check which is equivalent
at this point.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
b72318f36d qemu: capabilities: Retire QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
47b6829edc qemu: Always assume QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
All qemu versions now support FD passing either directly or via FDset.
Assume that we always have this capability so that we can simplify
chardev handling in many cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
0ce4f98d82 qemu: capabilities: Remove probing of QEMU_CAPS_NUMA via 'query-command-line-options'
For modern qemu versions we use the presence of 'set-numa-node' qmp
command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
b948802ced qemu: capabilities: Remove tautological version checks
Some version checks no longer make sense as the minimum supported qemu
is now qemu-3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
6b62a8e977 qemu: Formally deprecate support for qemu < 3.1
As of April 23 2022, Ubuntu 20.04 will be out for two years, which means
we no longer have to support Ubuntu 18.04 along with qemu-2.11 shipped
with it.

This then brings the minimum qemu version we have to support to
qemu-3.1:

   Debian 10/Stable: 3.1
 OpenSUSE Leap 15.3: 5.2
       Ubuntu 20.04: 4.2
    RHEL/Centos 8.4: 4.2

Next event in this space will be 2023/07/06 when Debian 11 will be out
for two years.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
931c1de5d3 tests: qemucapabilities: Remove qemu-3.0 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
c7e09b7b5f tests: qemucapabilities: Remove qemu-2.12 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
04748f0cef tests: qemucapabilities: Remove qemu-2.11 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
e6c8705b7f qemuxml2agvtest: Retire tests based on qemu-3.0
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
6139ac8b5e qemuxml2agvtest: Retire tests based on qemu-2.12
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
7674bafe4f qemuxml2agvtest: Retire tests based on qemu-2.11
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
e3ab7900da ci: Drop Ubuntu 1804
As of April 23 2022, Ubuntu 20.04 will be out for two years, which per
our platform support policy means we no longer have to support
Ubuntu 18.04.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Andrea Bolognani
950b1c115c news: Document virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:30 +02:00
Andrea Bolognani
c377822460 docs: Document virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:30 +02:00
Andrea Bolognani
19734c3050 qemu: Generate command line for virtio-iommu
https://bugzilla.redhat.com/show_bug.cgi?id=1653327

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:28 +02:00
Andrea Bolognani
e015606984 tests: Add test for virtio-iommu address
virtio-iommu needs to be an integrated device, and our address
assignment code will make sure that is the case. If the user has
provided an explicit address, however, we should make sure any
addresses pointing to a different bus are rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:31:00 +02:00
Andrea Bolognani
fc6cde6cb1 qemu: Validate address type for virtio-iommu
virtio-iommu is a PCI device and attempts to use a different
address type should be rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:31:00 +02:00
Andrea Bolognani
f119336162 qemu: Assign PCI address to virtio-iommu
The device is configured to be an integrated endpoint, as is
necessary for it to function correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
b0eb1e193f conf: Add virDomainDeviceInfo to virDomainIOMMUDef
This is needed so that IOMMU devices can have addresses.

Existing IOMMU devices (intel-iommu and SMMUv3) are system
devices and as such don't have an address associated to them, but
virtio-iommu is a PCI device and needs one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
7620b1a09a qemu: Validate use of ACPI with virtio-iommu
virtio-iommu doesn't work without ACPI, so we need to make sure
the latter is enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
28ddd917be qemu: Validate capabilities for virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00