Commit Graph

47015 Commits

Author SHA1 Message Date
Michal Privoznik
42b2f1f8b8 docs: Update best practices wrt "Fixes:" and GitLab
We document that a commit fixing an issue tracked in GitLab
should put just "Fixes: #NNN" into its commit message. But when
viewing git log, having full URL which is directly clickable is
more developer friendly and GitLab is capable of handling both.
Therefore, document that users should put full URL, just like
when fixing a bug tracked in other sites.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-10-25 08:37:28 +02:00
Ján Tomko
045072ee3a qemu: fix conversion specifier in qemuBuildVsockDevProps
vhostfd is a signed integer.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-10-24 15:36:33 +02:00
Ján Tomko
0b1da01ef2 qemu: do not attempt to pass unopened vsock FD
On normal vm startup, we open a file descriptor
for the vsock device in qemuProcessPrepareHost.

However, when doing domxml-to-native, no file descriptors are open.

Only pass the fd if it's not -1, to make domxml-to-native work.

https://bugzilla.redhat.com/show_bug.cgi?id=1777212

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-10-24 15:36:33 +02:00
Jiri Denemark
d1f291b4c3 NEWS: Document daemon crash on reconnect
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-24 15:28:47 +02:00
Jiri Denemark
1a570f9712 qemu: Do not crash when canceling migration on reconnect
When libvirtd is restarted during an active outgoing migration (or
snapshot, save, or dump which are internally implemented as migration)
it wants to cancel the migration. But by a mistake in commit
v8.7.0-57-g2d7b22b561 the qemuMigrationSrcCancel function is called with
wait == true, which leads to an instant crash by dereferencing NULL
pointer stored in priv->job.current.

When canceling migration to file (snapshot, save, dump), we don't need
to wait until it is really canceled as no migration capabilities or
parameters need to be restored.

On the other hand we need to wait when canceling outgoing migration and
since we don't have virDomainJobData at this point, we have to
temporarily restore the migration job to make sure we can process
MIGRATION events from QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-24 15:28:47 +02:00
Jiri Denemark
4dd86f334b qemu_migration: Properly wait for migration to be canceled
In my commit v8.7.0-57-g2d7b22b561 I attempted to make
qemuMigrationSrcCancel synchronous, but failed. When we are canceling
migration after some kind of error which is detected in
in qemuMigrationSrcWaitForCompletion, jobData->status will be set to
VIR_DOMAIN_JOB_STATUS_FAILED regardless on QEMU state. So instead of
relying on the translated jobData->status in qemuMigrationSrcIsCanceled
we need to check the migration status we get from QEMU MIGRATION event.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-24 15:28:47 +02:00
Peter Krempa
e49313b54e vircgroup: Remove unused variables in virCgroupV2Available
After recent commit 'contFile' and 'contStr' became unused breaking
build with clang:

../../../libvirt/src/util/vircgroupv2.c:72:26: error: unused variable 'contFile' [-Werror,-Wunused-variable]
        g_autofree char *contFile = NULL;
                         ^
../../../libvirt/src/util/vircgroupv2.c:73:26: error: unused variable 'contStr' [-Werror,-Wunused-variable]
        g_autofree char *contStr = NULL;
                         ^

Fixes: a0f37232b9
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-10-24 13:41:34 +02:00
Eric van Blokland
a0f37232b9 cgroup/LXC: Do not condition availability of v2 by controllers
systemd in hybrid mode uses v1 hierarchies for controllers and v2 for
process tracking.

The LXC code uses virCgroupAddMachineProcess() to move processes into
appropriate cgroup by manipulating cgroupfs directly. (Note, despite
libvirt also supports talking to systemd directly via
org.freedesktop.machine1 API.)

If this path is taken, libvirt/lxc must convince systemd that processes
really belong to new cgroup, i.e. also the tracking v2 hierarchy must
undergo migration too.

The current check would evaluate v2 backend as unavailable with hybrid
mode (because there are no available controllers). Simplify the
condition and consider the mounted cgroup2 as sufficient to touch v2
hierarchy.

This consequently creates an issue with binding the V2 mount. In hybrid
mode the V2 filesystem may be mounted upon the V1 filesystem. By reversing
the order in which backends are mounted in virCgroupBindMount this problem
is circumvented.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/182
Signed-off-by: Eric van Blokland <mail@ericvanblokland.nl>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-24 12:47:13 +02:00
Gogo Gogsi
f1d63048b7 Added translation using Weblate (Croatian)
Co-authored-by: Gogo Gogsi <linux.hr@protonmail.com>
Signed-off-by: Gogo Gogsi <linux.hr@protonmail.com>
2022-10-20 15:46:47 +02:00
Ján Tomko
53be87fda4 build: drop LINUGAS sorting rule
A recent merge request from Weblate adding a new file fails syntax-check
because it adds a new language at the end of LINGUAS, instead of sorting
it alphabetically. Rather than trying to work around it, drop this
pointless rule.

Reverts: 8d160b7979
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 15:35:34 +02:00
Peter Krempa
e204f8e516 qemuxml2argvtest: Don't re-parse and re-generate commandline for QAPI schema validation
The removal of the special internal flag for '-netdev' validatition now
allows us to use the same virCommand object for validation of the
schema.

Pass it into the validator instead of re-parsing and re-generating
everything.

This improved the runtime of qemuxml2argvtest by ~25% on my box.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-20 09:34:42 +02:00
Michal Privoznik
ab966b9d31 qemu: Enable for vCPUs on hotplug
As advertised in the previous commit, QEMU_SCHED_CORE_VCPUS case
is implemented for hotplug case. The implementation is very
similar to the cold boot case, except here we fork off for every
vCPU (because the implementation is done in
qemuProcessSetupVcpu() which is also the function that's called
from hotplug code). But that's okay because our hotplug APIs
allow hotplugging one device at the time.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2074559
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 09:01:21 +02:00
Michal Privoznik
d942422482 qemu: Enable SCHED_CORE for vCPUs
For QEMU_SCHED_CORE_VCPUS case, the vCPU threads should be placed
all into one scheduling group, but not the emulator or any of its
threads. Therefore, as soon as vCPU TIDs are detected, fork off a
child which then creates a separate scheduling group and adds all
vCPU threads into it.

Please note, this commit only handles the cold boot case. Hotplug
is going to be implemented in the next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 09:00:45 +02:00
Michal Privoznik
000477115e qemu: Enable SCHED_CORE for helper processes
For QEMU_SCHED_CORE_FULL case, all helper processes should be
placed into the same scheduling group as the QEMU process they
serve. It may happen though, that a helper process is started
before QEMU (cold start of a domain). But we have the dummy
process running from which the QEMU process will inherit the
scheduling group, so we can use the dummy process PID as an
argument to virCommandSetRunAmong().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 09:00:02 +02:00
Michal Privoznik
279527334d qemu_process: Enable SCHED_CORE for QEMU process
For QEMU_SCHED_CORE_EMULATOR or QEMU_SCHED_CORE_FULL the QEMU
process (and its vCPU threads) should be placed into its own
scheduling group. Since we have the dummy process running for
exactly this purpose use its PID as an argument to
virCommandSetRunAmong().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 08:59:15 +02:00
Michal Privoznik
4be75216be qemu_domain: Introduce qemuDomainSchedCoreStart()
The aim of this helper function is to spawn a child process in
which new scheduling group is created. This dummy process will
then used to distribute scheduling group from (e.g. when starting
helper processes or QEMU itself). The process is not needed for
QEMU_SCHED_CORE_NONE case (obviously) nor for
QEMU_SCHED_CORE_VCPUS case (because in that case a slightly
different child will be forked off).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 08:58:18 +02:00
Michal Privoznik
6a1500b4ea qemu_conf: Introduce a knob to set SCHED_CORE
Ideally, we would just pick the best default and users wouldn't
have to intervene at all. But in some cases it may be handy to
not bother with SCHED_CORE at all or place helper processes into
the same group as QEMU. Introduce a knob in qemu.conf to allow
users control this behaviour.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 08:58:10 +02:00
Michal Privoznik
bd481a79d8 virCommand: Introduce APIs for core scheduling
There are two modes of core scheduling that are handy wrt
virCommand:

1) create new trusted group when executing a virCommand

2) place freshly executed virCommand into the trusted group of
   another process.

Therefore, implement these two new operations as new APIs:
virCommandSetRunAlone() and virCommandSetRunAmong(),
respectively.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 08:51:50 +02:00
Michal Privoznik
c935cead2d virprocess: Core Scheduling support
Since its 5.14 release the Linux kernel allows userspace to
define trusted groups of processes/threads that can run on
sibling Hyper Threads (HT) at the same time. This is to mitigate
side channel attacks like L1TF or MDS. If there are no tasks to
fully utilize all HTs, then a HT will idle instead of running a
task from another (un-)trusted group.

On low level, this is implemented by cookies (effectively an UL
value): processes in the same trusted group share the same cookie
and cookie is unique to the group. There are four basic
operations:

1) PR_SCHED_CORE_GET -- get cookie of given PID,
2) PR_SCHED_CORE_CREATE -- create a new unique cookie for PID,
3) PR_SCHED_CORE_SHARE_TO -- push cookie of the caller onto
   another PID,
4) PR_SCHED_CORE_SHARE_FROM -- pull cookie of another PID into
   the caller.

Since a system where the code is built can be different to the
one where the code is ran let's provide declaration of some
values. It's not unusual for distros to ship older linux-headers
than the actual kernel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-20 08:51:50 +02:00
Michal Privoznik
060d4c83ef qemu: Refresh rx-filters more often
There are couple of scenarios where we need to reflect MAC change
done in the guest:

  1) domain restore from a file (here, we don't store updated MAC
     in the save file and thus on restore create the macvtap with
     the original MAC),
  2) reconnecting to a running domain (here, the guest might have
     changed the MAC while we were not running),
  3) migration (here, guest might change the MAC address but we
     fail to respond to it,

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-20 08:48:31 +02:00
Michal Privoznik
7356dce2b3 qemu: Refresh state after restore from a save image
When restoring a domain from a save image, we need to query QEMU
for some runtime information that is not stored in status XML, or
even if it is, it's not parsed (e.g. virtio-mem actual size, or
soon rx-filters for macvtaps).

During migration, this is done in qemuMigrationDstFinishFresh(),
or in case of newly started domain in qemuProcessStart(). Except,
the way that the code is written, when restoring from a save
image (which is effectively a migration), the state is never
refreshed, because qemuProcessStart() sees incoming migration so
it does not refresh the state thinking it'll be done in the
finish phase. But restoring from a save image has no finish
phase. Therefore, refresh the state explicitly after the domain
was restored but before vCPUs are resumed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-20 08:48:14 +02:00
Michal Privoznik
43973de6f1 qemu: Acquire QUERY job instead of MODIFY when handling NIC_RX_FILTER_CHANGED event
We are not updating domain XML to new MAC address, just merely
setting host side of macvtap. But we don't need a MODIFY job for
that, QUERY is just fine.

This allows us to process the event should it occur during
migration.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-20 08:47:59 +02:00
Michal Privoznik
ebb1e41b3a qemu: Move parts of NIC_RX_FILTER_CHANGED event handling into a function
Parts of the code that responds to the NIC_RX_FILTER_CHANGED
event are going to be re-used. Separate them into a function
(qemuDomainSyncRxFilter()) and move the code into qemu_domain.c
so that it can be re-used from other places of the driver.

There's one slight change though: instead of passing device alias
from the just received event to qemuMonitorQueryRxFilter(), I've
switched to using the alias stored in our domain definition. But
these two are guaranteed to be equal. virDomainDefFindDevice()
made sure about that, if nothing else.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-20 08:47:31 +02:00
Michal Privoznik
1eaf118ce1 processNicRxFilterChangedEvent: Free @guestFilter and @hostFilter automatically
There's no need to call virNetDevRxFilterFree() explicitly, when
corresponding variables can be declared as
g_autoptr(virNetDevRxFilter).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-20 08:44:33 +02:00
Cole Robinson
a58da46415 test: Fix parsing nested <volume> XML
Reproducer:

./build/tools/virsh \
    --connect test:///`pwd`/examples/xml/test/testnodeinline.xml \
    vol-list default-pool

Fixes: b3e33a0ef7

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-10-19 16:40:36 -04:00
Cole Robinson
f1aa092334 examples: testdriver: Add a nested inline <volume> example
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-10-19 16:40:36 -04:00
Cole Robinson
a66aa06619 examples: testdriver: Add xmlns runstate example
The testdriver has xmlns support for overriding object default
state. demo it by pausing a VM

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-10-19 16:40:36 -04:00
Pavel Hrdina
33178b9e52 vircgroup: rework virCgroupNewSelf
With the introduction of `libvirt` sub-directory to the cgroup topology
some of the cgroup configuration was moved into that sub-directory
together with the VM processes.

LXC uses virCgroupNewSelf() in the container process to detect cgroups
in order to report various data from cgroups inside the container.

We need to properly detect the new `libvirt` sub-directory here
otherwise LXC will report incorrect data.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-19 16:32:30 +02:00
Pavel Hrdina
76ff847386 vircgroupmock: fix cgroup v1 mocking
The `legacy` mode is also valid so we need to take it into account as
well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-19 16:32:14 +02:00
Martin Kletzander
f53988d657 docs: Do not support non-socket activated modular daemons with systemd
Due to the setup of the modular daemon service files the reverting to non-socket
activated daemons could have never worked.  The reason is that masking the
socket files prevents starting the daemons since they require (as in Requires=
rather than Wants= in the service file) the sockets.  On top of that it creates
issues with some libvirt-guests setups and needlessly increases our support
matrix.

Nothing prevents users to modify their setup in a way that will still work
without socket activation, but supporting such setup only creates burden on our
part.

This technically reverts most of commit 59d30adacd except the change made to
the libvirtd manpage since the monolithic daemon still supports traditional mode
of starting even on systemd.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2022-10-19 15:58:29 +02:00
Amneesh Singh
8c9e3dae14 qemu_driver: add new stats worker qemuDomainGetStatsVm
This patch adds a new worker qemuDomainGetStatsVm which reports the
stats returned by "query-stats" via qemuMonitorQueryStats for the VM
target.

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Amneesh Singh
0f867a3831 qemu_driver: add the vCPU stats by KVM to the current stats
This patch adds the stats queried by qemuMonitorQueryStats for vCPU and
add them according to their QOM device path

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Amneesh Singh
b86c77dff2 qemu_monitor: add qemuMonitorGetStatsByQOMPath
This function returns the virJSONValue object which has the
same qom_path as specified.

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Amneesh Singh
08af53dcaa qemu_domain: add statsSchema to qemuDomainObjPrivate
This patch adds a hashtable for storing the stats schema and a function
to refresh it by querying "query-stats-schemas" using
qemuMonitorQueryStatsSchema

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Amneesh Singh
415f8b2233 qemu_capabilities: add "query-stats-schemas" QMP command to the QEMU capabilities
Related: https://gitlab.com/libvirt/libvirt/-/issues/276

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Amneesh Singh
e89acdbc3b qemu_monitor: add qemuMonitorQueryStatsSchema
Related: https://gitlab.com/libvirt/libvirt/-/issues/276

This patch adds a simple API for "query-stats-schemas" QMP command

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Martin Kletzander
d057b0bfc4 qemu_driver: Fix indentation in qemuDomainGetStatsVcpu
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2022-10-19 15:57:43 +02:00
Tim Wiederhake
ad5a9fbb97 cputestdata: Fix test data for EPYC 7502
Commit 5c17a7ba41 introduced a new feature (ibrs) but did not update
existing cputestdata.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-19 14:25:57 +02:00
Jim Fehlig
124ca008e8 NEWS: Mention new channel and redirdev devices in domcaps
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-18 07:28:40 -06:00
Jim Fehlig
71d9836ca1 conf: Add channel devices to domain capabilities
As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds channel devices to domain capabilities, allowing clients such
as virt-install to avoid using spicevmc channel devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-17 11:39:00 -06:00
Ján Tomko
2cf14c311b docs: formatdomain: fix since tag for TPM PCR banks
Fixes: a5bbe1a8b6
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-10-17 14:27:21 +02:00
Peter Krempa
e8213fb70a qemu: validate: Clarify error messages for unsupported 3d video acceleration
The error message doesn't really convey the information that 3d
acceleration works only for the 'virtio' model and similarly the same
error would be reported if qemu doesn't support acceleration, which is
hard to debug.

Split and clarify the errors.

Noticed in https://gitlab.com/libvirt/libvirt/-/issues/388

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-10-17 14:13:24 +02:00
Jiang Jiacheng
c341df33ac capabilities: use g_autofree in capabilities.c
Use g_autofree in capabilities.c for some pointers still using manual cleanup,
and remove unnecessary cleanup.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-17 10:56:38 +02:00
ttxine
c90ee1441f virvhba.c: use g_autofree
Change strings to use g_autofree.

Signed-off-by: Maxim Kostin <ttxinee@outlook.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-17 10:52:11 +02:00
Michal Privoznik
babcbf2d5c qemu: Create base hugepages path on memory hotplug
Users can play all sorts of games with mount points. For
instance, they can unmount and mount back a hugetlbfs and only
after that attempt to hotplug memory.

This has an unfortunate consequence though. During memory
hotplug, when qemuProcessBuildDestroyMemoryPaths() is called the
path is created with very restrictive mode (0700) because under
the hood g_mkdir_with_parents(path, 0700) is called.

Therefore, create the driver generic portion of the path
separately.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2134009
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-17 08:40:58 +02:00
Michal Privoznik
72adf3b717 qemu: Separate out hugepages basedir making
During its initialization, the QEMU driver iterates over
hugetlbfs mount points, creating the driver specific path in each
of them ($prefix/libvirt/qemu). This path is created with very
wide mode (0777) because per-domain directories are then created
under it.

Separate this code into a function so that it can be re-used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-17 08:40:18 +02:00
Jim Fehlig
e7d6f2d958 qemu: Use command line to properly check for spice support
domcapabilities reports spice graphics support even against a minimal
qemu installation without spice modules. Checking for 'query-spice'
in the list of qmp commands supported by qemu is not sufficient to
determine spice support. Checking the command line produces acurrate
results.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-14 16:10:11 -06:00
Jim Fehlig
4e13cc4adb conf: Add USB redirect devices to domain capabilities
As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds USB redirect devices to domain capabilities, allowing clients
such as virt-install to avoid using redirdev devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-14 16:10:01 -06:00
Peter Krempa
ad5c4be09f schema: Re-structure schema for <filesystem> to avoid broken validation
The validation of a '<filesystem type='mount'>' device fails if the
elements inside are not ordered in the order in the schema despite using
<interleave>. This is a bug in libxml2's validator as removing the
'<optional>' property from the definition of the 'type' attribute with
'mount' variable fixes the problem.

I've reported it as another instance of a seemingly related issue:

  https://gitlab.gnome.org/GNOME/libxml2/-/issues/131

Meanwhile libvirt can re-arrange the schema by extracting the common
bits into a new definition and referencing them from each of the choice
groups explicitly.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/392
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-10-14 09:40:56 +02:00
Daniel Henrique Barboza
06ebad7c78 tests: refactor pseries features parse failure tests
The qemuxml2argvtest pseries-feature parse failure tests uses a symlink
to the pseries-features.xml test domain and control which feature it is
supposed to fail by excluding it from the capabilities list. The
advantage of this approach is that the same XML can be used in multiple
tests.

One downside is that any new pseries capability must be declared in all
existent tests, otherwise all other tests can break if this new
capability happens to be validated early in qemu_validate.c. Any new
parse_error test must declare all other existent capabilities.

Another downside is the fact that we're testing fairly improbable
scenarios: all pseries capabilities being tested here were introduced by
the same QEMU version, 4.2.0, at least as far as libvirt is aware of.
This means that it's no possible to have a scenario where, for example,
ccf-assist is not present but cfpc is. And last, but not the least, it's
getting in the way of our effort to convert all pseries tests to not use
explicit capabilities.

Changing all these tests to use DO_TEST_PARSE_ERROR_NOCAPS() will allow
us to test exactly what we want to test, which is the parse error given
for each feature if the binary does not have support for it. The XML
being used for each test can be simplified to just declare a single
feature. In the end we'll end up with more XML lines, but less
complexity inside qemuxml2argvtest.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:28:01 -03:00