mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
qemu_validate: Deduplicate code for video model check
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@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
4f8677cee2
commit
d009f5b400
@ -5991,7 +5991,7 @@ virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps,
|
||||
virDomainCapsDeviceVideoPtr dev)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user