libvirt-11.10.0-15.el9

- qemu: capabilities: Apply 'capability_filters' configration option on all capabilities (RHEL-177646)
- qemu: capabilities: Export 'virQEMUCapsNewCopy' outside of 'qemu_capspriv' (RHEL-177646)
- qemu: Allow reuse of 'qemuProcessStartUpdateCustomCaps' (RHEL-177646)
- qemu: validate: Validate VM config with qemuCaps influenced by <qemu:capabilities> (RHEL-177646)
- qemu: postparse: Process VM config with qemuCaps influenced by <qemu:capabilities> (RHEL-177646)
- virQEMUCapsCacheLookupDefault: Fix error message when no emulators are installed (RHEL-177646)
- qemuxmlconfdata: un-symlink 'video-virtio-vga-gpu-gl' output (RHEL-177646)
- qemuxmlconftest: Add 'video-virtio-vga' invocation with QEMU_CAPS_DEVICE_VIRTIO_VGA disabled (RHEL-177646)
- qemuxmlconftest: Add test cases for configs asking for 'virtio-gpu-gl' or 'virtio-vga-gl' without the capability (RHEL-177646)
- qemuxmlconftest: Add invocation of 'video-virtio-vga-gpu-gl' with missing caps and VIR_DOMAIN_DEF_PARSE_ABI_UPDATE (RHEL-177646)
- qemustatusxml2xml: Add test case capturing virtio video device (RHEL-177646)
- virDomainVideoDefFormat: Use 'virXMLFormatElement' instead of custom formatter (RHEL-177646)
- conf: Add fields for recording actually-selected virtio video device (RHEL-177646)
- qemuxmlconftest: Add test case for specifying 'virtio-gpu' where 'virtio-vga' would be picked (RHEL-177646)
- qemuDeviceVideoGetModel: Directly return picked model (RHEL-177646)
- qemu: postparse: Fill in selected virtio video frondend device in the XML (RHEL-177646)
- qemuValidateDomainDeviceDefVideo: Fix checks of virtio video devices (RHEL-177646)
- qemuDeviceVideoGetModel: Remove logic for selecting 'virtio' devices (RHEL-177646)
- qemuDeviceVideoGetModel: Simplify by relying on checks from 'qemuValidateDomainDeviceDefVideo' (RHEL-177646)
- qemu: Remove 'qemuDomainSupportsVideoVga' (RHEL-177646)

Resolves: RHEL-177646
This commit is contained in:
Jiri Denemark 2026-07-17 16:12:12 +02:00
parent f38c5d71fe
commit ea91cce6f3
21 changed files with 5741 additions and 1 deletions

View File

@ -0,0 +1,211 @@
From ef0dfcf0dea53cc1d8aabc08942a7091c9dbf30c Mon Sep 17 00:00:00 2001
Message-ID: <ef0dfcf0dea53cc1d8aabc08942a7091c9dbf30c.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 8 Jun 2026 16:55:05 +0200
Subject: [PATCH] conf: Add fields for recording actually-selected virtio video
device
QEMU's commandline generator picks for virtio video between various
actual device models not only based on the XML definition but also
capabilities present. Since none of the devices is actually ABI
compatible we need to record the actually selected device in the XML.
Introduce 'device' attribute:
<video>
<model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
which will record the actually selected model so that we can preserve
ABI across restarts on deployment changes but more importantly across
migrations where the deployment differs.
The code specifically avoids an ABI stability check for the new field
because there are already possibly broken configurations that the users
may want to fix by picking the proper model which could be forbidden.
Users are instructed to not set the field in the XML.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b6f7c2d3db28626d4799d00c299e33dae07c5201)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
docs/formatdomain.rst | 8 +++++++
src/conf/domain_conf.c | 35 +++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 15 +++++++++++++
src/conf/schemas/domaincommon.rng | 18 +++++++++++++++-
src/libvirt_private.syms | 1 +
5 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 225152e0f2..8e7577f3b7 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -7295,6 +7295,14 @@ A video device.
guest. The ``edid`` attribute is only valid for model types ``vga``, ``bochs``,
and ``virtio``.
+ :since:`Since 12.5.0` the ``virtio`` video model has an additional attribute
+ ``device``, which records the specific virtio device model which was picked
+ for the configuration, to preserve guest ABI and migration compatibility.
+ Users do not need to set this attribute as aprropriate value is picked and
+ filled in automatically. Accepted values are ``virtio-vga``, ``virtio-gpu``,
+ ``virtio-vga-gl``, and ``virtio-gpu-gl``, but not all combinations of config
+ and this field make sense.
+
``acceleration``
Configure if video acceleration should be enabled.
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dc19e258dd..47200d27c5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -909,6 +909,17 @@ VIR_ENUM_IMPL(virDomainVideoVGAConf,
"off",
);
+VIR_ENUM_IMPL(virDomainVideoVirtioDevice,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_LAST,
+ "",
+ "virtio-vga",
+ "virtio-gpu",
+ "virtio-vga-gl",
+ "virtio-gpu-gl",
+ "vhost-user-vga",
+ "vhost-user-gpu",
+);
+
VIR_ENUM_IMPL(virDomainInput,
VIR_DOMAIN_INPUT_TYPE_LAST,
"mouse",
@@ -13726,6 +13737,14 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *def,
VIR_DOMAIN_VIDEO_TYPE_DEFAULT) < 0)
return -1;
+ if (def->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ if (virXMLPropEnumDefault(node, "device",
+ virDomainVideoVirtioDeviceTypeFromString,
+ VIR_XML_PROP_NONZERO, &def->virtiodevice,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_DEFAULT) < 0)
+ return -1;
+ }
+
if (virXMLPropUInt(node, "ram", 10, VIR_XML_PROP_NONE, &def->ram) < 0)
return -1;
@@ -21437,6 +21456,18 @@ virDomainVideoDefCheckABIStability(virDomainVideoDef *src,
return false;
}
+ /* While 'src->virtiodevice' vs 'dst->virtiodevice' match is considered
+ * guest ABI (both the device looks different to the guest OS and qemu
+ * refuses to migrate into wrong device) we deliberately omit the check
+ * here due to historical reasons.
+ *
+ * The actual values were not recorded in the XML after picking a device
+ * based on capabilities and thus, if the host configuration changes
+ * different defaults can be picked. Users might want to fix their
+ * saveimage or migration by specifying the proper model which will differ
+ * from the one that will be auto-picked via post-parse callback when the
+ * XML is loaded for the first time */
+
if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
return false;
@@ -27110,6 +27141,10 @@ virDomainVideoDefFormat(virBuffer *buf,
if (def->edid != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(&modelAttrBuf, " edid='%s'", virTristateSwitchTypeToString(def->edid));
+ if (def->virtiodevice != VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_DEFAULT)
+ virBufferAsprintf(&modelAttrBuf, " device='%s'",
+ virDomainVideoVirtioDeviceTypeToString(def->virtiodevice));
+
virDomainVideoAccelDefFormat(&modelChildBuf, def->accel);
virDomainVideoResolutionDefFormat(&modelChildBuf, def->res);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8c8c11c0cf..3a1a2fdce1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1877,6 +1877,20 @@ typedef enum {
VIR_ENUM_DECL(virDomainVideoVGAConf);
+typedef enum {
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_DEFAULT = 0,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA_GL,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU_GL,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_VGA,
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_GPU,
+
+ VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_LAST
+} virDomainVideoVirtioDevice;
+
+VIR_ENUM_DECL(virDomainVideoVirtioDevice);
+
struct _virDomainVideoAccelDef {
virTristateBool accel2d;
virTristateBool accel3d;
@@ -1907,6 +1921,7 @@ struct _virDomainVideoDef {
virDomainVideoResolutionDef *res;
virTristateSwitch blob;
virDomainVideoDriverDef *driver;
+ virDomainVideoVirtioDevice virtiodevice; /* virtio device frontend */
virDomainDeviceInfo info;
virDomainVirtioOptions *virtio;
virDomainVideoBackendType backend;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 9fde565d94..b8283f129e 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -4812,7 +4812,6 @@
<value>vmvga</value>
<value>xen</value>
<value>vbox</value>
- <value>virtio</value>
<value>gop</value>
<value>none</value>
<value>bochs</value>
@@ -4839,6 +4838,23 @@
</attribute>
</optional>
</group>
+ <group>
+ <attribute name="type">
+ <value>virtio</value>
+ </attribute>
+ <optional>
+ <attribute name="device">
+ <choice>
+ <value>virtio-vga</value>
+ <value>virtio-vga-gl</value>
+ <value>virtio-gpu</value>
+ <value>virtio-gpu-gl</value>
+ <value>vhost-user-vga</value>
+ <value>vhost-user-gpu</value>
+ </choice>
+ </attribute>
+ </optional>
+ </group>
</choice>
<optional>
<attribute name="vram">
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4a0f9065fa..b9f5056693 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -728,6 +728,7 @@ virDomainVideoTypeFromString;
virDomainVideoTypeToString;
virDomainVideoVGAConfTypeFromString;
virDomainVideoVGAConfTypeToString;
+virDomainVideoVirtioDeviceTypeToString;
virDomainVirtTypeFromString;
virDomainVirtTypeToString;
virDomainVsockDefEquals;
--
2.55.0

View File

@ -0,0 +1,194 @@
From 8ceddabb12d1b32fbcffe9697885462af133d309 Mon Sep 17 00:00:00 2001
Message-ID: <8ceddabb12d1b32fbcffe9697885462af133d309.1784297531.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 11 Jun 2026 12:00:45 +0200
Subject: [PATCH] qemu: Allow reuse of 'qemuProcessStartUpdateCustomCaps'
Move and rename the function to 'qemuDomainUpdateCustomCapabilities' and
modify the arguments so that it will be possible to reuse it also in the
post-parse and validation code which ought to base decisions on the same
logic as VM startup would.
Since copying of the qemu capabilities object is very expensive (I've
observed an almost 4x slowdown of qemuxmlconftest)
'qemuDomainUpdateCustomCapabilities' copies the capabilities only when
necessary.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 9ec26e2c4f7c60a1ba62a90948a51a7ac0f582d8)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_domain.c | 79 +++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 6 ++++
src/qemu/qemu_process.c | 42 +---------------------
3 files changed, 86 insertions(+), 41 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 495cbd4f7d..7699d1000f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11769,3 +11769,82 @@ qemuDomainMachineSupportsFloppy(const char *machine,
return true;
}
+
+
+/**
+ * qemuDomainUpdateCustomCapabilities:
+ * @def: domain definition
+ * @qemuCaps: qemu capabilities
+ * @qemuCapsCopy: if non-NULL filled filled with a valid virQEMUCaps pointer (see below)
+ *
+ * Updates @qemuCaps based on the qemu namespace XML config for modifying
+ * capabilities:
+ *
+ * <domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
+ * <qemu:capabilities>
+ * <qemu:add capability='blockdev'/>
+ * <qemu:del capability='drive'/>
+ * </qemu:capabilities>
+ * </domain>
+ *
+ * If @qemuCapsCopy is NULL, @qemuCaps is directly modified.
+ *
+ * If @qemuCapsCopy is non-NULL, it's always filled with a virQEMUCaps instance
+ * that the caller needs to unref. The following applies:
+ * - no caps modification needed: @qemuCaps is ref'd and filled into @qemuCapsCopy
+ * - caps modifications are needed: @qemuCaps is copied into @qemuCapsCopy and
+ * modifications happen on the copy
+ *
+ * Returns 0 on success (including when no modification was needed), -1 on
+ * error and reports libvirt errors.
+ */
+int
+qemuDomainUpdateCustomCapabilities(const virDomainDef *def,
+ virQEMUCaps *qemuCaps,
+ virQEMUCaps **qemuCapsCopy)
+{
+ qemuDomainXmlNsDef *nsdef = def->namespaceData;
+ char **next;
+ int tmp;
+
+ if (!nsdef ||
+ (!nsdef->capsadd && !nsdef->capsdel)) {
+
+ if (qemuCapsCopy)
+ *qemuCapsCopy = virObjectRef(qemuCaps);
+
+ return 0;
+ }
+
+ if (qemuCapsCopy) {
+ *qemuCapsCopy = virQEMUCapsNewCopy(qemuCaps);
+
+ qemuCaps = *qemuCapsCopy;
+ }
+
+ for (next = nsdef->capsadd; next && *next; next++) {
+ if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid qemu namespace capability '%1$s'"),
+ *next);
+ return -1;
+ }
+
+ virQEMUCapsSet(qemuCaps, tmp);
+ }
+
+ for (next = nsdef->capsdel; next && *next; next++) {
+ if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid qemu namespace capability '%1$s'"),
+ *next);
+ return -1;
+ }
+
+ virQEMUCapsClear(qemuCaps, tmp);
+ }
+
+ virQEMUCapsInitProcessCapsInterlock(qemuCaps);
+
+ return 0;
+}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 8cd221062c..ff26885ffe 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1197,3 +1197,9 @@ qemuDomainMachineSupportsFloppy(const char *machine,
virObject *
qemuDomainHostdevPrivateNew(void);
+
+int
+qemuDomainUpdateCustomCapabilities(const virDomainDef *def,
+ virQEMUCaps *qemuCaps,
+ virQEMUCaps **qemuCapsCopy)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7d9f754fc2..1540c74087 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5823,43 +5823,6 @@ qemuProcessStartValidate(virQEMUDriver *driver,
}
-static int
-qemuProcessStartUpdateCustomCaps(virDomainObj *vm)
-{
- qemuDomainObjPrivate *priv = vm->privateData;
- qemuDomainXmlNsDef *nsdef = vm->def->namespaceData;
-
- if (nsdef) {
- char **next;
- int tmp;
-
- for (next = nsdef->capsadd; next && *next; next++) {
- if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid qemu namespace capability '%1$s'"),
- *next);
- return -1;
- }
-
- virQEMUCapsSet(priv->qemuCaps, tmp);
- }
-
- for (next = nsdef->capsdel; next && *next; next++) {
- if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid qemu namespace capability '%1$s'"),
- *next);
- return -1;
- }
-
- virQEMUCapsClear(priv->qemuCaps, tmp);
- }
- }
-
- return 0;
-}
-
-
/**
* qemuProcessPrepareQEMUCaps:
* @vm: domain object
@@ -5883,12 +5846,9 @@ qemuProcessPrepareQEMUCaps(virDomainObj *vm,
return -1;
/* Update qemu capabilities according to lists passed in via namespace */
- if (qemuProcessStartUpdateCustomCaps(vm) < 0)
+ if (qemuDomainUpdateCustomCapabilities(vm->def, priv->qemuCaps, NULL) < 0)
return -1;
- /* re-process capability lockouts since we might have removed capabilities */
- virQEMUCapsInitProcessCapsInterlock(priv->qemuCaps);
-
return 0;
}
--
2.55.0

View File

@ -0,0 +1,64 @@
From 5b39266bbc99576fec79c1dc9e24823a9aaa3602 Mon Sep 17 00:00:00 2001
Message-ID: <5b39266bbc99576fec79c1dc9e24823a9aaa3602.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 9 Jun 2026 22:58:54 +0200
Subject: [PATCH] qemu: Remove 'qemuDomainSupportsVideoVga'
The function is unused remove it.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit a95619316406b43457c0fb1436031042d5e25bec)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_domain.c | 17 -----------------
src/qemu/qemu_domain.h | 3 ---
2 files changed, 20 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7699d1000f..78587e2574 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9267,23 +9267,6 @@ qemuDomainVcpuPersistOrder(virDomainDef *def)
}
-bool
-qemuDomainSupportsVideoVga(const virDomainVideoDef *video,
- virQEMUCaps *qemuCaps)
-{
- if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
- if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_VGA))
- return false;
- } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA)) {
- return false;
- }
- }
-
- return true;
-}
-
-
/**
* qemuDomainNeedsVFIO:
* @def: domain definition to check
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index ff26885ffe..a8bf301d51 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -985,9 +985,6 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDef *def)
void qemuDomainVcpuPersistOrder(virDomainDef *def)
ATTRIBUTE_NONNULL(1);
-bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video,
- virQEMUCaps *qemuCaps);
-
bool qemuDomainNeedsVFIO(const virDomainDef *def);
int qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
--
2.55.0

View File

@ -0,0 +1,247 @@
From 2564c0a45ab725c84deb64abc4fb57ad263fad15 Mon Sep 17 00:00:00 2001
Message-ID: <2564c0a45ab725c84deb64abc4fb57ad263fad15.1784297531.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 11 Jun 2026 11:33:36 +0200
Subject: [PATCH] qemu: capabilities: Apply 'capability_filters' configration
option on all capabilities
The 'capability_filters' allows admins to globally disable some qemu
capabilities via the config file.
Until now it was applied only directly when starting the VM, but that is
too late as the capability is still present when e.g. the post-parse
code is picking defaults.
Rework the code so that 'capability_filters' is applied directly after
probing qemu so all existing capabilities will lack the filtered out
ones.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b8dfb9551e4cafebea94fc09b2ab51f63dfa8512)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_capabilities.c | 21 ++++++++++++++++++---
src/qemu/qemu_capabilities.h | 3 ++-
src/qemu/qemu_capspriv.h | 3 ++-
src/qemu/qemu_driver.c | 23 ++++++++++++++++++++++-
src/qemu/qemu_process.c | 19 +++----------------
tests/qemucapsprobe.c | 3 ++-
tests/testutilsqemu.c | 3 ++-
7 files changed, 51 insertions(+), 24 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f06f376dd7..83ec1e2769 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4538,6 +4538,11 @@ struct _virQEMUCapsCachePriv {
/* cache whether /dev/kvm is usable as runUid:runGuid */
virTristateBool kvmUsable;
time_t kvmCtime;
+
+ /* qemu.conf allows masking out supported capabilities via
+ * 'capabilities_filter' configuration. 'maskedCaps' if non-NULL
+ * maps out which bits are to be removed */
+ virBitmap *maskedCaps;
};
typedef struct _virQEMUCapsCachePriv virQEMUCapsCachePriv;
@@ -4551,6 +4556,7 @@ virQEMUCapsCachePrivFree(void *privData)
g_free(priv->kernelVersion);
virCPUDataFree(priv->cpuData);
g_free(priv->hostCPUSignature);
+ virBitmapFree(priv->maskedCaps);
g_free(priv);
}
@@ -6110,7 +6116,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
const char *hostCPUSignature,
unsigned int microcodeVersion,
const char *kernelVersion,
- virCPUData* cpuData)
+ virCPUData* cpuData,
+ virBitmap *maskedCaps)
{
g_autoptr(virQEMUCaps) qemuCaps = virQEMUCapsNewBinary(binary);
struct stat sb;
@@ -6149,6 +6156,10 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
qemuCaps->libvirtCtime = virGetSelfLastChanged();
qemuCaps->libvirtVersion = LIBVIR_VERSION_NUMBER;
+ /* If we have capabilities masked out via qemu.conf apply them here */
+ if (maskedCaps)
+ virBitmapSubtract(qemuCaps->flags, maskedCaps);
+
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF))
@@ -6189,7 +6200,8 @@ virQEMUCapsNewData(const char *binary,
priv->hostCPUSignature,
virHostCPUGetMicrocodeVersion(priv->hostArch),
priv->kernelVersion,
- priv->cpuData);
+ priv->cpuData,
+ priv->maskedCaps);
}
@@ -6228,7 +6240,8 @@ virFileCache *
virQEMUCapsCacheNew(const char *libDir,
const char *cacheDir,
uid_t runUid,
- gid_t runGid)
+ gid_t runGid,
+ virBitmap *maskedCaps)
{
g_autofree char *capsCacheDir = NULL;
virFileCache *cache = NULL;
@@ -6258,9 +6271,11 @@ virQEMUCapsCacheNew(const char *libDir,
priv->kernelVersion = g_strdup_printf("%s %s", uts.release, uts.version);
priv->cpuData = virCPUDataGetHost();
+ priv->maskedCaps = maskedCaps;
return cache;
error:
+ virBitmapFree(maskedCaps);
virObjectUnref(cache);
return NULL;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 8822bf120b..8701c76b6d 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -861,7 +861,8 @@ char * virQEMUCapsGetDefaultEmulator(virArch hostarch,
virFileCache *virQEMUCapsCacheNew(const char *libDir,
const char *cacheDir,
uid_t uid,
- gid_t gid);
+ gid_t gid,
+ virBitmap *maskedCaps);
virQEMUCaps *virQEMUCapsCacheLookup(virFileCache *cache,
const char *binary);
virQEMUCaps *virQEMUCapsCacheLookupCopy(virFileCache *cache,
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 55286d7d29..9dca15d09b 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -36,7 +36,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
const char *hostCPUSignature,
unsigned int microcodeVersion,
const char *kernelVersion,
- virCPUData* cpuData);
+ virCPUData* cpuData,
+ virBitmap *maskedCaps);
int virQEMUCapsLoadCache(virArch hostArch,
virQEMUCaps *qemuCaps,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dcb49a9d42..3c7de45301 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -538,6 +538,7 @@ qemuStateInitialize(bool privileged,
const char *defsecmodel = NULL;
g_autoptr(virIdentity) identity = virIdentityGetCurrent();
virDomainDriverAutoStartConfig autostartCfg;
+ g_autoptr(virBitmap) maskedCaps = NULL;
qemu_driver = g_new0(virQEMUDriver, 1);
@@ -817,10 +818,30 @@ qemuStateInitialize(bool privileged,
run_gid = cfg->group;
}
+ if (cfg->capabilityfilters) {
+ int tmp;
+ char **next;
+
+ maskedCaps = virBitmapNew(0);
+
+ for (next = cfg->capabilityfilters; *next; next++) {
+ if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("invalid capability_filters capability '%1$s'"),
+ *next);
+ return -1;
+ }
+
+ virBitmapSetBitExpand(maskedCaps, tmp);
+ }
+ }
+
+
qemu_driver->qemuCapsCache = virQEMUCapsCacheNew(cfg->libDir,
cfg->cacheDir,
run_uid,
- run_gid);
+ run_gid,
+ g_steal_pointer(&maskedCaps));
if (!qemu_driver->qemuCapsCache)
goto error;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b56e79ed1c..7d9f754fc2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5827,25 +5827,12 @@ static int
qemuProcessStartUpdateCustomCaps(virDomainObj *vm)
{
qemuDomainObjPrivate *priv = vm->privateData;
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
qemuDomainXmlNsDef *nsdef = vm->def->namespaceData;
- char **next;
- int tmp;
-
- if (cfg->capabilityfilters) {
- for (next = cfg->capabilityfilters; *next; next++) {
- if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid capability_filters capability '%1$s'"),
- *next);
- return -1;
- }
-
- virQEMUCapsClear(priv->qemuCaps, tmp);
- }
- }
if (nsdef) {
+ char **next;
+ int tmp;
+
for (next = nsdef->capsadd; next && *next; next++) {
if ((tmp = virQEMUCapsTypeFromString(*next)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/tests/qemucapsprobe.c b/tests/qemucapsprobe.c
index cd117170ab..8ce5c10dec 100644
--- a/tests/qemucapsprobe.c
+++ b/tests/qemucapsprobe.c
@@ -79,7 +79,8 @@ main(int argc, char **argv)
return EXIT_FAILURE;
if (!(caps = virQEMUCapsNewForBinaryInternal(VIR_ARCH_NONE, argv[1], "/tmp",
- -1, -1, NULL, 0, NULL, NULL)))
+ -1, -1, NULL, 0, NULL, NULL,
+ NULL)))
return EXIT_FAILURE;
host = virArchFromHost();
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index fc51e0e3df..bd797525f0 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -363,7 +363,8 @@ int qemuTestDriverInit(virQEMUDriver *driver)
/* Using /dev/null for libDir and cacheDir automatically produces errors
* upon attempt to use any of them */
- driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null", 0, 0);
+ driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null",
+ 0, 0, NULL);
if (!driver->qemuCapsCache)
goto error;
--
2.55.0

View File

@ -0,0 +1,66 @@
From 173a0b7768999f9be2eb0e16bad6a3eaf12fbb74 Mon Sep 17 00:00:00 2001
Message-ID: <173a0b7768999f9be2eb0e16bad6a3eaf12fbb74.1784297531.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 11 Jun 2026 12:12:42 +0200
Subject: [PATCH] qemu: capabilities: Export 'virQEMUCapsNewCopy' outside of
'qemu_capspriv'
Upcoming patch will add a function which will need to optionally copy
passed capabilities for modification. Export 'virQEMUCapsNewCopy'
outside of tests.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 1bbefb6409d43969505db7a71999943e40aa9c9d)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_capabilities.c | 3 ++-
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_capspriv.h | 2 --
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 83ec1e2769..6dd7284505 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2082,7 +2082,8 @@ virQEMUCapsAccelCopy(virQEMUCapsAccel *dst,
}
-virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps)
+virQEMUCaps *
+virQEMUCapsNewCopy(virQEMUCaps *qemuCaps)
{
g_autoptr(virQEMUCaps) ret = virQEMUCapsNewBinary(qemuCaps->binary);
size_t i;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 8701c76b6d..334e98aac4 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -876,6 +876,8 @@ virQEMUCaps *virQEMUCapsCacheLookupDefault(virFileCache *cache,
virDomainVirtType *retVirttype,
const char **retMachine);
+virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps);
+
virCaps *virQEMUCapsInit(virFileCache *cache);
int virQEMUCapsGetDefaultVersion(virCaps *caps,
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 9dca15d09b..3dfff2e3d8 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -25,8 +25,6 @@
#pragma once
-virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps);
-
virQEMUCaps *
virQEMUCapsNewForBinaryInternal(virArch hostArch,
const char *binary,
--
2.55.0

View File

@ -0,0 +1,931 @@
From 53bcd009b21687baecb0568bc4b4768b03c3ad89 Mon Sep 17 00:00:00 2001
Message-ID: <53bcd009b21687baecb0568bc4b4768b03c3ad89.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 8 Jun 2026 16:54:50 +0200
Subject: [PATCH] qemu: postparse: Fill in selected virtio video frondend
device in the XML
Historically 'virtio-vga' was always picked as the first '<video>'
(virtio) device and any sub-sequent ones were 'virtio-gpu'. When support
for aarch64 VMs was being added an exception to use 'virtio-gpu' for the
primary device was added as aarch64 doesn't have anything resembling the
"legacy" 'VGA' interface. At this point this exception was only for
aarch64. The distinction between 'virtio-vga' and 'virtio-gpu' was *not*
recorded in the VM XML as it was a new feature (for aarch64) and it
didn't make sense to pick 'virtio-vga'.
Some time later the following commit:
commit 4c029e8cfa3338ef1a2d6851908a9fcf494a32e5
Author: Pavel Hrdina <phrdina@redhat.com>
Date: Fri Sep 30 14:41:37 2016 +0200
qemu_command: properly detect which model to use for video device
This improves commit 706b5b6277 in a way that we check qemu capabilities
instead of what architecture we are running on to detect whether we can
use *virtio-vga* model or not. This is not a case only for arm/aarch64.
modified the code to do this picking by checking presence of
'virtio-vga' device instead. That approach didn't consider the fact that
the modular deployment of qemu allows for the 'virtio-vga' device to be
missing in certain cases, thus introducing a latent bug as we'll pick
'virtio-gpu' in such case but don't record it anywhere.
Now this creates a problem, if the deployments differ, because you can
have two *incompatible* (at migration stream level) setups which are
based on the same identical XML without the possibility for the
destination libvirt instance during migration to pick which is the
correct one.
To prevent this and actually fix any existing such deployment (which
allows upgrade of libvirt daemons on the source) we will record the
picked device frontend at post-parse time into the XML. This luckily
properly handles running VMs even if 'virtio-vga' were already
installed since we record the actual qemuCaps we've started the VM with.
Now 'virtio-vga' vs 'virtio-gpu' is not the only broken piece of logic.
In fact 'virtio-vga-gl' could have been downgraded to 'virtio-vga' based
on some very weird logic (see comments in code for explanation).
The logic in 'qemuDomainDeviceVideoDefPostParse' re-creates the logic
used to setup virtio-vga vs. virtio-gpu, and 'vhost-user-vga' vs.
'vhost-user-gpu' as those still make sense. For the 'gl' variants two
versions exist, one meant to recover running VMs and one for new VMs
where the broken logic makes no sense.
Now this patch just records what was selected into the XML, but doesn't
yet modify the commandline to actually use that value verbatim (e.g. if
the user specified an actual non-default value already).
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 38c970f64187b42605f611000a6b4c0e2dedd0d8)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_postparse.c | 97 ++++++++++++++++++-
.../virtio-vga-upgrade-missing-out.xml | 2 +-
.../virtio-vga-upgrade-out.xml | 2 +-
.../aarch64-video-default.aarch64-latest.xml | 2 +-
...64-video-virtio-gpu-pci.aarch64-latest.xml | 2 +-
...fault-models.aarch64-latest.abi-update.xml | 2 +-
...h64-virt-default-models.aarch64-latest.xml | 2 +-
.../aarch64-virt-graphics.aarch64-latest.xml | 2 +-
...ault-video-type-aarch64.aarch64-latest.xml | 2 +-
...eo-type-loongarch64.loongarch64-latest.xml | 2 +-
...ault-video-type-riscv64.riscv64-latest.xml | 2 +-
.../default-video-type-s390x.s390x-latest.xml | 2 +-
...t-models.loongarch64-latest.abi-update.xml | 2 +-
...virt-default-models.loongarch64-latest.xml | 2 +-
...rch64-virt-graphics.loongarch64-latest.xml | 2 +-
.../q35-pcie-autoadd.x86_64-latest.xml | 2 +-
.../q35-pcie.x86_64-latest.xml | 2 +-
...fault-models.riscv64-latest.abi-update.xml | 2 +-
...v64-virt-default-models.riscv64-latest.xml | 2 +-
.../riscv64-virt-graphics.riscv64-latest.xml | 2 +-
...default-models.s390x-latest.abi-update.xml | 2 +-
.../s390x-ccw-default-models.s390x-latest.xml | 2 +-
.../s390x-ccw-graphics.s390x-latest.xml | 2 +-
...vhost-user-gpu-secondary.x86_64-latest.xml | 4 +-
.../vhost-user-vga.x86_64-latest.xml | 2 +-
.../video-virtio-blob-off.x86_64-latest.xml | 4 +-
.../video-virtio-blob-on.x86_64-latest.xml | 4 +-
.../video-virtio-edid-none.x86_64-latest.xml | 2 +-
.../video-virtio-edid-off.x86_64-latest.xml | 2 +-
.../video-virtio-edid-on.x86_64-latest.xml | 2 +-
...video-virtio-gpu-ccw-auto.s390x-latest.xml | 2 +-
.../video-virtio-gpu-ccw.s390x-latest.xml | 4 +-
.../video-virtio-gpu-device.x86_64-latest.xml | 2 +-
.../video-virtio-gpu-sdl-gl.x86_64-latest.xml | 2 +-
...deo-virtio-gpu-secondary.x86_64-latest.xml | 4 +-
...ideo-virtio-gpu-spice-gl.x86_64-latest.xml | 2 +-
.../video-virtio-gpu-virgl.x86_64-latest.xml | 2 +-
..._VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml | 2 +-
...t.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml | 4 +-
...CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml | 4 +-
...atest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml | 4 +-
.../video-virtio-vga-gpu-gl.x86_64-latest.xml | 4 +-
...t.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml | 2 +-
.../video-virtio-vga.x86_64-latest.xml | 2 +-
...virtio-options-video-ats.x86_64-latest.xml | 4 +-
...rtio-options-video-iommu.x86_64-latest.xml | 4 +-
...tio-options-video-packed.x86_64-latest.xml | 4 +-
tests/qemuxmlconfdata/virtio-options.xml | 2 +-
48 files changed, 154 insertions(+), 61 deletions(-)
diff --git a/src/qemu/qemu_postparse.c b/src/qemu/qemu_postparse.c
index cd88cd1806..0d803a8abb 100644
--- a/src/qemu/qemu_postparse.c
+++ b/src/qemu/qemu_postparse.c
@@ -308,7 +308,8 @@ qemuDomainDefaultVideoDevice(const virDomainDef *def,
static int
qemuDomainDeviceVideoDefPostParse(virDomainVideoDef *video,
const virDomainDef *def,
- virQEMUCaps *qemuCaps)
+ virQEMUCaps *qemuCaps,
+ unsigned int parseFlags)
{
if (video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT)
video->type = qemuDomainDefaultVideoDevice(def, qemuCaps);
@@ -318,6 +319,98 @@ qemuDomainDeviceVideoDefPostParse(virDomainVideoDef *video,
video->vgamem = QEMU_QXL_VGAMEM_DEFAULT;
}
+ /* Fill in 'virtiodevice' (device='%s' attribute in XML.
+ *
+ * Historically for <video><model type='virtio' ... the selection of the
+ * actual device type (virtio-vga, virtio-vga-gl, virtio-gpu, virtio-gpu-gl)
+ * was done when formatting commandline based on capabilities.
+ *
+ * Unfortunately neither of the aforementioned models are ABI/migration
+ * compatible. We must thus record the selcted model in the XML and that
+ * possibly retroactively based on the capabilities.
+ *
+ * For non accelerated video devices the logic is as follows:
+ * - for any secondary video device 'virtio-gpu' is always picked
+ * - for 'primary' video device 'virtio-vga' is used if available. If not
+ * 'virtio-gpu' is picked instead.
+ *
+ * We want to use the above logic both for existing VMs and new VMs since
+ * this is currently the proper configuration.
+ *
+ * For accelerated video devices the logic is slightly more broken as the
+ * fallbacks depended both on which of 'virtio-vga', 'virtio-vga-gl',
+ * 'virtio-gpu-gl', modules was actually found (see code below).
+ *
+ * For new VMs we do not want to fall back to non-gl versions since that
+ * disables acceleration.
+ */
+ if (qemuCaps &&
+ video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+ video->virtiodevice == VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_DEFAULT) {
+ /* in certain cases video->primary was not yet assigned */
+ bool primary = video->primary || (video == def->videos[0]);
+
+ if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
+ /* primary device is 'vhost-user-vga' if available */
+ if (primary &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_VGA)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_VGA;
+ } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_GPU;
+ } else {
+ /* Don't fill in default; let validation reject the config */
+ }
+ } else {
+ if (video->accel &&
+ video->accel->accel3d == VIR_TRISTATE_BOOL_YES) {
+ /* if starting a new config don't downgrade to the non '-gl' vriants,
+ * allow downgrade only to preserve migration/ABI compatibility */
+ if (parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) {
+ if (primary &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA_GL;
+ } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU_GL;
+ } else {
+ /* Don't fill in default; let validation reject the config */
+ }
+ } else {
+ /* This logic is wrong, but faithfully represents the device
+ * the qemu driver would pick for an accelerated video device */
+ if (primary &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA)) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA_GL;
+ } else {
+ /* based on the above check we know this one exists */
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA;
+ }
+ } else {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU_GL;
+ } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU;
+ } else {
+ /* this branch isn't a faithful representation of
+ * the old logic, but the VM wouldn't start anyway
+ * so we might as well make validation reject it */
+ }
+ }
+ }
+ } else {
+ /* primary device is 'virtio-vga' if available */
+ if (primary &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA;
+ } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) {
+ video->virtiodevice = VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU;
+ } else {
+ /* Don't fill in default; let validation reject the config */
+ }
+ }
+ }
+ }
+
return 0;
}
@@ -855,7 +948,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDef *dev,
break;
case VIR_DOMAIN_DEVICE_VIDEO:
- ret = qemuDomainDeviceVideoDefPostParse(dev->data.video, def, qemuCaps);
+ ret = qemuDomainDeviceVideoDefPostParse(dev->data.video, def, qemuCaps, parseFlags);
break;
case VIR_DOMAIN_DEVICE_PANIC:
diff --git a/tests/qemustatusxml2xmldata/virtio-vga-upgrade-missing-out.xml b/tests/qemustatusxml2xmldata/virtio-vga-upgrade-missing-out.xml
index e7b3dd17ed..a58c4cc75f 100644
--- a/tests/qemustatusxml2xmldata/virtio-vga-upgrade-missing-out.xml
+++ b/tests/qemustatusxml2xmldata/virtio-vga-upgrade-missing-out.xml
@@ -423,7 +423,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
diff --git a/tests/qemustatusxml2xmldata/virtio-vga-upgrade-out.xml b/tests/qemustatusxml2xmldata/virtio-vga-upgrade-out.xml
index 948d4c8135..db6099a2bb 100644
--- a/tests/qemustatusxml2xmldata/virtio-vga-upgrade-out.xml
+++ b/tests/qemustatusxml2xmldata/virtio-vga-upgrade-out.xml
@@ -425,7 +425,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
diff --git a/tests/qemuxmlconfdata/aarch64-video-default.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-video-default.aarch64-latest.xml
index 558b8fab3e..c559134106 100644
--- a/tests/qemuxmlconfdata/aarch64-video-default.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-video-default.aarch64-latest.xml
@@ -36,7 +36,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</video>
</devices>
diff --git a/tests/qemuxmlconfdata/aarch64-video-virtio-gpu-pci.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-video-virtio-gpu-pci.aarch64-latest.xml
index a212a28350..167b40887c 100644
--- a/tests/qemuxmlconfdata/aarch64-video-virtio-gpu-pci.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-video-virtio-gpu-pci.aarch64-latest.xml
@@ -38,7 +38,7 @@
</interface>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</video>
</devices>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
index 5abf55cf36..0f1e1a5892 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
@@ -70,7 +70,7 @@
</tpm>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
index 5abf55cf36..0f1e1a5892 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
@@ -70,7 +70,7 @@
</tpm>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-graphics.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-virt-graphics.aarch64-latest.xml
index 98ecc9ac70..e4a899384d 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-graphics.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-graphics.aarch64-latest.xml
@@ -109,7 +109,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/default-video-type-aarch64.aarch64-latest.xml b/tests/qemuxmlconfdata/default-video-type-aarch64.aarch64-latest.xml
index e8fb758a71..c8e8f220be 100644
--- a/tests/qemuxmlconfdata/default-video-type-aarch64.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/default-video-type-aarch64.aarch64-latest.xml
@@ -34,7 +34,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/default-video-type-loongarch64.loongarch64-latest.xml b/tests/qemuxmlconfdata/default-video-type-loongarch64.loongarch64-latest.xml
index 244f57ff8e..41b8bf8133 100644
--- a/tests/qemuxmlconfdata/default-video-type-loongarch64.loongarch64-latest.xml
+++ b/tests/qemuxmlconfdata/default-video-type-loongarch64.loongarch64-latest.xml
@@ -37,7 +37,7 @@
</graphics>
<audio id='1' type='spice'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/default-video-type-riscv64.riscv64-latest.xml b/tests/qemuxmlconfdata/default-video-type-riscv64.riscv64-latest.xml
index 4e138ea717..b9a8152924 100644
--- a/tests/qemuxmlconfdata/default-video-type-riscv64.riscv64-latest.xml
+++ b/tests/qemuxmlconfdata/default-video-type-riscv64.riscv64-latest.xml
@@ -34,7 +34,7 @@
</graphics>
<audio id='1' type='spice'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/default-video-type-s390x.s390x-latest.xml b/tests/qemuxmlconfdata/default-video-type-s390x.s390x-latest.xml
index c8aac8f1bf..d6223b84a0 100644
--- a/tests/qemuxmlconfdata/default-video-type-s390x.s390x-latest.xml
+++ b/tests/qemuxmlconfdata/default-video-type-s390x.s390x-latest.xml
@@ -22,7 +22,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.abi-update.xml b/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.abi-update.xml
index f25d6c2cf0..0d27ffda54 100644
--- a/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.abi-update.xml
@@ -64,7 +64,7 @@
</console>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.xml b/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.xml
index f25d6c2cf0..0d27ffda54 100644
--- a/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.xml
+++ b/tests/qemuxmlconfdata/loongarch64-virt-default-models.loongarch64-latest.xml
@@ -64,7 +64,7 @@
</console>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/loongarch64-virt-graphics.loongarch64-latest.xml b/tests/qemuxmlconfdata/loongarch64-virt-graphics.loongarch64-latest.xml
index 0be35dcba8..7bb6b123ea 100644
--- a/tests/qemuxmlconfdata/loongarch64-virt-graphics.loongarch64-latest.xml
+++ b/tests/qemuxmlconfdata/loongarch64-virt-graphics.loongarch64-latest.xml
@@ -102,7 +102,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/q35-pcie-autoadd.x86_64-latest.xml b/tests/qemuxmlconfdata/q35-pcie-autoadd.x86_64-latest.xml
index c92408d95c..92e3943a20 100644
--- a/tests/qemuxmlconfdata/q35-pcie-autoadd.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/q35-pcie-autoadd.x86_64-latest.xml
@@ -138,7 +138,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<watchdog model='itco' action='reset'/>
diff --git a/tests/qemuxmlconfdata/q35-pcie.x86_64-latest.xml b/tests/qemuxmlconfdata/q35-pcie.x86_64-latest.xml
index 0a36e78e02..b68284320c 100644
--- a/tests/qemuxmlconfdata/q35-pcie.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/q35-pcie.x86_64-latest.xml
@@ -142,7 +142,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<watchdog model='itco' action='reset'/>
diff --git a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
index 620da73422..2e0d5f6634 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
@@ -67,7 +67,7 @@
</tpm>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
index 620da73422..2e0d5f6634 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
+++ b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
@@ -67,7 +67,7 @@
</tpm>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/riscv64-virt-graphics.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-graphics.riscv64-latest.xml
index 9f35b5ed18..0857a00710 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-graphics.riscv64-latest.xml
+++ b/tests/qemuxmlconfdata/riscv64-virt-graphics.riscv64-latest.xml
@@ -99,7 +99,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.abi-update.xml b/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.abi-update.xml
index 9e0af389a9..cd3a00d01a 100644
--- a/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.abi-update.xml
@@ -37,7 +37,7 @@
</console>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.xml b/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.xml
index 9e0af389a9..cd3a00d01a 100644
--- a/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.xml
+++ b/tests/qemuxmlconfdata/s390x-ccw-default-models.s390x-latest.xml
@@ -37,7 +37,7 @@
</console>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
</video>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/s390x-ccw-graphics.s390x-latest.xml b/tests/qemuxmlconfdata/s390x-ccw-graphics.s390x-latest.xml
index c4c4c4cfdb..3865e00da7 100644
--- a/tests/qemuxmlconfdata/s390x-ccw-graphics.s390x-latest.xml
+++ b/tests/qemuxmlconfdata/s390x-ccw-graphics.s390x-latest.xml
@@ -55,7 +55,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/vhost-user-gpu-secondary.x86_64-latest.xml b/tests/qemuxmlconfdata/vhost-user-gpu-secondary.x86_64-latest.xml
index 1362326590..9acf8eff2e 100644
--- a/tests/qemuxmlconfdata/vhost-user-gpu-secondary.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/vhost-user-gpu-secondary.x86_64-latest.xml
@@ -42,12 +42,12 @@
<audio id='1' type='none'/>
<video>
<driver name='vhostuser'/>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='vhost-user-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
<driver name='vhostuser'/>
- <model type='virtio' heads='1'/>
+ <model type='virtio' heads='1' device='vhost-user-gpu'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/vhost-user-vga.x86_64-latest.xml b/tests/qemuxmlconfdata/vhost-user-vga.x86_64-latest.xml
index 9a8bb9f92a..51bf78f8f4 100644
--- a/tests/qemuxmlconfdata/vhost-user-vga.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/vhost-user-vga.x86_64-latest.xml
@@ -42,7 +42,7 @@
<audio id='1' type='none'/>
<video>
<driver name='vhostuser'/>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='vhost-user-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-blob-off.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-blob-off.x86_64-latest.xml
index d8de97a642..4a93f53cca 100644
--- a/tests/qemuxmlconfdata/video-virtio-blob-off.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-blob-off.x86_64-latest.xml
@@ -34,11 +34,11 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes' blob='off'/>
+ <model type='virtio' heads='1' primary='yes' blob='off' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1' blob='off'/>
+ <model type='virtio' heads='1' blob='off' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-blob-on.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-blob-on.x86_64-latest.xml
index 40f40b4132..916a6bd37f 100644
--- a/tests/qemuxmlconfdata/video-virtio-blob-on.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-blob-on.x86_64-latest.xml
@@ -37,11 +37,11 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes' blob='on'/>
+ <model type='virtio' heads='1' primary='yes' blob='on' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1' blob='on'/>
+ <model type='virtio' heads='1' blob='on' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-edid-none.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-edid-none.x86_64-latest.xml
index 175828f44a..4fd2d71ad2 100644
--- a/tests/qemuxmlconfdata/video-virtio-edid-none.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-edid-none.x86_64-latest.xml
@@ -31,7 +31,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-edid-off.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-edid-off.x86_64-latest.xml
index 35c01128b7..1e90b74ea2 100644
--- a/tests/qemuxmlconfdata/video-virtio-edid-off.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-edid-off.x86_64-latest.xml
@@ -31,7 +31,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes' edid='off'/>
+ <model type='virtio' heads='1' primary='yes' edid='off' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-edid-on.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-edid-on.x86_64-latest.xml
index b6feb171c2..9981cf0584 100644
--- a/tests/qemuxmlconfdata/video-virtio-edid-on.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-edid-on.x86_64-latest.xml
@@ -31,7 +31,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes' edid='on'/>
+ <model type='virtio' heads='1' primary='yes' edid='on' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-ccw-auto.s390x-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-ccw-auto.s390x-latest.xml
index 87ee9eee54..5bf5369ee2 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-ccw-auto.s390x-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-ccw-auto.s390x-latest.xml
@@ -29,7 +29,7 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-ccw.s390x-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-ccw.s390x-latest.xml
index 9b6bf6c980..cb1dbf10af 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-ccw.s390x-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-ccw.s390x-latest.xml
@@ -29,11 +29,11 @@
</graphics>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
</video>
<video>
- <model type='virtio' heads='1'/>
+ <model type='virtio' heads='1' device='virtio-gpu'/>
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0003'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-device.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-device.x86_64-latest.xml
index 0c31cfb927..601932351b 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-device.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-device.x86_64-latest.xml
@@ -34,7 +34,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-sdl-gl.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-sdl-gl.x86_64-latest.xml
index 401fdaf697..12687e63d6 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-sdl-gl.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-sdl-gl.x86_64-latest.xml
@@ -36,7 +36,7 @@
<gl enable='yes'/>
</graphics>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-secondary.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-secondary.x86_64-latest.xml
index 7eae993cc0..776217c498 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-secondary.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-secondary.x86_64-latest.xml
@@ -25,11 +25,11 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1'/>
+ <model type='virtio' heads='1' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-spice-gl.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-spice-gl.x86_64-latest.xml
index 89da83de01..cc0426e2db 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-spice-gl.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-spice-gl.x86_64-latest.xml
@@ -38,7 +38,7 @@
</graphics>
<audio id='1' type='spice'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-gpu-virgl.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-gpu-virgl.x86_64-latest.xml
index 48b1d833ff..fcbff0885e 100644
--- a/tests/qemuxmlconfdata/video-virtio-gpu-virgl.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-gpu-virgl.x86_64-latest.xml
@@ -34,7 +34,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
index 991141c643..587a1c1d0e 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
@@ -28,7 +28,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml
index 991141c643..2b53a42bc6 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml
@@ -28,13 +28,13 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='virtio-gpu'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml
index 991141c643..19388b100c 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml
@@ -28,13 +28,13 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='virtio-gpu-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml
index 991141c643..b84241fdac 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml
@@ -28,13 +28,13 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='virtio-gpu-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
index 991141c643..023db901dd 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
@@ -28,13 +28,13 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='virtio-gpu-gl'>
<acceleration accel3d='yes'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml
index 0c31cfb927..c04687983d 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml
@@ -34,7 +34,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.xml
index 0c31cfb927..601932351b 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.xml
@@ -34,7 +34,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<video>
- <model type='virtio' heads='1' primary='yes'/>
+ <model type='virtio' heads='1' primary='yes' device='virtio-vga'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
diff --git a/tests/qemuxmlconfdata/virtio-options-video-ats.x86_64-latest.xml b/tests/qemuxmlconfdata/virtio-options-video-ats.x86_64-latest.xml
index 228ace3fa5..49e488c6b4 100644
--- a/tests/qemuxmlconfdata/virtio-options-video-ats.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/virtio-options-video-ats.x86_64-latest.xml
@@ -26,14 +26,14 @@
<audio id='1' type='none'/>
<video>
<driver ats='on' name='vhostuser'/>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='vhost-user-vga'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
<driver ats='off' name='vhostuser'/>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='vhost-user-gpu'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/virtio-options-video-iommu.x86_64-latest.xml b/tests/qemuxmlconfdata/virtio-options-video-iommu.x86_64-latest.xml
index 971cab51e7..a3fe36980f 100644
--- a/tests/qemuxmlconfdata/virtio-options-video-iommu.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/virtio-options-video-iommu.x86_64-latest.xml
@@ -26,14 +26,14 @@
<audio id='1' type='none'/>
<video>
<driver iommu='on' name='vhostuser'/>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='vhost-user-vga'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
<driver iommu='off' name='vhostuser'/>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='vhost-user-gpu'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/virtio-options-video-packed.x86_64-latest.xml b/tests/qemuxmlconfdata/virtio-options-video-packed.x86_64-latest.xml
index 26856e5e45..efdd865561 100644
--- a/tests/qemuxmlconfdata/virtio-options-video-packed.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/virtio-options-video-packed.x86_64-latest.xml
@@ -26,14 +26,14 @@
<audio id='1' type='none'/>
<video>
<driver packed='on' name='vhostuser'/>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='vhost-user-vga'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<video>
<driver packed='off' name='vhostuser'/>
- <model type='virtio' heads='1'>
+ <model type='virtio' heads='1' device='vhost-user-gpu'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
diff --git a/tests/qemuxmlconfdata/virtio-options.xml b/tests/qemuxmlconfdata/virtio-options.xml
index 05eaae35a9..89a424febf 100644
--- a/tests/qemuxmlconfdata/virtio-options.xml
+++ b/tests/qemuxmlconfdata/virtio-options.xml
@@ -82,7 +82,7 @@
<audio id='1' type='none'/>
<video>
<driver iommu='on' ats='on' packed='on' page_per_vq='on' name='vhostuser'/>
- <model type='virtio' heads='1' primary='yes'>
+ <model type='virtio' heads='1' primary='yes' device='vhost-user-vga'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
--
2.55.0

View File

@ -0,0 +1,50 @@
From f77f7a3d566b6fd6bbc5d4b3d78fc290a2f84e54 Mon Sep 17 00:00:00 2001
Message-ID: <f77f7a3d566b6fd6bbc5d4b3d78fc290a2f84e54.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 11 Jun 2026 12:56:17 +0200
Subject: [PATCH] qemu: postparse: Process VM config with qemuCaps influenced
by <qemu:capabilities>
The user configuration of added/removed qemu capabilities via the qemu
namespace element was applied only right before generating a
commandline, but the post parse code code didn't see these.
Apply the capability modification prior to running post parse code so
that defaults are properly picked based on the configuration.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 011ae74640b230222ca521c6d253e2df59c8ab63)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_postparse.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_postparse.c b/src/qemu/qemu_postparse.c
index dc5ade829a..cd88cd1806 100644
--- a/src/qemu/qemu_postparse.c
+++ b/src/qemu/qemu_postparse.c
@@ -1924,9 +1924,16 @@ qemuDomainPostParseDataAlloc(const virDomainDef *def,
void **parseOpaque)
{
virQEMUDriver *driver = opaque;
+ g_autoptr(virQEMUCaps) qemuCapsLocal = NULL;
- if (!(*parseOpaque = virQEMUCapsCacheLookup(driver->qemuCapsCache,
- def->emulator)))
+ *parseOpaque = NULL;
+
+ if (!(qemuCapsLocal = virQEMUCapsCacheLookup(driver->qemuCapsCache,
+ def->emulator)))
+ return 1;
+
+ if (qemuDomainUpdateCustomCapabilities(def, qemuCapsLocal,
+ (virQEMUCaps **) parseOpaque) < 0)
return 1;
return 0;
--
2.55.0

View File

@ -0,0 +1,81 @@
From 2b3ed2f5fbb0255561db89a841eb2673af0095a5 Mon Sep 17 00:00:00 2001
Message-ID: <2b3ed2f5fbb0255561db89a841eb2673af0095a5.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 11 Jun 2026 12:52:16 +0200
Subject: [PATCH] qemu: validate: Validate VM config with qemuCaps influenced
by <qemu:capabilities>
The user configuration of added/removed qemu capabilities via the qemu
namespace element was applied only right before generating a
commandline, but the validation code didn't see these.
Modify the validation entry points so that they apply this optionally.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 5319dd6f0d4ae93ef14ccb25b43346b30490db3a)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_validate.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 63c5f8e037..8f3e6dd134 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1272,18 +1272,21 @@ qemuValidateDomainDef(const virDomainDef *def,
void *parseOpaque)
{
virQEMUDriver *driver = opaque;
+ virQEMUCaps *qemuCapsIn = parseOpaque;
g_autoptr(virQEMUCaps) qemuCapsLocal = NULL;
- virQEMUCaps *qemuCaps = parseOpaque;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
size_t i;
- if (!qemuCaps) {
+ if (!qemuCapsIn) {
if (!(qemuCapsLocal = virQEMUCapsCacheLookup(driver->qemuCapsCache,
def->emulator)))
return -1;
-
- qemuCaps = qemuCapsLocal;
+ qemuCapsIn = qemuCapsLocal;
}
+ if (qemuDomainUpdateCustomCapabilities(def, qemuCapsIn, &qemuCaps) < 0)
+ return -1;
+
if (def->os.type != VIR_DOMAIN_OSTYPE_HVM) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Emulator '%1$s' does not support os type '%2$s'"),
@@ -5958,17 +5961,20 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev,
void *parseOpaque)
{
virQEMUDriver *driver = opaque;
+ virQEMUCaps *qemuCapsIn = parseOpaque;
g_autoptr(virQEMUCaps) qemuCapsLocal = NULL;
- virQEMUCaps *qemuCaps = parseOpaque;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
- if (!qemuCaps) {
+ if (!qemuCapsIn) {
if (!(qemuCapsLocal = virQEMUCapsCacheLookup(driver->qemuCapsCache,
def->emulator)))
return -1;
-
- qemuCaps = qemuCapsLocal;
+ qemuCapsIn = qemuCapsLocal;
}
+ if (qemuDomainUpdateCustomCapabilities(def, qemuCapsIn, &qemuCaps) < 0)
+ return -1;
+
if (qemuValidateDomainDeviceInfo(dev, def, qemuCaps) < 0)
return -1;
--
2.55.0

View File

@ -0,0 +1,212 @@
From a3f72e88927f270bc17a7cb47f7abec988b208c9 Mon Sep 17 00:00:00 2001
Message-ID: <a3f72e88927f270bc17a7cb47f7abec988b208c9.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 8 Jun 2026 15:11:45 +0200
Subject: [PATCH] qemuDeviceVideoGetModel: Directly return picked model
There's no point in falling through to the check reporting invalid
type since if the code picks a model that one will be valid.
Reorganize the code so that we can return final decision right away.
This means that the two flags 'virtio' and 'virtioBusSuffix' need to be
set prior to the return.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit d3bd2142095e8203d9cc49448e7761553b0b2600)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_command.c | 156 +++++++++++++++++++---------------------
1 file changed, 75 insertions(+), 81 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index db72407ecc..619ad7a835 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -719,7 +719,6 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
bool *virtio,
bool *virtioBusSuffix)
{
- const char *model = NULL;
bool primaryVga = false;
virTristateBool accel3d = VIR_TRISTATE_BOOL_ABSENT;
@@ -732,98 +731,93 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
primaryVga = true;
+ if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
+ if (primaryVga)
+ return "vhost-user-vga";
+
+ *virtio = true;
+ *virtioBusSuffix = true;
+ return "vhost-user-gpu";
+ }
+
/* We try to chose the best model for primary video device by preferring
* model with VGA compatibility mode. For some video devices on some
* architectures there might not be such model so fallback to one
* without VGA compatibility mode. */
- if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
- if (primaryVga) {
- model = "vhost-user-vga";
- } else {
- model = "vhost-user-gpu";
+ if (primaryVga) {
+ switch ((virDomainVideoType) video->type) {
+ case VIR_DOMAIN_VIDEO_TYPE_VGA:
+ return "VGA";
+
+ case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+ return "cirrus-vga";
+
+ case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
+ return "vmware-svga";
+
+ case VIR_DOMAIN_VIDEO_TYPE_QXL:
+ return "qxl-vga";
+
+ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
*virtio = true;
- *virtioBusSuffix = true;
+ *virtioBusSuffix = false;
+
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
+ accel3d == VIR_TRISTATE_BOOL_YES)
+ return "virtio-vga-gl";
+
+ return "virtio-vga";
+
+ case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
+ return "bochs-display";
+
+ case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
+ return "ramfb";
+
+ case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
+ case VIR_DOMAIN_VIDEO_TYPE_XEN:
+ case VIR_DOMAIN_VIDEO_TYPE_VBOX:
+ case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
+ case VIR_DOMAIN_VIDEO_TYPE_GOP:
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
+ case VIR_DOMAIN_VIDEO_TYPE_LAST:
+ break;
}
} else {
- if (primaryVga) {
- switch ((virDomainVideoType) video->type) {
- case VIR_DOMAIN_VIDEO_TYPE_VGA:
- model = "VGA";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
- model = "cirrus-vga";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
- model = "vmware-svga";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_QXL:
- model = "qxl-vga";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
- accel3d == VIR_TRISTATE_BOOL_YES)
- model = "virtio-vga-gl";
- else
- model = "virtio-vga";
+ switch ((virDomainVideoType) video->type) {
+ case VIR_DOMAIN_VIDEO_TYPE_QXL:
+ return "qxl";
- *virtio = true;
- *virtioBusSuffix = false;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
- model = "bochs-display";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
- model = "ramfb";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
- case VIR_DOMAIN_VIDEO_TYPE_XEN:
- case VIR_DOMAIN_VIDEO_TYPE_VBOX:
- case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
- case VIR_DOMAIN_VIDEO_TYPE_GOP:
- case VIR_DOMAIN_VIDEO_TYPE_NONE:
- case VIR_DOMAIN_VIDEO_TYPE_LAST:
- break;
- }
- } else {
- switch ((virDomainVideoType) video->type) {
- case VIR_DOMAIN_VIDEO_TYPE_QXL:
- model = "qxl";
- break;
- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
- accel3d == VIR_TRISTATE_BOOL_YES)
- model = "virtio-gpu-gl";
- else
- model = "virtio-gpu";
+ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+ *virtio = true;
+ *virtioBusSuffix = true;
- *virtio = true;
- *virtioBusSuffix = true;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
- case VIR_DOMAIN_VIDEO_TYPE_VGA:
- case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
- case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
- case VIR_DOMAIN_VIDEO_TYPE_XEN:
- case VIR_DOMAIN_VIDEO_TYPE_VBOX:
- case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
- case VIR_DOMAIN_VIDEO_TYPE_GOP:
- case VIR_DOMAIN_VIDEO_TYPE_NONE:
- case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
- case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
- case VIR_DOMAIN_VIDEO_TYPE_LAST:
- break;
- }
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
+ accel3d == VIR_TRISTATE_BOOL_YES)
+ return "virtio-gpu-gl";
+
+ return "virtio-gpu";
+
+ case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
+ case VIR_DOMAIN_VIDEO_TYPE_VGA:
+ case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+ case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
+ case VIR_DOMAIN_VIDEO_TYPE_XEN:
+ case VIR_DOMAIN_VIDEO_TYPE_VBOX:
+ case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
+ case VIR_DOMAIN_VIDEO_TYPE_GOP:
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
+ case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
+ case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
+ case VIR_DOMAIN_VIDEO_TYPE_LAST:
+ break;
}
}
- if (!model || STREQ(model, "")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid model for video type '%1$s'"),
- virDomainVideoTypeToString(video->type));
- return NULL;
- }
-
- return model;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid model for video type '%1$s'"),
+ virDomainVideoTypeToString(video->type));
+ return NULL;
}
--
2.55.0

View File

@ -0,0 +1,210 @@
From b59a04973707e5499a56729ecf1887d4a048031f Mon Sep 17 00:00:00 2001
Message-ID: <b59a04973707e5499a56729ecf1887d4a048031f.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 9 Jun 2026 22:02:21 +0200
Subject: [PATCH] qemuDeviceVideoGetModel: Remove logic for selecting 'virtio'
devices
The virtio video device frontend type is either selected by the
post-parse code based on capabilities or provided by the user/existing
XML explicitly. No need to try to come up with a model when generating
commandline based on broken logic.
The difference in test output shows:
- honours user's config in case of the new 'device' attribute
- shows how incorrect fallback would be used for 'virtio-vga-gl'
(picked virtio-vga (non-gl) instead of 'virtio-gpu-gl')
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 659e104affa113b9a546ca1f6948bc9e95ada8d2)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_command.c | 75 +++++++------------
...io-vga-device-downgrade.x86_64-latest.args | 2 +-
...APS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args | 2 +-
3 files changed, 30 insertions(+), 49 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 619ad7a835..2f19a6c1ff 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -703,9 +703,25 @@ qemuBuildDeviceAddressProps(virJSONValue *props,
}
+struct qemuDeviceVideoModelVirtioOpts {
+ bool virtio;
+ bool virtioBusSuffix;
+};
+
+struct qemuDeviceVideoModelVirtioOpts qemuDeviceVideoGetModelVirtioOptsTable[] = {
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_DEFAULT] = { .virtio = false, .virtioBusSuffix = false },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA] = { .virtio = true, .virtioBusSuffix = false },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU] = { .virtio = true, .virtioBusSuffix = true },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA_GL] = { .virtio = true, .virtioBusSuffix = false },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU_GL] = { .virtio = true, .virtioBusSuffix = true },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_VGA] = { .virtio = false, .virtioBusSuffix = false },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_GPU] = { .virtio = true, .virtioBusSuffix = true },
+};
+G_STATIC_ASSERT(G_N_ELEMENTS(qemuDeviceVideoGetModelVirtioOptsTable) == VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_LAST);
+
+
/**
* qemuDeviceVideoGetModel:
- * @qemuCaps: qemu capabilities
* @video: video device definition
* @virtio: the returned video device is a 'virtio' device
* @virtioBusSuffix: the returned device needs to get the bus-suffix
@@ -714,37 +730,23 @@ qemuBuildDeviceAddressProps(virJSONValue *props,
* @virtioBusSuffix are filled with the corresponding flags.
*/
static const char *
-qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
- const virDomainVideoDef *video,
+qemuDeviceVideoGetModel(const virDomainVideoDef *video,
bool *virtio,
bool *virtioBusSuffix)
{
- bool primaryVga = false;
- virTristateBool accel3d = VIR_TRISTATE_BOOL_ABSENT;
-
*virtio = false;
*virtioBusSuffix = false;
- if (video->accel)
- accel3d = video->accel->accel3d;
+ if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ struct qemuDeviceVideoModelVirtioOpts *opts = &qemuDeviceVideoGetModelVirtioOptsTable[video->virtiodevice];
- if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
- primaryVga = true;
+ *virtio = opts->virtio;
+ *virtioBusSuffix = opts->virtioBusSuffix;
- if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
- if (primaryVga)
- return "vhost-user-vga";
-
- *virtio = true;
- *virtioBusSuffix = true;
- return "vhost-user-gpu";
+ return virDomainVideoVirtioDeviceTypeToString(video->virtiodevice);
}
- /* We try to chose the best model for primary video device by preferring
- * model with VGA compatibility mode. For some video devices on some
- * architectures there might not be such model so fallback to one
- * without VGA compatibility mode. */
- if (primaryVga) {
+ if (video->primary) {
switch ((virDomainVideoType) video->type) {
case VIR_DOMAIN_VIDEO_TYPE_VGA:
return "VGA";
@@ -758,22 +760,12 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
case VIR_DOMAIN_VIDEO_TYPE_QXL:
return "qxl-vga";
- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- *virtio = true;
- *virtioBusSuffix = false;
-
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
- accel3d == VIR_TRISTATE_BOOL_YES)
- return "virtio-vga-gl";
-
- return "virtio-vga";
-
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
return "bochs-display";
case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
return "ramfb";
-
+ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
case VIR_DOMAIN_VIDEO_TYPE_XEN:
case VIR_DOMAIN_VIDEO_TYPE_VBOX:
@@ -789,15 +781,6 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
return "qxl";
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- *virtio = true;
- *virtioBusSuffix = true;
-
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
- accel3d == VIR_TRISTATE_BOOL_YES)
- return "virtio-gpu-gl";
-
- return "virtio-gpu";
-
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
case VIR_DOMAIN_VIDEO_TYPE_VGA:
case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
@@ -823,7 +806,6 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
static void
qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
- virQEMUCaps *qemuCaps,
const char **baseName,
virDomainVirtioOptions **virtioOptions,
bool *has_tmodel,
@@ -948,8 +930,7 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
bool virtio;
bool virtioBusSuffix;
- if (!(*baseName = qemuDeviceVideoGetModel(qemuCaps,
- device->data.video,
+ if (!(*baseName = qemuDeviceVideoGetModel(device->data.video,
&virtio,
&virtioBusSuffix)))
return;
@@ -1028,7 +1009,7 @@ qemuBuildVirtioDevGetConfig(const virDomainDeviceDef *device,
bool has_ntmodel = false;
bool useBusSuffix = true;
- qemuBuildVirtioDevGetConfigDev(device, qemuCaps, &baseName,
+ qemuBuildVirtioDevGetConfigDev(device, &baseName,
virtioOptions, &has_tmodel,
&has_ntmodel, &useBusSuffix);
@@ -4606,7 +4587,7 @@ qemuBuildDeviceVideoCmd(virCommand *cmd,
g_autoptr(virJSONValue) props = NULL;
unsigned int max_outputs = 0;
- if (!(model = qemuDeviceVideoGetModel(qemuCaps, video, &virtio, &virtioBusSuffix)))
+ if (!(model = qemuDeviceVideoGetModel(video, &virtio, &virtioBusSuffix)))
return -1;
if (virtio) {
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
index fec2b04ca9..5782505b61 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
@@ -31,7 +31,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \
-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
index d649dc06f8..315c49f953 100644
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
@@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-gpu-gl-pci","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
-device '{"driver":"virtio-gpu-gl-pci","id":"video1","max_outputs":1,"bus":"pci.0","addr":"0x4"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--
2.55.0

View File

@ -0,0 +1,140 @@
From 4c33439fbcd0eb9ea09ab9a8a6aa5b8780ac9175 Mon Sep 17 00:00:00 2001
Message-ID: <4c33439fbcd0eb9ea09ab9a8a6aa5b8780ac9175.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 10 Jun 2026 12:38:00 +0200
Subject: [PATCH] qemuDeviceVideoGetModel: Simplify by relying on checks from
'qemuValidateDomainDeviceDefVideo'
'qemuValidateDomainDeviceDefVideo' ensures that only the correct video
device models are selected as well as that only QXL and VIRTIO video
devices can be selected as secondary.
Remove unnecessary checks and simplify the code.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 736c0f455a0edf1ed6961558f6ece877f5f7dbc6)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_command.c | 94 ++++++++++++++++++-----------------------
1 file changed, 40 insertions(+), 54 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2f19a6c1ff..963dc2afa3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -737,7 +737,32 @@ qemuDeviceVideoGetModel(const virDomainVideoDef *video,
*virtio = false;
*virtioBusSuffix = false;
- if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ /* 'qemuValidateDomainDeviceDefVideo' ensures that only supported models
+ * are used as well as that only 'QXL' and 'virtio' graphics can be
+ * secondary */
+ switch ((virDomainVideoType) video->type) {
+ case VIR_DOMAIN_VIDEO_TYPE_VGA:
+ return "VGA";
+
+ case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+ return "cirrus-vga";
+
+ case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
+ return "vmware-svga";
+
+ case VIR_DOMAIN_VIDEO_TYPE_QXL:
+ if (video->primary)
+ return "qxl-vga";
+
+ return "qxl";
+
+ case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
+ return "bochs-display";
+
+ case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
+ return "ramfb";
+
+ case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: {
struct qemuDeviceVideoModelVirtioOpts *opts = &qemuDeviceVideoGetModelVirtioOptsTable[video->virtiodevice];
*virtio = opts->virtio;
@@ -746,61 +771,22 @@ qemuDeviceVideoGetModel(const virDomainVideoDef *video,
return virDomainVideoVirtioDeviceTypeToString(video->virtiodevice);
}
- if (video->primary) {
- switch ((virDomainVideoType) video->type) {
- case VIR_DOMAIN_VIDEO_TYPE_VGA:
- return "VGA";
+ case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
+ case VIR_DOMAIN_VIDEO_TYPE_XEN:
+ case VIR_DOMAIN_VIDEO_TYPE_VBOX:
+ case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
+ case VIR_DOMAIN_VIDEO_TYPE_GOP:
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid model for video type '%1$s'"),
+ virDomainVideoTypeToString(video->type));
+ return NULL;
- case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
- return "cirrus-vga";
-
- case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
- return "vmware-svga";
-
- case VIR_DOMAIN_VIDEO_TYPE_QXL:
- return "qxl-vga";
-
- case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
- return "bochs-display";
-
- case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
- return "ramfb";
- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
- case VIR_DOMAIN_VIDEO_TYPE_XEN:
- case VIR_DOMAIN_VIDEO_TYPE_VBOX:
- case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
- case VIR_DOMAIN_VIDEO_TYPE_GOP:
- case VIR_DOMAIN_VIDEO_TYPE_NONE:
- case VIR_DOMAIN_VIDEO_TYPE_LAST:
- break;
- }
- } else {
- switch ((virDomainVideoType) video->type) {
- case VIR_DOMAIN_VIDEO_TYPE_QXL:
- return "qxl";
-
- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
- case VIR_DOMAIN_VIDEO_TYPE_VGA:
- case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
- case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
- case VIR_DOMAIN_VIDEO_TYPE_XEN:
- case VIR_DOMAIN_VIDEO_TYPE_VBOX:
- case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
- case VIR_DOMAIN_VIDEO_TYPE_GOP:
- case VIR_DOMAIN_VIDEO_TYPE_NONE:
- case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
- case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
- case VIR_DOMAIN_VIDEO_TYPE_LAST:
- break;
- }
+ case VIR_DOMAIN_VIDEO_TYPE_LAST:
+ default:
+ virReportEnumRangeError(virDomainVideoType, video->type);
+ return NULL;
}
-
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid model for video type '%1$s'"),
- virDomainVideoTypeToString(video->type));
- return NULL;
}
--
2.55.0

View File

@ -0,0 +1,272 @@
From d02940fb7bdfbabfc8f34349ff01b64960965d66 Mon Sep 17 00:00:00 2001
Message-ID: <d02940fb7bdfbabfc8f34349ff01b64960965d66.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 10 Jun 2026 14:45:24 +0200
Subject: [PATCH] qemuValidateDomainDeviceDefVideo: Fix checks of virtio video
devices
The currently existing checks are broken:
- only QEMU_CAPS_DEVICE_VHOST_USER_GPU is checked for vhostuser
backends (vhost-user-vga is actually separately packaged)
- the check for the 3d accelerated (-gl) versions checks only if one
of them exists (the commandline formatter picks a non-gl afterwards)
- 'virtio-vga'/'virtio-gpu' is not checked at all
The code also doesn't yet check if, when the user passes the new
'device' property manually the config actually makes sense.
To fix all of the above introduce a table of supported frontend devices
as well as properties that need to be checked for them.
This requires fixing a recently-introduced test case which shows a
nonsensical situation.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 177ff813479872d4d7e3c270acf1e045f25b1e21)
https://redhat.atlassian.net/browse/RHEL-186019
Conflicts:
tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
Context; conflict with previous conflict resolution
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_validate.c | 88 +++++++++++++------
...VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args | 35 --------
..._VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.err | 1 +
..._VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml | 46 ----------
tests/qemuxmlconftest.c | 1 +
5 files changed, 65 insertions(+), 106 deletions(-)
delete mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.err
delete mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 8f3e6dd134..3e84ef7139 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2784,6 +2784,26 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
}
+struct qemuValidateDeviceVideoVirtioData {
+ virQEMUCapsFlags cap; /* capability for the device */
+ bool primary; /* this device can be only the primary device */
+ bool vhostuser; /* uses the vhostuser protocol */
+ bool gl; /* supports 3d accel */
+};
+
+
+struct qemuValidateDeviceVideoVirtioData qemuValidateDeviceVideoVirtioTable[] = {
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_DEFAULT] = { .cap = QEMU_CAPS_LAST },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA] = { .cap = QEMU_CAPS_DEVICE_VIRTIO_VGA, .primary = true },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU] = { .cap = QEMU_CAPS_DEVICE_VIRTIO_GPU },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VGA_GL] = { .cap = QEMU_CAPS_VIRTIO_VGA_GL, .gl = true, .primary = true },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_GPU_GL] = { .cap = QEMU_CAPS_VIRTIO_GPU_GL_PCI, .gl = true },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_VGA] = { .cap = QEMU_CAPS_DEVICE_VHOST_USER_VGA, .vhostuser = true, .primary = true },
+ [VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_VHOST_USER_GPU] = { .cap = QEMU_CAPS_DEVICE_VHOST_USER_GPU, .vhostuser = true },
+};
+G_STATIC_ASSERT(G_N_ELEMENTS(qemuValidateDeviceVideoVirtioTable) == VIR_DOMAIN_VIDEO_VIRTIO_DEVICE_LAST);
+
+
static int
qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
const virDomainDef *def,
@@ -2804,6 +2824,49 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
return -1;
}
+ if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ struct qemuValidateDeviceVideoVirtioData *data = &qemuValidateDeviceVideoVirtioTable[video->virtiodevice];
+
+ if (data->cap == QEMU_CAPS_LAST) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("this QEMU binary lacks any suitable 'virtio' video device frontend"));
+ return -1;
+ }
+
+ if (!virQEMUCapsGet(qemuCaps, data->cap)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("this QEMU doesn't support the '%1$s' virtio video device frontend"),
+ virDomainVideoVirtioDeviceTypeToString(video->virtiodevice));
+ return -1;
+ }
+
+ if (data->primary && !video->primary) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("the '%1$s' virtio video device frontend can be only used as primary video device"),
+ virDomainVideoVirtioDeviceTypeToString(video->virtiodevice));
+ return -1;
+ }
+
+ /* this check deliberately allows downgrade to the non-gl frontend as
+ * that was possible due to a bug in capability checking and the
+ * commandline formatter. More details are explained in
+ * 'qemuDomainDeviceVideoDefPostParse' which selects the frontend */
+ if (data->gl &&
+ !(video->accel && video->accel->accel3d == VIR_TRISTATE_BOOL_YES)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("the '%1$s' virtio video device frontend can be only with enabled 3d acceleration"),
+ virDomainVideoVirtioDeviceTypeToString(video->virtiodevice));
+ return -1;
+ }
+
+ if (data->vhostuser != (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("the '%1$s' virtio video device doesn't match the selected vhostuser backend"),
+ virDomainVideoVirtioDeviceTypeToString(video->virtiodevice));
+ return -1;
+ }
+ }
+
if (video->type != VIR_DOMAIN_VIDEO_TYPE_QXL &&
video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
if (!video->primary) {
@@ -2875,31 +2938,6 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
}
}
- if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
- if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("this QEMU does not support 'vhost-user' video device"));
- return -1;
- }
- } else if (video->accel) {
- if (video->accel->accel3d == VIR_TRISTATE_BOOL_YES) {
- if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("3d acceleration is supported only with 'virtio' video device"));
- return -1;
- }
-
- if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) ||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) ||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL))) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("3d acceleration is not supported by this QEMU binary"));
- return -1;
- }
- }
- }
-
if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
if (video->blob != VIR_TRISTATE_SWITCH_ABSENT) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_BLOB)) {
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
deleted file mode 100644
index 297b919b5b..0000000000
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
+++ /dev/null
@@ -1,35 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=QEMUGuest1,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
--machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
--accel tcg \
--cpu qemu64 \
--m size=1048576k \
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
--device '{"driver":"virtio-gpu-pci","id":"video1","max_outputs":1,"bus":"pci.0","addr":"0x4"}' \
--device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.err b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.err
new file mode 100644
index 0000000000..b94bf12d69
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.err
@@ -0,0 +1 @@
+unsupported configuration: this QEMU binary lacks any suitable 'virtio' video device frontend
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
deleted file mode 100644
index 587a1c1d0e..0000000000
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>qemu64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='ide' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
- </controller>
- <controller type='usb' index='0' model='piix3-uhci'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <audio id='1' type='none'/>
- <video>
- <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
- <acceleration accel3d='yes'/>
- </model>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
- </video>
- <video>
- <model type='virtio' heads='1'>
- <acceleration accel3d='yes'/>
- </model>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
- </video>
- <memballoon model='virtio'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
- </memballoon>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 85cf9960aa..45e9a37794 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2800,6 +2800,7 @@ mymain(void)
ARG_CAPS_VER, "latest",
ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_GPU_GL_PCI, QEMU_CAPS_LAST,
ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_END);
DO_TEST_CAPS_LATEST("video-virtio-edid-none");
DO_TEST_CAPS_LATEST("video-virtio-edid-off");
--
2.55.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
From c33268a59a91cb38dd22e94bd3a735fc7d3859d9 Mon Sep 17 00:00:00 2001
Message-ID: <c33268a59a91cb38dd22e94bd3a735fc7d3859d9.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 10 Jun 2026 16:57:06 +0200
Subject: [PATCH] qemuxmlconfdata: un-symlink 'video-virtio-vga-gpu-gl' output
Upcoming patches will add additional testing for various virtio-*-gl
devices, including filling of the default model. The output file needs
to not influnece the input for this test to work properly.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c490360c2590983707d3cf3d2bb011830b014ff7)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
.../video-virtio-vga-gpu-gl.x86_64-latest.xml | 47 ++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
mode change 120000 => 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
deleted file mode 120000
index 34e32ab8ba..0000000000
--- a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
+++ /dev/null
@@ -1 +0,0 @@
-video-virtio-vga-gpu-gl.xml
\ No newline at end of file
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
new file mode 100644
index 0000000000..991141c643
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
@@ -0,0 +1,46 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <video>
+ <model type='virtio' heads='1'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
--
2.55.0

View File

@ -0,0 +1,255 @@
From 3480a65aecf0c5e4f1988a02b007c2d86fc1409c Mon Sep 17 00:00:00 2001
Message-ID: <3480a65aecf0c5e4f1988a02b007c2d86fc1409c.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 10 Jun 2026 16:31:44 +0200
Subject: [PATCH] qemuxmlconftest: Add invocation of 'video-virtio-vga-gpu-gl'
with missing caps and VIR_DOMAIN_DEF_PARSE_ABI_UPDATE
Similarly to previous patch add testing of 'virtio-gpu-gl' or
'virtio-vga-gl' with missing the respective capabilities, but this time
allowing VIR_DOMAIN_DEF_PARSE_ABI_UPDATE.
This will later on show that in case when the fallback can't be honoured
the code will not pick a device that doesn't support acceleration (the
non-gl variant).
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c10a7f2bafe15e3eb8f14407b23d8683a4a11446)
https://redhat.atlassian.net/browse/RHEL-186019
Conflicts:
- tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
- tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
Context; patch tweaking monitor FD passing in tests not backported
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
...VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args | 35 ++++++++++++++
..._VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml | 46 +++++++++++++++++++
...APS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args | 35 ++++++++++++++
...CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml | 46 +++++++++++++++++++
tests/qemuxmlconftest.c | 12 +++++
5 files changed, 174 insertions(+)
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
new file mode 100644
index 0000000000..297b919b5b
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-gpu-pci","id":"video1","max_outputs":1,"bus":"pci.0","addr":"0x4"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
new file mode 100644
index 0000000000..991141c643
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE.xml
@@ -0,0 +1,46 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <video>
+ <model type='virtio' heads='1'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
new file mode 100644
index 0000000000..d649dc06f8
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-gpu-gl-pci","id":"video1","max_outputs":1,"bus":"pci.0","addr":"0x4"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml
new file mode 100644
index 0000000000..991141c643
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE.xml
@@ -0,0 +1,46 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <video>
+ <model type='virtio' heads='1'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 8424bdf709..44df46f35c 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2783,11 +2783,23 @@ mymain(void)
ARG_CAPS_VER, "latest",
ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_VGA_GL, QEMU_CAPS_LAST,
ARG_END);
+ DO_TEST_FULL("video-virtio-vga-gpu-gl", ".x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled-ABI_UPDATE",
+ ARG_CAPS_ARCH, "x86_64",
+ ARG_CAPS_VER, "latest",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_VGA_GL, QEMU_CAPS_LAST,
+ ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
+ ARG_END);
DO_TEST_FULL("video-virtio-vga-gpu-gl", ".x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled",
ARG_CAPS_ARCH, "x86_64",
ARG_CAPS_VER, "latest",
ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_GPU_GL_PCI, QEMU_CAPS_LAST,
ARG_END);
+ DO_TEST_FULL("video-virtio-vga-gpu-gl", ".x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled-ABI_UPDATE",
+ ARG_CAPS_ARCH, "x86_64",
+ ARG_CAPS_VER, "latest",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_GPU_GL_PCI, QEMU_CAPS_LAST,
+ ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
+ ARG_END);
DO_TEST_CAPS_LATEST("video-virtio-edid-none");
DO_TEST_CAPS_LATEST("video-virtio-edid-off");
DO_TEST_CAPS_LATEST("video-virtio-edid-on");
--
2.55.0

View File

@ -0,0 +1,177 @@
From cedf4dbcdd3a0c64d4e74a98dd8caacaefced9b6 Mon Sep 17 00:00:00 2001
Message-ID: <cedf4dbcdd3a0c64d4e74a98dd8caacaefced9b6.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 10 Jun 2026 12:26:50 +0200
Subject: [PATCH] qemuxmlconftest: Add test case for specifying 'virtio-gpu'
where 'virtio-vga' would be picked
Add a test case demonstrating the switch to 'virtio-gpu' on a host which
would normally pick 'virtio-vga'.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit ca4bcd775cc2d17d35e752f03842f3442290cf0d)
https://redhat.atlassian.net/browse/RHEL-186019
Conflicts:
- tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
Context; patch tweaking monitor FD passing in tests not backported
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
...io-vga-device-downgrade.x86_64-latest.args | 37 ++++++++++++++++
...tio-vga-device-downgrade.x86_64-latest.xml | 44 +++++++++++++++++++
.../video-virtio-vga-device-downgrade.xml | 33 ++++++++++++++
tests/qemuxmlconftest.c | 1 +
4 files changed, 115 insertions(+)
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.xml
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
new file mode 100644
index 0000000000..fec2b04ca9
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.xml b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.xml
new file mode 100644
index 0000000000..c04687983d
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.x86_64-latest.xml
@@ -0,0 +1,44 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2' cache='none'/>
+ <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes' device='virtio-gpu'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.xml b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.xml
new file mode 100644
index 0000000000..aef4b64ad4
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-device-downgrade.xml
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2' cache='none'/>
+ <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <video>
+ <model type='virtio' heads='1' device='virtio-gpu'/>
+ </video>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 44df46f35c..85cf9960aa 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2775,6 +2775,7 @@ mymain(void)
ARG_CAPS_VER, "latest",
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_VIRTIO_VGA, QEMU_CAPS_LAST,
ARG_END);
+ DO_TEST_CAPS_LATEST("video-virtio-vga-device-downgrade");
DO_TEST_CAPS_LATEST("video-virtio-blob-on");
DO_TEST_CAPS_LATEST("video-virtio-blob-off");
DO_TEST_CAPS_LATEST("video-virtio-vga-gpu-gl");
--
2.55.0

View File

@ -0,0 +1,256 @@
From f27113ac4b180f85d92ba96c6e2b0065983945da Mon Sep 17 00:00:00 2001
Message-ID: <f27113ac4b180f85d92ba96c6e2b0065983945da.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 9 Jun 2026 14:33:04 +0200
Subject: [PATCH] qemuxmlconftest: Add test cases for configs asking for
'virtio-gpu-gl' or 'virtio-vga-gl' without the capability
The capability check in 'qemuValidateDomainDeviceDefVideo' which
validates whether a <video> definition with acceleration enabled is
possible is only aggregate, thus validates that any '-gl' video backend
is available.
Since qemu compiles each backend into a separate module it's possible to
have an installation where 'virtio-gpu-pci-gl' exist but 'virtio-vga-gl'
doesn't and it will not be rejected at validation. The commandline
though will generate a device *without* the '-gl' which is ABI
incompatible with the counterpart which does have '-gl', but the VM
starts. If such a VM is then migrated to a deployment which does have
the '-gl' variant available, migration will fail because qemu will
generate the '-gl' device as we don't record this fact in the XML.
This test case captures this situation which will be fixed later.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit a30a5a89e7702c7ae31344893735442385ce5777)
https://redhat.atlassian.net/browse/RHEL-186019
Conflicts:
- tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.args
- tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.args
Context; patch tweaking monitor FD passing in tests not backported
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
....QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.args | 35 ++++++++++++++
...t.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml | 46 +++++++++++++++++++
...test.QEMU_CAPS_VIRTIO_VGA_GL-disabled.args | 35 ++++++++++++++
...atest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml | 46 +++++++++++++++++++
tests/qemuxmlconftest.c | 10 ++++
5 files changed, 172 insertions(+)
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.args b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.args
new file mode 100644
index 0000000000..297b919b5b
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-gpu-pci","id":"video1","max_outputs":1,"bus":"pci.0","addr":"0x4"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml
new file mode 100644
index 0000000000..991141c643
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled.xml
@@ -0,0 +1,46 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <video>
+ <model type='virtio' heads='1'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.args b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.args
new file mode 100644
index 0000000000..d649dc06f8
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-gpu-gl-pci","id":"video1","max_outputs":1,"bus":"pci.0","addr":"0x4"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml
new file mode 100644
index 0000000000..991141c643
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga-gpu-gl.x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled.xml
@@ -0,0 +1,46 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <video>
+ <model type='virtio' heads='1'>
+ <acceleration accel3d='yes'/>
+ </model>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index b00b71e10e..8424bdf709 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2778,6 +2778,16 @@ mymain(void)
DO_TEST_CAPS_LATEST("video-virtio-blob-on");
DO_TEST_CAPS_LATEST("video-virtio-blob-off");
DO_TEST_CAPS_LATEST("video-virtio-vga-gpu-gl");
+ DO_TEST_FULL("video-virtio-vga-gpu-gl", ".x86_64-latest.QEMU_CAPS_VIRTIO_VGA_GL-disabled",
+ ARG_CAPS_ARCH, "x86_64",
+ ARG_CAPS_VER, "latest",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_VGA_GL, QEMU_CAPS_LAST,
+ ARG_END);
+ DO_TEST_FULL("video-virtio-vga-gpu-gl", ".x86_64-latest.QEMU_CAPS_VIRTIO_GPU_GL_PCI-disabled",
+ ARG_CAPS_ARCH, "x86_64",
+ ARG_CAPS_VER, "latest",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_VIRTIO_GPU_GL_PCI, QEMU_CAPS_LAST,
+ ARG_END);
DO_TEST_CAPS_LATEST("video-virtio-edid-none");
DO_TEST_CAPS_LATEST("video-virtio-edid-off");
DO_TEST_CAPS_LATEST("video-virtio-edid-on");
--
2.55.0

View File

@ -0,0 +1,149 @@
From d92b3e70c6ae7277aafaf75e31a0b92278480143 Mon Sep 17 00:00:00 2001
Message-ID: <d92b3e70c6ae7277aafaf75e31a0b92278480143.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 26 May 2026 14:14:31 +0200
Subject: [PATCH] qemuxmlconftest: Add 'video-virtio-vga' invocation with
QEMU_CAPS_DEVICE_VIRTIO_VGA disabled
The test case shows that if the 'QEMU_CAPS_DEVICE_VIRTIO_VGA' capability
is not present (e.g. if the corresponding qemu module isn't installed)
libvirt will pick:
-device '{"driver":"virtio-gpu-pci", ...
instead of:
-device '{"driver":"virtio-vga", ...
but without any discernable difference in the XML.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 84b05fe4e3a0c6b4fe4965df3471e891ceb1d4e6)
https://redhat.atlassian.net/browse/RHEL-186019
Conflicts:
- tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.args
Context; patch tweaking monitor FD passing in tests not backported
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
....QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.args | 37 ++++++++++++++++
...t.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml | 44 +++++++++++++++++++
tests/qemuxmlconftest.c | 5 +++
3 files changed, 86 insertions(+)
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.args
create mode 100644 tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml
diff --git a/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.args b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.args
new file mode 100644
index 0000000000..5782505b61
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml
new file mode 100644
index 0000000000..0c31cfb927
--- /dev/null
+++ b/tests/qemuxmlconfdata/video-virtio-vga.x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.xml
@@ -0,0 +1,44 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2' cache='none'/>
+ <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <video>
+ <model type='virtio' heads='1' primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 29b7e1883c..b00b71e10e 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2770,6 +2770,11 @@ mymain(void)
DO_TEST_CAPS_LATEST("video-virtio-gpu-sdl-gl");
DO_TEST_CAPS_LATEST("video-virtio-gpu-secondary");
DO_TEST_CAPS_LATEST("video-virtio-vga");
+ DO_TEST_FULL("video-virtio-vga", ".x86_64-latest.QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled",
+ ARG_CAPS_ARCH, "x86_64",
+ ARG_CAPS_VER, "latest",
+ ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_VIRTIO_VGA, QEMU_CAPS_LAST,
+ ARG_END);
DO_TEST_CAPS_LATEST("video-virtio-blob-on");
DO_TEST_CAPS_LATEST("video-virtio-blob-off");
DO_TEST_CAPS_LATEST("video-virtio-vga-gpu-gl");
--
2.55.0

View File

@ -0,0 +1,145 @@
From 26a62b18ad904305964a92173aea7c98fd35abf7 Mon Sep 17 00:00:00 2001
Message-ID: <26a62b18ad904305964a92173aea7c98fd35abf7.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 8 Jun 2026 11:00:31 +0200
Subject: [PATCH] virDomainVideoDefFormat: Use 'virXMLFormatElement' instead of
custom formatter
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b64f4bab656a019da307054fb354a3fe36b36b4f)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/conf/domain_conf.c | 79 ++++++++++++++++++++----------------------
1 file changed, 37 insertions(+), 42 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cec0f88f0f..dc19e258dd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27034,6 +27034,9 @@ static void
virDomainVideoAccelDefFormat(virBuffer *buf,
virDomainVideoAccelDef *def)
{
+ if (!def)
+ return;
+
virBufferAddLit(buf, "<acceleration");
if (def->accel3d) {
virBufferAsprintf(buf, " accel3d='%s'",
@@ -27051,6 +27054,9 @@ static void
virDomainVideoResolutionDefFormat(virBuffer *buf,
virDomainVideoResolutionDef *def)
{
+ if (!def)
+ return;
+
virBufferAddLit(buf, "<resolution");
if (def->x && def->y) {
virBufferAsprintf(buf, " x='%u' y='%u'",
@@ -27065,7 +27071,10 @@ virDomainVideoDefFormat(virBuffer *buf,
unsigned int flags)
{
const char *model = virDomainVideoTypeToString(def->type);
- g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) modelAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) modelChildBuf = VIR_BUFFER_INIT_CHILD(&childBuf);
if (!model) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -27073,61 +27082,47 @@ virDomainVideoDefFormat(virBuffer *buf,
return -1;
}
- virBufferAddLit(buf, "<video>\n");
- virBufferAdjustIndent(buf, 2);
- virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
- if (virBufferUse(&driverBuf) || (def->driver && def->driver->vgaconf) ||
- def->backend != VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT) {
- virBufferAddLit(buf, "<driver");
- if (virBufferUse(&driverBuf))
- virBufferAddBuffer(buf, &driverBuf);
- if (def->driver && def->driver->vgaconf)
- virBufferAsprintf(buf, " vgaconf='%s'",
- virDomainVideoVGAConfTypeToString(def->driver->vgaconf));
- if (def->backend != VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT)
- virBufferAsprintf(buf, " name='%s'",
- virDomainVideoBackendTypeToString(def->backend));
- virBufferAddLit(buf, "/>\n");
- }
- virBufferAsprintf(buf, "<model type='%s'",
- model);
+ virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
+ if (def->driver && def->driver->vgaconf)
+ virBufferAsprintf(&driverAttrBuf, " vgaconf='%s'",
+ virDomainVideoVGAConfTypeToString(def->driver->vgaconf));
+ if (def->backend != VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT)
+ virBufferAsprintf(&driverAttrBuf, " name='%s'",
+ virDomainVideoBackendTypeToString(def->backend));
+
+ virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL);
+
+ virBufferAsprintf(&modelAttrBuf, " type='%s'", model);
if (def->ram)
- virBufferAsprintf(buf, " ram='%u'", def->ram);
+ virBufferAsprintf(&modelAttrBuf, " ram='%u'", def->ram);
if (def->vram)
- virBufferAsprintf(buf, " vram='%u'", def->vram);
+ virBufferAsprintf(&modelAttrBuf, " vram='%u'", def->vram);
if (def->vram64)
- virBufferAsprintf(buf, " vram64='%u'", def->vram64);
+ virBufferAsprintf(&modelAttrBuf, " vram64='%u'", def->vram64);
if (def->vgamem)
- virBufferAsprintf(buf, " vgamem='%u'", def->vgamem);
+ virBufferAsprintf(&modelAttrBuf, " vgamem='%u'", def->vgamem);
if (def->heads)
- virBufferAsprintf(buf, " heads='%u'", def->heads);
+ virBufferAsprintf(&modelAttrBuf, " heads='%u'", def->heads);
if (def->primary)
- virBufferAddLit(buf, " primary='yes'");
+ virBufferAddLit(&modelAttrBuf, " primary='yes'");
if (def->blob != VIR_TRISTATE_SWITCH_ABSENT)
- virBufferAsprintf(buf, " blob='%s'", virTristateSwitchTypeToString(def->blob));
+ virBufferAsprintf(&modelAttrBuf, " blob='%s'", virTristateSwitchTypeToString(def->blob));
if (def->edid != VIR_TRISTATE_SWITCH_ABSENT)
- virBufferAsprintf(buf, " edid='%s'", virTristateSwitchTypeToString(def->edid));
- if (def->accel || def->res) {
- virBufferAddLit(buf, ">\n");
- virBufferAdjustIndent(buf, 2);
- if (def->accel)
- virDomainVideoAccelDefFormat(buf, def->accel);
- if (def->res)
- virDomainVideoResolutionDefFormat(buf, def->res);
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</model>\n");
- } else {
- virBufferAddLit(buf, "/>\n");
- }
+ virBufferAsprintf(&modelAttrBuf, " edid='%s'", virTristateSwitchTypeToString(def->edid));
- virDomainDeviceInfoFormat(buf, &def->info, flags);
+ virDomainVideoAccelDefFormat(&modelChildBuf, def->accel);
+ virDomainVideoResolutionDefFormat(&modelChildBuf, def->res);
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</video>\n");
+ virXMLFormatElement(&childBuf, "model", &modelAttrBuf, &modelChildBuf);
+
+ virDomainDeviceInfoFormat(&childBuf, &def->info, flags);
+
+ virXMLFormatElement(buf, "video", NULL, &childBuf);
return 0;
}
+
static int
virDomainInputDefFormat(virBuffer *buf,
virDomainInputDef *def,
--
2.55.0

View File

@ -0,0 +1,46 @@
From 1e63c510b4f687c3b52bf9b606a54793155aea21 Mon Sep 17 00:00:00 2001
Message-ID: <1e63c510b4f687c3b52bf9b606a54793155aea21.1784297532.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 26 May 2026 11:39:28 +0200
Subject: [PATCH] virQEMUCapsCacheLookupDefault: Fix error message when no
emulators are installed
When querying capabilities for the default emulator with no other
arguments (e.g. 'virsh domcapabilities) fix error whithout emulator
installed an error is reported but the error would mention '(null)'
architecture:
# virsh domcapabilities
error: failed to get emulator capabilities
error: unsupported configuration: unable to find any emulator to serve '(null)' architecture
This happens as the error formatting takes 'archStr' which is NULL for
the default architecture instead of using 'arch' which is populated by
the host's architecture and converting it back.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 9e43cf3e5866eb2186e903a000c724461466516a)
https://redhat.atlassian.net/browse/RHEL-186019
https://redhat.atlassian.net/browse/RHEL-177646 (rhel-9.9)
---
src/qemu/qemu_capabilities.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6dd7284505..fc5a428620 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6372,7 +6372,7 @@ virQEMUCapsCacheLookupDefault(virFileCache *cache,
if (!binary) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unable to find any emulator to serve '%1$s' architecture"),
- archStr);
+ virArchToString(arch));
return NULL;
}
--
2.55.0

View File

@ -294,7 +294,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 11.10.0
Release: 14%{?dist}%{?extra_release}
Release: 15%{?dist}%{?extra_release}
License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1
URL: https://libvirt.org/
@ -422,6 +422,26 @@ Patch117: libvirt-virsh-Add-supported-cpu-features-option-for-domcapabilities.pa
Patch118: libvirt-domaincapstest-Test-SUPPORTED_CPU_FEATURES-flag.patch
Patch119: libvirt-qemu_capabilities-Fix-domain-capabilities-on-AMD-CPUs.patch
Patch120: libvirt-qemu-Ensure-proper-shutdown-ordering-of-virtlockd-virtlogd-daemons.patch
Patch121: libvirt-qemu-capabilities-Apply-capability_filters-configration-option-on-all-capabilities.patch
Patch122: libvirt-qemu-capabilities-Export-virQEMUCapsNewCopy-outside-of-qemu_capspriv.patch
Patch123: libvirt-qemu-Allow-reuse-of-qemuProcessStartUpdateCustomCaps.patch
Patch124: libvirt-qemu-validate-Validate-VM-config-with-qemuCaps-influenced-by-qemu-capabilities.patch
Patch125: libvirt-qemu-postparse-Process-VM-config-with-qemuCaps-influenced-by-qemu-capabilities.patch
Patch126: libvirt-virQEMUCapsCacheLookupDefault-Fix-error-message-when-no-emulators-are-installed.patch
Patch127: libvirt-qemuxmlconfdata-un-symlink-video-virtio-vga-gpu-gl-output.patch
Patch128: libvirt-qemuxmlconftest-Add-video-virtio-vga-invocation-with-QEMU_CAPS_DEVICE_VIRTIO_VGA-disabled.patch
Patch129: libvirt-qemuxmlconftest-Add-test-cases-for-configs-asking-for-virtio-gpu-gl-or-virtio-vga-gl-without-the-capability.patch
Patch130: libvirt-qemuxmlconftest-Add-invocation-of-video-virtio-vga-gpu-gl-with-missing-caps-and-VIR_DOMAIN_DEF_PARSE_ABI_UPDATE.patch
Patch131: libvirt-qemustatusxml2xml-Add-test-case-capturing-virtio-video-device.patch
Patch132: libvirt-virDomainVideoDefFormat-Use-virXMLFormatElement-instead-of-custom-formatter.patch
Patch133: libvirt-conf-Add-fields-for-recording-actually-selected-virtio-video-device.patch
Patch134: libvirt-qemuxmlconftest-Add-test-case-for-specifying-virtio-gpu-where-virtio-vga-would-be-picked.patch
Patch135: libvirt-qemuDeviceVideoGetModel-Directly-return-picked-model.patch
Patch136: libvirt-qemu-postparse-Fill-in-selected-virtio-video-frondend-device-in-the-XML.patch
Patch137: libvirt-qemuValidateDomainDeviceDefVideo-Fix-checks-of-virtio-video-devices.patch
Patch138: libvirt-qemuDeviceVideoGetModel-Remove-logic-for-selecting-virtio-devices.patch
Patch139: libvirt-qemuDeviceVideoGetModel-Simplify-by-relying-on-checks-from-qemuValidateDomainDeviceDefVideo.patch
Patch140: libvirt-qemu-Remove-qemuDomainSupportsVideoVga.patch
Requires: libvirt-daemon = %{version}-%{release}
@ -2813,6 +2833,28 @@ exit 0
%endif
%changelog
* Fri Jul 17 2026 Jiri Denemark <jdenemar@redhat.com> - 11.10.0-15
- qemu: capabilities: Apply 'capability_filters' configration option on all capabilities (RHEL-177646)
- qemu: capabilities: Export 'virQEMUCapsNewCopy' outside of 'qemu_capspriv' (RHEL-177646)
- qemu: Allow reuse of 'qemuProcessStartUpdateCustomCaps' (RHEL-177646)
- qemu: validate: Validate VM config with qemuCaps influenced by <qemu:capabilities> (RHEL-177646)
- qemu: postparse: Process VM config with qemuCaps influenced by <qemu:capabilities> (RHEL-177646)
- virQEMUCapsCacheLookupDefault: Fix error message when no emulators are installed (RHEL-177646)
- qemuxmlconfdata: un-symlink 'video-virtio-vga-gpu-gl' output (RHEL-177646)
- qemuxmlconftest: Add 'video-virtio-vga' invocation with QEMU_CAPS_DEVICE_VIRTIO_VGA disabled (RHEL-177646)
- qemuxmlconftest: Add test cases for configs asking for 'virtio-gpu-gl' or 'virtio-vga-gl' without the capability (RHEL-177646)
- qemuxmlconftest: Add invocation of 'video-virtio-vga-gpu-gl' with missing caps and VIR_DOMAIN_DEF_PARSE_ABI_UPDATE (RHEL-177646)
- qemustatusxml2xml: Add test case capturing virtio video device (RHEL-177646)
- virDomainVideoDefFormat: Use 'virXMLFormatElement' instead of custom formatter (RHEL-177646)
- conf: Add fields for recording actually-selected virtio video device (RHEL-177646)
- qemuxmlconftest: Add test case for specifying 'virtio-gpu' where 'virtio-vga' would be picked (RHEL-177646)
- qemuDeviceVideoGetModel: Directly return picked model (RHEL-177646)
- qemu: postparse: Fill in selected virtio video frondend device in the XML (RHEL-177646)
- qemuValidateDomainDeviceDefVideo: Fix checks of virtio video devices (RHEL-177646)
- qemuDeviceVideoGetModel: Remove logic for selecting 'virtio' devices (RHEL-177646)
- qemuDeviceVideoGetModel: Simplify by relying on checks from 'qemuValidateDomainDeviceDefVideo' (RHEL-177646)
- qemu: Remove 'qemuDomainSupportsVideoVga' (RHEL-177646)
* Wed Jul 1 2026 Jiri Denemark <jdenemar@redhat.com> - 11.10.0-14
- distro: Update URL in plans.fmf
- qemu: Ensure proper shutdown ordering of virtlockd/virtlogd daemons (RHEL-180876)