]> xenbits.xensource.com Git - people/aperard/libvirt.git/log
people/aperard/libvirt.git
15 months agoretry, actually do stuff in domain conf instead of libxl driver conf add-vkb_device
Anthony PERARD [Tue, 23 Jan 2024 16:31:41 +0000 (16:31 +0000)]
retry, actually do stuff in domain conf instead of libxl driver conf

15 months agolibxl_conf: Parse "vkb_device"
Anthony PERARD [Thu, 18 Jan 2024 14:40:08 +0000 (14:40 +0000)]
libxl_conf: Parse "vkb_device"

Needed to work around issue with Debian bookworm boot.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
15 months agonews: Mention support for CPU clusters xen-tested-master
Andrea Bolognani [Mon, 8 Jan 2024 16:47:45 +0000 (17:47 +0100)]
news: Mention support for CPU clusters

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agodocs: Document CPU clusters
Andrea Bolognani [Mon, 8 Jan 2024 15:11:51 +0000 (16:11 +0100)]
docs: Document CPU clusters

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agodocs: Improve documentation for CPU topology
Andrea Bolognani [Mon, 8 Jan 2024 15:13:25 +0000 (16:13 +0100)]
docs: Improve documentation for CPU topology

On the guest configuration side, mention that support for the
"dies" attribute was introduced in libvirt 6.1.0 and clarify
that the ability to use non-default values is subject to
architecture and machine limitations.

On the host capabilities side, the documentation was pretty
much entirely missing. It's still far from perfect, but anything
is better than having no information at all.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Verify handling of CPU clusters in QMP data
Andrea Bolognani [Mon, 8 Jan 2024 17:44:25 +0000 (18:44 +0100)]
tests: Verify handling of CPU clusters in QMP data

Since aarch64 doesn't support CPU hotplug at the moment, we have
to get a bit creative.

While the 'query-cpus-fast' output is taken directly from a VM
configured as

  <vcpu current='7'>16</vcpu>
  <cpu mode='host-passthrough'>
    <topology sockets='2' dies='1' clusters='2' cores='2' threads='2'/>
  </cpu>

the 'query-hotpluggable-cpus' output is constructed by hand
starting from the former and using the 'x86-dies' test data as
a model.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Make monitor aware of CPU clusters
Andrea Bolognani [Fri, 5 Jan 2024 17:51:29 +0000 (18:51 +0100)]
qemu: Make monitor aware of CPU clusters

This makes it so libvirt can obtain accurate information about
guest CPUs from QEMU, and should make it possible to correctly
perform operations such as CPU hotplug.

Of course this is mostly moot at the moment: only aarch64 can use
CPU clusters, and CPU hotplug is not yet implemented on that
architecture.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Add test case for CPU clusters
Andrea Bolognani [Mon, 8 Jan 2024 15:21:25 +0000 (16:21 +0100)]
tests: Add test case for CPU clusters

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Use CPU clusters for guests
Andrea Bolognani [Fri, 5 Jan 2024 17:44:56 +0000 (18:44 +0100)]
qemu: Use CPU clusters for guests

https://issues.redhat.com/browse/RHEL-7043

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Introduce QEMU_CAPS_SMP_CLUSTERS
Andrea Bolognani [Fri, 5 Jan 2024 17:42:13 +0000 (18:42 +0100)]
qemu: Introduce QEMU_CAPS_SMP_CLUSTERS

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: Allow specifying CPU clusters
Andrea Bolognani [Fri, 5 Jan 2024 17:20:14 +0000 (18:20 +0100)]
conf: Allow specifying CPU clusters

The default number of CPU clusters is 1, and values other than
that one are currently rejected by all hypervisor drivers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: Report CPU clusters in capabilities XML
Andrea Bolognani [Fri, 5 Jan 2024 15:03:54 +0000 (16:03 +0100)]
conf: Report CPU clusters in capabilities XML

For machines that don't expose useful information through sysfs,
the dummy ID 0 is used.

https://issues.redhat.com/browse/RHEL-7043

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Add hostcpudata for machine with CPU clusters
Andrea Bolognani [Fri, 5 Jan 2024 14:07:06 +0000 (15:07 +0100)]
tests: Add hostcpudata for machine with CPU clusters

The data is taken from an HPE Apollo 70 machine, which uses
aarch64 CPUs. It is interesting for us because non-dummy
information about CPU clusters is exposed through sysfs.

In order to keep things reasonable, the data was manually
modified so that only 8 of the original 224 CPUs are included.
Care has been taken to ensure that the topology is otherwise
unaltered.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agovshAdmCatchDisconnect: Don't probe connection URI
Peter Krempa [Thu, 14 Dec 2023 16:13:08 +0000 (17:13 +0100)]
vshAdmCatchDisconnect: Don't probe connection URI

virsh already stores the connection URI in 'ctl->connname', use that
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agovshAdmConnect: Preserve connection URI in ctl->connname if auto-detected
Peter Krempa [Thu, 14 Dec 2023 16:18:39 +0000 (17:18 +0100)]
vshAdmConnect: Preserve connection URI in ctl->connname if auto-detected

Probe the current URI so that other places don't need to do that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agovirshCatchDisconnect: Don't probe connection URI
Peter Krempa [Thu, 14 Dec 2023 16:13:08 +0000 (17:13 +0100)]
virshCatchDisconnect: Don't probe connection URI

virsh already stores the connection URI in 'ctl->connname', use that
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agovirshReconnect: Preserve current URI if not explicitly set in ctl->connname
Peter Krempa [Thu, 14 Dec 2023 16:11:08 +0000 (17:11 +0100)]
virshReconnect: Preserve current URI if not explicitly set in ctl->connname

Probe the current URI so that other places don't need to do that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 15 Jan 2024 04:59:27 +0000 (05:59 +0100)]
Translated using Weblate (Swedish)

Currently translated at 63.1% (6601 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 62.7% (6558 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
15 months agoPost-release version bump to 10.1.0
Jiri Denemark [Mon, 15 Jan 2024 10:01:50 +0000 (11:01 +0100)]
Post-release version bump to 10.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoRelease of libvirt-10.0.0
Jiri Denemark [Mon, 15 Jan 2024 09:58:03 +0000 (10:58 +0100)]
Release of libvirt-10.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoNEWS: mention nbdkit config option
Jonathon Jongsma [Fri, 12 Jan 2024 15:17:56 +0000 (09:17 -0600)]
NEWS: mention nbdkit config option

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agonews: document auto-selection of VFIO variant drivers
Laine Stump [Sun, 14 Jan 2024 23:01:34 +0000 (18:01 -0500)]
news: document auto-selection of VFIO variant drivers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Fri, 12 Jan 2024 12:42:28 +0000 (13:42 +0100)]
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
15 months agoci: Do more as part of .qemu-build-template
Andrea Bolognani [Fri, 12 Jan 2024 10:02:56 +0000 (11:02 +0100)]
ci: Do more as part of .qemu-build-template

Entering $SCRATCH_DIR, going back to the original directory and
setting SELinux labels for the newly-installed QEMU binaries
are all steps that logically belong to this template rather
than its callers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoci: Fix .integration_tests_upstream_qemu
Andrea Bolognani [Fri, 12 Jan 2024 10:01:34 +0000 (11:01 +0100)]
ci: Fix .integration_tests_upstream_qemu

We enter $SCRATCH_DIR before going through the process of
cloning QEMU's upstream repo and building it, but once we're
done we don't get back to libvirt's sources, so the very next
step fails with

  /tmp/script.: line 188: ci/jobs.sh: No such file or directory

Use pushd/popd to ensure that we're back to the correct place
once QEMU has been built and installed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoNEWS: Mention migration fixes and iothread mapping
Peter Krempa [Fri, 12 Jan 2024 09:24:12 +0000 (10:24 +0100)]
NEWS: Mention migration fixes and iothread mapping

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 11 Jan 2024 22:18:00 +0000 (23:18 +0100)]
Translated using Weblate (Finnish)

Currently translated at 22.3% (2331 of 10433 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/fi/

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
15 months agoTranslated using Weblate (Korean)
김인수 [Thu, 11 Jan 2024 22:17:59 +0000 (23:17 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10433 of 10433 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Translated using Weblate (Korean)

Currently translated at 99.7% (10411 of 10433 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 11 Jan 2024 22:17:59 +0000 (23:17 +0100)]
Translated using Weblate (Swedish)

Currently translated at 62.5% (6538 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 62.4% (6512 of 10433 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 62.3% (6497 of 10417 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
15 months agoconf: domain_conf: cleanup def in case of errors
Shaleen Bathla [Thu, 11 Jan 2024 12:57:54 +0000 (18:27 +0530)]
conf: domain_conf: cleanup def in case of errors

Just like in rest of the function virDomainFSDefParseXML,
use goto error so that def will be cleaned up in error cases.

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
15 months agoapparmor: Allow access to /sys/devices/system/node/*/cpumap for libnuma
Sergio Durigan Junior [Thu, 11 Jan 2024 21:17:41 +0000 (16:17 -0500)]
apparmor: Allow access to /sys/devices/system/node/*/cpumap for libnuma

A QEMU change (10218ae6d006f76410804cc4dc690085b3d008b5) introduced
some libnuma calls that require read access to
/sys/devices/system/node/*/cpumap, which currently is forbidden by the
standard apparmor profile.

This commit allows read-only access to the file specified above.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/515
Signed-off-by: Sergio Durigan Junior <sergio.durigan@canonical.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
15 months agovirsh: Command completion, add comp-methods with zlib and zstd
Yalei Li [Thu, 11 Jan 2024 01:07:01 +0000 (09:07 +0800)]
virsh: Command completion, add comp-methods with zlib and zstd

Signed-off-by: Yalei Li <liyl43@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoUpdate translation files
Weblate [Tue, 9 Jan 2024 11:41:08 +0000 (12:41 +0100)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 9 Jan 2024 11:41:05 +0000 (12:41 +0100)]
Translated using Weblate (Swedish)

Currently translated at 62.3% (6497 of 10417 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
15 months agoqemu: Be less aggressive when dropping channel source paths
Michal Privoznik [Tue, 9 Jan 2024 13:40:11 +0000 (14:40 +0100)]
qemu: Be less aggressive when dropping channel source paths

In v9.7.0-rc1~130 I've shortened the path that's generated for
<channel/> source. With that, I had to adjust regex that matches
all versions of paths we have ever generated so that we can drop
them (see comment around qemuDomainChrDefDropDefaultPath()). But
as it is usually the case with regexes - they are write only. And
while I attempted to make one portion of the path optional
("/target/") I accidentally made regex accept more, which
resulted in libvirt dropping the user provided path and
generating our own instead.

Fixes: d3759d3674ab9453e5fb5a27ab6c28b8ff8d5569
Resolves: https://issues.redhat.com/browse/RHEL-20807
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
15 months agorpc: fix race in waking up client event loop
Daniel P. Berrangé [Mon, 18 Dec 2023 12:17:18 +0000 (12:17 +0000)]
rpc: fix race in waking up client event loop

The first thread to issue a client RPC request will own the event
loop execution, sitting in the virNetClientIOEventLoop function.

It releases the client lock while running:

   virNetClientUnlock()
   g_main_loop_run()
   virNetClientLock()

If a second thread arrives with an RPC request, it will queue it
for the first thread to process. To inform the first thread that
there's a new request it calls g_main_loop_quit() to break it out
of the main loop.

This works if the first thread is in g_main_loop_run() at that
time. There is a small window of opportunity, however, where
the first thread has released the client lock, but not yet got
into g_main_loop_run(). If that happens, the wakeup from the
second thread is lost.

This patch deals with that by changing the way the wakeup is
performed. Instead of directly calling g_main_loop_quit(), the
second thread creates an idle source to run the quit function
from within the first thread. This guarantees that the first
thread will see the wakeup.

Tested by: Fima Shevrin <efim.shevrin@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoqemu: tighten semantics of 'size' when resizing block devices
Daniel P. Berrangé [Wed, 3 Jan 2024 16:36:45 +0000 (16:36 +0000)]
qemu: tighten semantics of 'size' when resizing block devices

When VIR_DOMAIN_BLOCK_RESIZE_CAPACITY is set, the 'size' parameter
is currently ignored. Since applications must none the less pass a
value for this parameter, it is preferrable to declare some explicit
semantics for it.

This declare that the parameter must be 0, or the exact size of the
underlying block device. The latter gives the management application
the ability to sanity check that the block device size matches what
they think it should be.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agopo: Refresh potfile for v10.0.0
Jiri Denemark [Tue, 9 Jan 2024 11:07:20 +0000 (12:07 +0100)]
po: Refresh potfile for v10.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoci: Add notes for integration jobs
Andrea Bolognani [Mon, 8 Jan 2024 10:30:05 +0000 (11:30 +0100)]
ci: Add notes for integration jobs

These are special in that, when a new target is introduced, some
preparation is needed before the changes can be merged. Since
this only happens every six months or so, it's unsurprising that
we keep messing it up and forgetting some steps. Having notes
right in the file will hopefully help going forward.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoci: Move upstream-qemu job to Fedora 39
Andrea Bolognani [Mon, 8 Jan 2024 10:34:37 +0000 (11:34 +0100)]
ci: Move upstream-qemu job to Fedora 39

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoci: Fix upstream-qemu job definitions
Andrea Bolognani [Mon, 8 Jan 2024 10:33:29 +0000 (11:33 +0100)]
ci: Fix upstream-qemu job definitions

These are jobs are supposed to be running tests using a QEMU
binary built from the latest upstream sources, but right now
they're just doing the same thing as the other jobs for the
target. Use the correct job templates.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Add capabilities for QEMU 8.2.0 on aarch64
Andrea Bolognani [Mon, 8 Jan 2024 15:51:53 +0000 (16:51 +0100)]
tests: Add capabilities for QEMU 8.2.0 on aarch64

Notable changes compared to 7.0.0, the most recent version that
we had capabilities for until now:

  * SPICE support is no longer compiled in. CCID devices are
    also affected as they are implemented using libcacard,
    which is part of SPICE;

  * uses of -no-acpi are replaced with -M virt,acpi=off;

  * -netdev uses JSON.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Don't use features with vexpress machine
Andrea Bolognani [Mon, 8 Jan 2024 16:00:05 +0000 (17:00 +0100)]
tests: Don't use features with vexpress machine

The vexpress machine has never supported ACPI. This fact has
been silently ignored by QEMU so far, but recent versions have
started reporting attempts to use the combination as an error.

The other features (APIC, PAE) are also not relevant to the
vexpress machine, or the QEMU driver.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoNEWS: Mention postcopy-preempt migration capability
Jiri Denemark [Mon, 8 Jan 2024 16:34:41 +0000 (17:34 +0100)]
NEWS: Mention postcopy-preempt migration capability

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Enable postcopy-preempt migration capability
Jiri Denemark [Fri, 5 Jan 2024 11:43:59 +0000 (12:43 +0100)]
qemu: Enable postcopy-preempt migration capability

During post-copy migration (once it actually switches to post-copy mode)
dirty memory pages are continued to be migrated iteratively, while the
destination can explicitly request a specific page to be migrated before
the iterative process gets to it (which happens when a guest wants to
read a page that was not migrated yet). Without the postcopy-preempt
capability enabled such pages need to wait until all other pages already
queued are transferred. Enabling this capability will instruct the
hypervisor to create a separate migration channel for explicitly
requested pages so that they can preempt the queue.

The only requirement for the feature to work is running a migration over
a protocol that supports multiple connections. In other words, we can't
pre-create the connection and pass its file descriptor to QEMU (i.e.,
using MIGRATION_DEST_CONNECT_SOCKET), but we have to let QEMU open the
connections itself (using MIGRATION_DEST_SOCKET). This change is applied
to all post-copy migrations even if postcopy-preempt is not supported to
avoid making the code even uglier than it is now. There's no real
difference between the two methods with modern QEMU (which can properly
report connection failures) anyway.

This capability is enabled for all post-copy migration as long as the
capability is supported on both sides of migration.

https://issues.redhat.com/browse/RHEL-7100

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Add support for optional migration capabilities
Jiri Denemark [Mon, 8 Jan 2024 15:31:29 +0000 (16:31 +0100)]
qemu: Add support for optional migration capabilities

We enable various migration capabilities according to the flags passed
to a migration API. Missing support for such capabilities results in an
error because they are required by the corresponding flag. This patch
adds support for additional optional capability we may want to enable
for a given API flag in case it is supported. This is useful for
capabilities which are not critical for the flags to be supported, but
they can make things work better in some way.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Rename remoteCaps parameter in qemuMigrationParamsCheck
Jiri Denemark [Mon, 8 Jan 2024 14:58:09 +0000 (15:58 +0100)]
qemu: Rename remoteCaps parameter in qemuMigrationParamsCheck

The migration cookie contains two bitmaps of migration capabilities:
supported and automatic. qemuMigrationParamsCheck expects the letter so
lets make it more obvious by renaming the parameter as remoteAuto.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Use C99 initializers for qemuMigrationParamsFlagMap
Jiri Denemark [Mon, 8 Jan 2024 15:36:34 +0000 (16:36 +0100)]
qemu: Use C99 initializers for qemuMigrationParamsFlagMap

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Document qemuMigrationParamsFlagMapItem fields
Jiri Denemark [Mon, 8 Jan 2024 14:08:05 +0000 (15:08 +0100)]
qemu: Document qemuMigrationParamsFlagMapItem fields

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 8 Jan 2024 06:04:24 +0000 (07:04 +0100)]
Translated using Weblate (Swedish)

Currently translated at 61.9% (6457 of 10417 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 61.6% (6417 of 10417 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
15 months agotests: Add xml->argv and xml->xml tests for the new iothread mapping feature
Peter Krempa [Wed, 1 Mar 2023 13:40:02 +0000 (14:40 +0100)]
tests: Add xml->argv and xml->xml tests for the new iothread mapping feature

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu: Implement support for configuring iothread to virtqueue mapping for disks
Peter Krempa [Wed, 1 Mar 2023 13:40:02 +0000 (14:40 +0100)]
qemu: Implement support for configuring iothread to virtqueue mapping for disks

Add validation and formatting of the commandline arguments for
'iothread-vq-mapping' parameter. The validation logic mirrors what qemu
allows.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoconf: Add possibility to configure multiple iothreads per disk
Peter Krempa [Thu, 23 Feb 2023 15:25:18 +0000 (16:25 +0100)]
conf: Add possibility to configure multiple iothreads per disk

Introduce a new <iothreads> sub-element of disk's <driver> which will
allow configuring multiple iothreads and also map them to specific
virt-queues of virtio devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu: capabilities: Introduce QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING
Peter Krempa [Thu, 23 Feb 2023 14:47:11 +0000 (15:47 +0100)]
qemu: capabilities: Introduce QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING

The capability represents the support for mapping virtqueues to
iothreads for the 'virtio-blk' device.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoutil: xml: Return GPtrArray from virXMLNodeGetSubelement
Peter Krempa [Mon, 13 Feb 2023 14:53:23 +0000 (15:53 +0100)]
util: xml: Return GPtrArray from virXMLNodeGetSubelement

Rework the helper to use a GPtrArray structure to simplify callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemucapabilitiesdata: Add data for the qemu-9.0 development cycle
Peter Krempa [Wed, 3 Jan 2024 14:37:06 +0000 (15:37 +0100)]
qemucapabilitiesdata: Add data for the qemu-9.0 development cycle

Add data for the qemu-9.0 development cycle based on
'v8.2.0-196-g7425b6277f'

Notable changes:
 - new machine types added
 - 'iommufd' object added
 - 'vfio-pci' device added 'fd' and 'iommufd' properties
 - 'virtio-blk-pci' device added 'iothread-vq-mapping' property

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu: automatically bind to a vfio variant driver, if available
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
qemu: automatically bind to a vfio variant driver, if available

Rather than always binding to the vfio-pci driver, use the new
function virPCIDeviceFindBestVFIOVariant() to see if the running
kernel has a VFIO variant driver available that is a better match for
the device, and if one is found, use that instead.

virPCIDeviceFindBestVFIOVariant() function reads the modalias file for
the given device from sysfs, then looks through
/lib/modules/${kernel_release}/modules.alias for the vfio_pci alias
that matches with the least number of wildcard ('*') fields.

The appropriate "VFIO variant" driver for a device will be the PCI
driver implemented by the discovered module - these drivers are
compatible with (and provide the entire API of) the standard vfio-pci
driver, but have additional device-specific APIs that can be useful
for, e.g., saving/restoring state for migration.

If a specific driver is named (using <driver model='blah'/> in the
device XML), that will still be used rather than searching
modules.alias; this makes it possible to force binding of vfio-pci if
there is an issue with the auto-selected variant driver.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: support manually specifying VFIO variant driver in <hostdev> XML
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: support manually specifying VFIO variant driver in <hostdev> XML

This patch makes it possible to manually specify which VFIO variant
driver to use for PCI hostdev device assignment, so that, e.g. you
could force use of a VFIO "variant" driver, with e.g.

  <driver model='mlx5_vfio_pci'/>

or alternately to force use of the generic vfio-pci driver with

  <driver model='vfio-pci'/>

when libvirt would have normally (after applying a subsequent patch)
found a "better match" for a device in the active kernel's
modules.alias file. (The main potential use of this manual override
would probably be to work around a bug in a new VFIO variant driver by
temporarily not using that driver).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: remove explicit <driver name='vfio'/> from hostdev test cases
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
tests: remove explicit <driver name='vfio'/> from hostdev test cases

The long-deprecated use of <driver name='vfio|xen|kvm'/> in domain xml
for <hostdev> devices was only ever necessary during the period when
libvirt (and the Linux kernel) supported both VFIO and "legacy KVM"
styles of hostdev device assignment for QEMU. This became pointless
many years ago when legacy KVM device assignment was removed from the
kernel, and support for that style of device assignment was completely
disabled in the libvirt source in 2019 (commit
v5.6.0-316-g2e7225ea8c).

Nevertheless, there were instances of <driver name='vfio'/> in the
unit test data that were then (unnecessarily) propagated to several
more tests over the years. This patch cleans out those unnecessary
explicit settings of driver name='vfio' in all QEMU unit test data,
proving that the attribute is no longer (externally) needed. (A later
patch which adds a 2nd attribute to the <driver> element will include
a test case that explicitly exercises the driver name attribute).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoxen: explicitly set hostdev driver.name at runtime, not in postparse
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
xen: explicitly set hostdev driver.name at runtime, not in postparse

Xen only supports a single type of PCI hostdev assignment, so it is
superfluous to have <driver name='xen'/> peppered throughout the
config. It *is* necessary to have the driver type explicitly set in
the hostdev object before calling into the hypervisor-agnostic "hostdev
manager" though (otherwise the hostdev manager doesn't know whether it
should do Xen-specific setup, or VFIO-specific setup).

Historically, the Xen driver has checked for "default" driver name
(i.e. not set in the XML), and set it to "xen', during the XML
postparse, thus guaranteeing that it will be set by the time the
object is sent to the hostdev manager at runtime, but also setting it
so early that a simple round-trip of parse-format results in the XML
always containing an explicit <driver name='xen'/>, even if that
wasn't specified in the original XML.

The QEMU driver *doesn't* set driver.name during postparse though;
instead, it waits until domain startup time (or device attach time for
hotplug), and sets the driver.name then. The result is that a
parse-format round trip of the XML in the QEMU driver *doesn't* add in
the <driver name='vfio'/>.

This patch modifies the Xen driver to behave similarly to the QEMU
driver - the PostParse just checks for a driver.name that isn't
supported by the Xen driver, and any explicit setting to "xen" is
deferred until domain runtime rather than during the postparse, thus
Xen domain XML also doesn't get extraneous <driver name='xen'/>.

This delayed setting of driver.name of course results in slightly
different xml2xml parse-format results, so the unit test data is
modified accordingly.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: replace virHostdevIsVFIODevice with virHostdevIsPCIDevice
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: replace virHostdevIsVFIODevice with virHostdevIsPCIDevice

virHostdevIsVFIODevice() and virDomainDefHasVFIOHostdev() are only ever
called from the QEMU driver, and in the case of the QEMU driver, any
PCI hostdev by definition uses VFIO, so really all these callers only
need to know if the device is a PCI hostdev.

(It turned out that the less specific virHostdevIsPCIDevice() already
existed in hypervisor/virhostdev.c, so I had to remove one of them;
since conf is a lower level directory than hypervisor, and the
function is called from conf, keeping the copy in hypervisor would
have required moving its caller (virDomainDefHasPCIHostdev()) into
hypervisor as well, so I just removed the copy in hypervisor.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: use new common parser/formatter for hostdev driver in network XML
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: use new common parser/formatter for hostdev driver in network XML

Now if a new attribute is added to <driver>, we only need to update
the formatting/parsing in one place.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: split out hostdev <driver> parse/format to their own functions
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: split out hostdev <driver> parse/format to their own functions

This is done so that we can re-use the same parser/formatter for
<network> and <networkport>

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: use virDeviceHostdevPCIDriverInfo in network and networkport objects
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: use virDeviceHostdevPCIDriverInfo in network and networkport objects

The next step in consolidating parsing/formatting of the <driver>
element of these objects using a common struct and common code. This
eliminates the virNetworkForwardDriverNameType enum which is nearly
identical to virDeviceHostdevPCIDriverName (the only non-identical bit
was just because they'd gotten out of sync over time) and replaces its
uses with a virDeviceHostdevPCIDriverInfo (which is a struct that
contains a virDeviceHostdevPCIDriverName).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: put hostdev PCI backend into a struct
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: put hostdev PCI backend into a struct

The new struct is virDeviceHostdevPCIDriverInfo, and the "backend"
enum in the hostdevDef will be replaced with a
virDeviceHostdevPCIDriverInfo named "driver'. Since the enum value in
this new struct is called "name", it means that all references to
"backend" will become "driver.name".

This will allow easily adding other items for new attributes in the
<driver> element / C struct, which will be useful once we are using
this new struct in multiple places.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: normalize hostdev <driver> parsing to simplify adding new attr
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: normalize hostdev <driver> parsing to simplify adding new attr

The hostdev version of the <driver> subelement appears in four places:

 * The domain XML in the <hostdev> and <interface type='hostdev'>
   elements (that's 2)

 * The network XML inside <forward> when the network is a pool of
   SRIOV VFs

 * the <networkport> XML, which is used to communicate between the
   hypervisor driver and network driver.

In order to make the pending addition of a new attribute to <driver>
in all these cases simpler, this patch refactors the parsing of
<driver> in all four places to use virXMLProp*() and
virXMLFormatElement().

Making all of the different instances of the separate parse/format for
<driver> look nearly identical will make it easier to see that the
upcoming patch that converges all four to use a common
parser/formatter is a functional NOP.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: move/rename hostdev PCI driver type enum to device_conf.h
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: move/rename hostdev PCI driver type enum to device_conf.h

Currently this enum is defined in domain_conf.h and named
virDomainHostdevSubsysPCIDriverType. I want to use it in parts of the
network and networkport config, so am moving its definition to
device_conf.h which is / can be included by all interested parties,
and renaming it to match the name of the corresponding XML attribute
("driver name"). The name change (which includes enum values) does cause a
lot of churn, but it's all mechanical.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoschema: consolidate RNG for all hostdev <driver> elements
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
schema: consolidate RNG for all hostdev <driver> elements

The exact same element can appear in <hostdev> and <interface
type='hostdev'>, and nearly identical in <network> and <networkport>
(these latter two don't include "xen" as a possible driver, but that's
coincidental - there's no reason Xen couldn't also use the VF pools in
virtual networks, it just doesn't).

This patch modifies all 4 to use the same <ref name="hostdevDriver"/>
so that it is simpler to add something new.

A side effect of this patch is that the grammar for the <interface>
element in domain XML has been tightened up a bit - previously it was
accepted by the schema (but nonsensical) to have virtio and network
interface options specified; as a part of making the two different
<driver> choices each a complete element (rather than each being a
collection of attributes and subelements) these extra
attributes/subelements that were irrelevant to the hostdev-type
<driver> were made to be valid only for an emulated interface's
<driver>.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoutil: properly deal with VFIO module name vs. driver name
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
util: properly deal with VFIO module name vs. driver name

Historically libvirt hasn't differentiated between the name of a
loadable kernel module, and the name of the device driver that module
implements, but these two names can be (and usually are) at least
subtly different.

For example, the loadable module called "vfio_pci" implements a PCI
driver called "vfio-pci". We have always used the name "vfio-pci" both
to load the module (with modprobe) and to check (in
/sys/bus/pci/drivers) if the driver is available. (This has happened
to work because modprobe "normalizes" all the names it is given by
replacing "-" with "_", so "vfio-pci" works for both loading the
module and checking for the driver.)

When we recently gained the ability to manually specify the driver for
"virsh nodedev-detach", the fragility of this system became apparent -
if a user gave the "driver name" as "vfio_pci", then we would modprobe
the module correctly, but then erroneously believe it hadn't been
loaded because /sys/bus/pci/drivers/vfio_pci didn't exist. For manual
specification of the driver name, we could deal with this by telling
the user "always use the correct name for the driver, don't assume
that it has the same name as the module", but it would still end up
confusing people, especially since some drivers do use underscore in
their name (e.g. the mlx5_vfio_pci driver/module).

This will only get worse when an upcoming patch starts automatically
determining the driver to use for VFIO-assigned devices - it will look
in the kernel's modules.alias file to find "best" VFIO variant
*module* for a device, and 3 out of 4 current examples of
vfio-pci/variant drivers have a mismatch between module name and
driver name, so the current code would end up properly loading the
module, but then erroneously think that the driver wasn't available.

This patch makes the code more forgiving by

1) checking for both $drivername and underscore($drivername) in
   /sys/bus/pci/drivers

2) when we determine a module needs to be loaded, look at the link in
   /sys/module/$modulename/driver/pci:$drivername to determine the
   name of the driver we need to bind to the device(rather than just
   assuming the driver has the same name as the module

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agotests: Ensure test files are newline-terminated
Andrea Bolognani [Fri, 5 Jan 2024 11:02:43 +0000 (12:02 +0100)]
tests: Ensure test files are newline-terminated

Currently we only append a newline to 'actual' if 'expected'
(as loaded from file) already ends in a newline, but that
results in inconsistent behavior.

For example, some of the test files used by virhostcputest are
newline-terminated and some aren't. If we were to remove
existing newlines from those files or add them where they
aren't present, the test would still pass, and even using
VIR_TEST_REGENERATE_OUTPUT=1 wouldn't change them back.

Make things consistent by ensuring that 'actual' is always
newline-terminated. The only exception is when 'actual' is
completely empty: in that case, we want the file to be actually
empty, not contain a single empty line. query-jobs-empty.result
in qemumonitorjsondata/ is an example of this being used.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agotests: Drop some unused qemunbdkit data files
Andrea Bolognani [Fri, 5 Jan 2024 11:32:02 +0000 (12:32 +0100)]
tests: Drop some unused qemunbdkit data files

The test still passes after deleting them, which seems to
indicate that they're unnecessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agolibvirt.spec: Fix nbdkit selection logic on mingw and old rhel
Peter Krempa [Fri, 5 Jan 2024 08:39:45 +0000 (09:39 +0100)]
libvirt.spec: Fix nbdkit selection logic on mingw and old rhel

rhel-8 lacks 'pidfd_open()' support and thus nbdkit can't be enabled
there.

mingw builds explicitly disable nbdkit support, but use
'--auto-features=enabled' thus omitting setting of
'nbdkit_config_default' results in meson thinking we want to enable it:

  ../meson.build:1018:2: ERROR: Problem encountered: nbdkit_config_default requires nbdkit to be enabled

Disable it explicitly. The meson logic might need to be fixed eventually
when switching it on by default.

Fixes: 9eabf14afbd429af1be195723fdeab5ccdd0b2cd
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
16 months agoqemuxml2argvtest: Add checker that all input files are used
Peter Krempa [Fri, 1 Dec 2023 15:47:23 +0000 (16:47 +0100)]
qemuxml2argvtest: Add checker that all input files are used

To prevent regressions when refactoring tests and accidentally forgotten
input files make sure that qemuxml2argvtest is invoked for all input
files in tests/qemuxml2argvdata

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Mark 'nbdkit' tests as skipped if nbdkit is not compiled in
Peter Krempa [Wed, 3 Jan 2024 12:03:24 +0000 (13:03 +0100)]
qemuxml2argvtest: Mark 'nbdkit' tests as skipped if nbdkit is not compiled in

Rather than completely compiling out the tests mark them as skipped.
This will allow us to add a checker that all input files are accounted
for.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Add test cases covered only by qemuxml2xmltest - part 2
Peter Krempa [Mon, 4 Dec 2023 13:52:34 +0000 (14:52 +0100)]
qemuxml2argvtest: Add test cases covered only by qemuxml2xmltest - part 2

Add the rest of test cases which were tested only by qemuxml2xmltest.

All test cases added here have a '<interface type="network"' which needs
to be translated using the new fake network driver.

Note that this captures the status quo of the tests. No care was given
whether the tests make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agovirnetworkportxml2xmltest: Add simple versions of bridge/network tests
Peter Krempa [Fri, 1 Dec 2023 22:09:48 +0000 (23:09 +0100)]
virnetworkportxml2xmltest: Add simple versions of bridge/network tests

Add versions stripping vlans and bandwidth setup so that they can be
used in qemuxml2argvtest for interfaces which don't support the above.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Enable 'graphics-listen-network' case
Peter Krempa [Mon, 4 Dec 2023 13:51:14 +0000 (14:51 +0100)]
qemuxml2argvtest: Enable 'graphics-listen-network' case

Use the data from 'nat-network' network definition to enable the test
case also for xml2argvtest.

Since the network listen bit doesn't need any plug definition just use
an empty string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2xmltest: Introduce fake network driver
Peter Krempa [Fri, 1 Dec 2023 14:49:21 +0000 (15:49 +0100)]
qemuxml2xmltest: Introduce fake network driver

In order to be able to use '<interface type="network"' we need a fake
network driver in qemuxml2argvtest. Create one by simply allowing users
to reuse configs from tests/networkxml2xmlin and tests/virnetworkportxml2xmldata
which will be returned to corresponding functions.

The driver implements:

    .networkLookupByName = fakeNetworkLookupByName,
      - validate syntax of network name, check if config exists
    .networkGetXMLDesc = fakeNetworkGetXMLDesc,
      - return appropriate XML
    .networkPortCreateXML = fakeNetworkPortCreateXML,
      - validate that port XML exists
    .networkPortGetXMLDesc = fakeNetworkPortGetXMLDesc,
      - return appropriate port XML

With the above and the correspondign test data, all network XMLs can be
enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvmock: Mock virNetDevSetMTU
Peter Krempa [Mon, 4 Dec 2023 15:28:23 +0000 (16:28 +0100)]
qemuxml2argvmock: Mock virNetDevSetMTU

Unfortunately the network backend commandline formatter attempts to also
setup the backend itself, which it really should not.

For now make sure qemuxml2argvtest can call virNetDevSetMTU.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemu: process: Separate setup of network device objects
Peter Krempa [Fri, 1 Dec 2023 21:48:55 +0000 (22:48 +0100)]
qemu: process: Separate setup of network device objects

Separate the SLIRP bits from 'qemuProcessNetworkPrepareDevices' and do
the setup of the internal data when setting up domain data.

This will allow tests to use the same code path to lookup data for a
network.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2xmltest: Delete 'interface-driver' case
Peter Krempa [Mon, 4 Dec 2023 15:02:05 +0000 (16:02 +0100)]
qemuxml2xmltest: Delete 'interface-driver' case

Everything this XML tests is already explicitly covered in other tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml*test: Improve 'vhost_queues' test case
Peter Krempa [Mon, 4 Dec 2023 14:58:39 +0000 (15:58 +0100)]
qemuxml*test: Improve 'vhost_queues' test case

Modify the test case so that it can be used also for qemuxml2argvtest
by removing invalid configuration (interface type='user' + queues),
clean up unneeded disks and rename it accordingly. Also test the
ioeventfd.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2*test: Add specific test case for interface link state
Peter Krempa [Mon, 4 Dec 2023 14:26:13 +0000 (15:26 +0100)]
qemuxml2*test: Add specific test case for interface link state

Test both linkstates in an explicit test case. Note that link state is
setup via monitor, thus not visible on the commandline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2xmltest: Move 'graphics-listen-network2' case go genericxml2xmltest
Peter Krempa [Mon, 4 Dec 2023 13:16:13 +0000 (14:16 +0100)]
qemuxml2xmltest: Move 'graphics-listen-network2' case go genericxml2xmltest

The tested configuration is not valid for a qemu VM. Move it to the
generic test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Add test cases covered only by qemuxml2xmltest - part 1
Peter Krempa [Fri, 1 Dec 2023 15:53:32 +0000 (16:53 +0100)]
qemuxml2argvtest: Add test cases covered only by qemuxml2xmltest - part 1

There were plenty of test cases invoked only from qemuxml2xmltest but
not from qemuxml2argvtest, either by accident or it was deemed unneeded.

Bulk-add all test cases which fit the above description which don't
require faking the network driver. Use same invocation as present in
qemuxml2xmltest.

Arguably in certain cases we could move the test case to
genericxml2xmltest, but this covers the cases when that would not be
appropriate.

Tests requiring the network driver will be bulk-added when the fake
network driver will be implemented.

This patch also allows the use of FLAG_SKIP_CONFIG_ACTIVE in
qemuxml2argvtest although the flag will be dormant for now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvmock: Mock qemuInterfaceBridgeConnect
Peter Krempa [Fri, 1 Dec 2023 22:11:11 +0000 (23:11 +0100)]
qemuxml2argvmock: Mock qemuInterfaceBridgeConnect

Prepare for test cases which would want to call that function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Check for duplicate invocation of tests
Peter Krempa [Fri, 1 Dec 2023 15:27:26 +0000 (16:27 +0100)]
qemuxml2argvtest: Check for duplicate invocation of tests

Prevent duplicated invocation of tests by tracking use of output files.
Some cases need to be exempt from this for now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Remove duplicated invocations of tests
Peter Krempa [Fri, 1 Dec 2023 15:37:47 +0000 (16:37 +0100)]
qemuxml2argvtest: Remove duplicated invocations of tests

'parallel-tcp-chardev', 'parallel-parport-chardev' are invoked twice
with exactly the same parameters, remove the duplicity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvdata: Move 'smbios-multiple-type2' case to genericxml2xmltest
Peter Krempa [Fri, 1 Dec 2023 15:12:42 +0000 (16:12 +0100)]
qemuxml2argvdata: Move 'smbios-multiple-type2' case to genericxml2xmltest

The qemu driver explicitly rejects such configuration, thus this is just
a generic XML2XML test case. Move it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Reinstate 'pseries-vio-address-clash' case
Peter Krempa [Fri, 1 Dec 2023 14:24:34 +0000 (15:24 +0100)]
qemuxml2argvtest: Reinstate 'pseries-vio-address-clash' case

The case was removed in commit 8ff73d22c7405049452e2bf7f281f7460a6b9d10
which modernized the cases without an explicit reason. Reinstate it.

Fixes: 8ff73d22c7405049452e2bf7f281f7460a6b9d10
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Fix and use 'disk-network-ssh-key' case
Peter Krempa [Fri, 1 Dec 2023 14:19:15 +0000 (15:19 +0100)]
qemuxml2argvtest: Fix and use 'disk-network-ssh-key' case

The test case was introduced by commit 68599168ea8185689bd227e6d142e3d933558f84
but is only used in the qemunbdkittest. Fix it and make use of it also
in qemuxml2argvtest.

Fixes: 68599168ea8185689bd227e6d142e3d933558f84
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemuxml2argvtest: Reinstate 'console-compat-chardev' and 'pci-serial-dev-chardev'
Peter Krempa [Fri, 1 Dec 2023 14:14:00 +0000 (15:14 +0100)]
qemuxml2argvtest: Reinstate 'console-compat-chardev' and 'pci-serial-dev-chardev'

The tests invocations were accidentaly removed in commit
54257ed51b5132032cedb7e1e7b8c34b9ae52115

Fixes: 54257ed51b5132032cedb7e1e7b8c34b9ae52115
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoqemu: add runtime config option for nbdkit
Jonathon Jongsma [Wed, 8 Nov 2023 19:14:50 +0000 (13:14 -0600)]
qemu: add runtime config option for nbdkit

Currently when we build with nbdkit support, libvirt will always try to
use nbdkit to access remote disk sources when it is available. But
without an up-to-date selinux policy allowing this, it will fail.
because the required selinux policies are not yet widely available, we
have disabled nbdkit support on rpm builds for all distributions before
Fedora 40.

Unfortunately, this makes it more difficult to test nbdkit support.
After someone updates to the necessary selinux policies, they would also
need to rebuild libvirt to enable nbdkit support. By introducing a
configure option (nbdkit_config_default), we can build packages with
nbdkit support but have it disabled by default.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Suggested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
16 months agonode_device: udevGetStringSysfsAttr() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:17:03 +0000 (03:17 +0300)]
node_device: udevGetStringSysfsAttr() to void

udevGetStringSysfsAttr() return value is invariant, so change it
type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agonode_device: udevTranslatePCIIds() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:17:02 +0000 (03:17 +0300)]
node_device: udevTranslatePCIIds() to void

udevTranslatePCIIds() return value is invariant, so change it
type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agovirprocess: virProcessGetNamespaces() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:17:01 +0000 (03:17 +0300)]
virprocess: virProcessGetNamespaces() to void

virProcessGetNamespaces() return value is invariant, so change it
type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agoconf: virDomainNetUpdate() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:17:00 +0000 (03:17 +0300)]
conf: virDomainNetUpdate() to void

virDomainNetUpdate() return value is invariant, so change it type
and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agolxc: virLXCControllerAddConsole() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:16:59 +0000 (03:16 +0300)]
lxc: virLXCControllerAddConsole() to void

virLXCControllerAddConsole() return value is invariant, so change
it type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agorpc: virnetserver: virNetServerAddService() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:16:58 +0000 (03:16 +0300)]
rpc: virnetserver: virNetServerAddService() to void

virNetServerAddService() return value is invariant, so change it
type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
16 months agocpu: : virCPUx86DataAddItem() to void
Artem Chernyshev [Thu, 4 Jan 2024 00:16:57 +0000 (03:16 +0300)]
cpu: : virCPUx86DataAddItem() to void

virCPUx86DataAddItem() return value is invariant, so change it
type and remove all dependent checks.

Functions changed to void:

virCPUx86DataAddItem()
x86DataAdd()
virCPUx86DataAdd()
x86DataAddSignature()
virCPUx86DataSetSignature()
libxlCapsAddCPUID()
cpuidSetLeaf4()
cpuidSetLeaf7()
cpuidSetLeafB()
cpuidSetLeafD()
cpuidSetLeafResID()
cpuidSetLeaf12()
cpuidSetLeaf14()
cpuidSetLeaf17()

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>