In my recent commit of a33279daa8 I've moved video model check
from domain capabilities validator into qemu validator. During
that I had to basically duplicate video model to qemuCaps checks.
Problem with this approach is that after my commit qemu validator
and domCaps are disconnected and thus domCaps might report (in
general) different set of supported video models.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_capabilities.h | 4 ++++
src/qemu/qemu_validate.c | 37 +++---------------------------------
3 files changed, 8 insertions(+), 35 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9f9f976754..78d3b965c6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5991,7 +5991,7 @@ virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps,
}
-static void
+void
virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsDeviceVideoPtr dev)
{
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 9d3f73b2ab..22b3da3e63 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -739,6 +739,10 @@ int virQEMUCapsFillDomainCaps(virQEMUCapsPtr qemuCaps,
virFirmwarePtr *firmwares,
size_t nfirmwares);
+void virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps,
+ virDomainCapsDeviceVideoPtr dev);
+
+
bool virQEMUCapsGuestIsNative(virArch host,
virArch guest);
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 09cdcb20c2..6e1db2715d 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2203,46 +2203,15 @@ static int
qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
virQEMUCapsPtr qemuCaps)
{
- virQEMUCapsFlags cap = QEMU_CAPS_LAST;
+ virDomainCapsDeviceVideo videoCaps = { 0 };
/* there's no properties to validate for NONE video devices */
if (video->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
return 0;
- switch ((virDomainVideoType) video->type) {
- case VIR_DOMAIN_VIDEO_TYPE_VGA:
- cap = QEMU_CAPS_DEVICE_VGA;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
- cap = QEMU_CAPS_DEVICE_CIRRUS_VGA;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
- cap = QEMU_CAPS_DEVICE_VMWARE_SVGA;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_QXL:
- cap = QEMU_CAPS_DEVICE_QXL;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
- cap = QEMU_CAPS_DEVICE_VIRTIO_GPU;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
- cap = QEMU_CAPS_DEVICE_BOCHS_DISPLAY;
- break;
- case VIR_DOMAIN_VIDEO_TYPE_RAMFB:
- cap = QEMU_CAPS_DEVICE_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:
- /* nada */
- break;
- }
+ virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, &videoCaps);
- if (!virQEMUCapsGet(qemuCaps, cap)) {
+ if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(videoCaps.modelType, video->type)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("domain configuration does not support video model
'%s'"),
virDomainVideoTypeToString(video->type));
--
2.26.2