qemu_process: always check capabilities for video devices

Before this patch we've checked qemu capabilities for video devices
only while constructing qemu command line using "-device" option.

Since we support qemu only if "-device" option is present we can use
the same capabilities to check also video devices while using "-vga"
option to construct qemu command line.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-10-10 17:51:38 +02:00
parent 8fed30d004
commit 33af92a91c
2 changed files with 58 additions and 42 deletions

View File

@ -4457,9 +4457,7 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
for (i = 0; i < vm->def->nvideos; i++) { for (i = 0; i < vm->def->nvideos; i++) {
video = vm->def->videos[i]; video = vm->def->videos[i];
if (video->primary && if ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY) &&
((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) ||
(video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS && (video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) ||
@ -4468,7 +4466,7 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
(video->type == VIR_DOMAIN_VIDEO_TYPE_QXL && (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) ||
(video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO && (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)))) { !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("this QEMU does not support '%s' video device"), _("this QEMU does not support '%s' video device"),
virDomainVideoTypeToString(video->type)); virDomainVideoTypeToString(video->type));

View File

@ -748,7 +748,8 @@ mymain(void)
QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DRIVE_AIO, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DRIVE_AIO,
QEMU_CAPS_CCID_PASSTHRU, QEMU_CAPS_CHARDEV, QEMU_CAPS_CCID_PASSTHRU, QEMU_CAPS_CHARDEV,
QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_SPICE,
QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_HUB); QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_HUB,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("eoi-disabled", NONE); DO_TEST("eoi-disabled", NONE);
DO_TEST("eoi-enabled", NONE); DO_TEST("eoi-enabled", NONE);
DO_TEST("pv-spinlock-disabled", NONE); DO_TEST("pv-spinlock-disabled", NONE);
@ -963,32 +964,39 @@ mymain(void)
QEMU_CAPS_KVM, QEMU_CAPS_KVM,
QEMU_CAPS_DRIVE_SERIAL); QEMU_CAPS_DRIVE_SERIAL);
DO_TEST("graphics-vnc", QEMU_CAPS_VNC); DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET); DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET,
DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY); QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY,
DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC); QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->vncAutoUnixSocket = true; driver.config->vncAutoUnixSocket = true;
DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->vncAutoUnixSocket = false; driver.config->vncAutoUnixSocket = false;
DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC,
DO_TEST("graphics-vnc-none", QEMU_CAPS_VNC); QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-vnc-none", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->vncSASL = 1; driver.config->vncSASL = 1;
VIR_FREE(driver.config->vncSASLdir); VIR_FREE(driver.config->vncSASLdir);
ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2")); ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->vncTLS = 1; driver.config->vncTLS = 1;
driver.config->vncTLSx509verify = 1; driver.config->vncTLSx509verify = 1;
DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0; driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
VIR_FREE(driver.config->vncSASLdir); VIR_FREE(driver.config->vncSASLdir);
VIR_FREE(driver.config->vncTLSx509certdir); VIR_FREE(driver.config->vncTLSx509certdir);
DO_TEST("graphics-sdl", QEMU_CAPS_SDL); DO_TEST("graphics-sdl", QEMU_CAPS_SDL, QEMU_CAPS_DEVICE_VGA);
DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL); DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("nographics", NONE); DO_TEST("nographics", NONE);
DO_TEST("nographics-display", DO_TEST("nographics-display",
QEMU_CAPS_DISPLAY); QEMU_CAPS_DISPLAY);
@ -999,7 +1007,7 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_SPICE_FILE_XFER_DISABLE); QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
DO_TEST("graphics-spice-no-args", DO_TEST("graphics-spice-no-args",
QEMU_CAPS_SPICE); QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->spiceSASL = 1; driver.config->spiceSASL = 1;
ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2")); ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
DO_TEST("graphics-spice-sasl", DO_TEST("graphics-spice-sasl",
@ -1011,14 +1019,16 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_CHARDEV_SPICEVMC,
QEMU_CAPS_NODEFCONFIG); QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-spice-compression", DO_TEST("graphics-spice-compression",
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_QXL); QEMU_CAPS_DEVICE_QXL);
DO_TEST("graphics-spice-timeout", DO_TEST("graphics-spice-timeout",
QEMU_CAPS_KVM, QEMU_CAPS_KVM,
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_QXL); QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_DEVICE_VGA);
DO_TEST("graphics-spice-qxl-vga", DO_TEST("graphics-spice-qxl-vga",
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_QXL); QEMU_CAPS_DEVICE_QXL);
@ -1027,21 +1037,24 @@ mymain(void)
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
QEMU_CAPS_CHARDEV_SPICEVMC); QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-spice-agent-file-xfer", DO_TEST("graphics-spice-agent-file-xfer",
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_SPICE_FILE_XFER_DISABLE); QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
DO_TEST("graphics-spice-socket", DO_TEST("graphics-spice-socket",
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_SPICE_UNIX); QEMU_CAPS_SPICE_UNIX,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("graphics-spice-auto-socket", DO_TEST("graphics-spice-auto-socket",
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_SPICE_UNIX); QEMU_CAPS_SPICE_UNIX,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->spiceAutoUnixSocket = true; driver.config->spiceAutoUnixSocket = true;
DO_TEST("graphics-spice-auto-socket-cfg", DO_TEST("graphics-spice-auto-socket-cfg",
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE,
QEMU_CAPS_SPICE_UNIX); QEMU_CAPS_SPICE_UNIX,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->spiceAutoUnixSocket = false; driver.config->spiceAutoUnixSocket = false;
DO_TEST("input-usbmouse", NONE); DO_TEST("input-usbmouse", NONE);
@ -1184,10 +1197,12 @@ mymain(void)
QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_SCLP_S390); QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_SCLP_S390);
DO_TEST("channel-spicevmc", DO_TEST("channel-spicevmc",
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC); QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("channel-spicevmc-old", DO_TEST("channel-spicevmc-old",
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_SPICEVMC); QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_SPICEVMC,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("channel-virtio-default", DO_TEST("channel-virtio-default",
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC); QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
@ -1561,7 +1576,7 @@ mymain(void)
QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_DEVICE_PCI_BRIDGE); QEMU_CAPS_DEVICE_PCI_BRIDGE);
DO_TEST("video-vga-nodevice", NONE); DO_TEST("video-vga-nodevice", QEMU_CAPS_DEVICE_VGA);
DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA, DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY); QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA, DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA,
@ -1652,11 +1667,14 @@ mymain(void)
DO_TEST_PARSE_ERROR("pci-slot-invalid", NONE); DO_TEST_PARSE_ERROR("pci-slot-invalid", NONE);
DO_TEST_PARSE_ERROR("pci-function-invalid", NONE); DO_TEST_PARSE_ERROR("pci-function-invalid", NONE);
DO_TEST("pci-autoadd-addr", QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST("pci-autoadd-addr", QEMU_CAPS_DEVICE_PCI_BRIDGE,
DO_TEST("pci-autoadd-idx", QEMU_CAPS_DEVICE_PCI_BRIDGE); QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("pci-autofill-addr", NONE); DO_TEST("pci-autoadd-idx", QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("pci-autofill-addr", QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("pci-many", DO_TEST("pci-many",
QEMU_CAPS_DEVICE_PCI_BRIDGE); QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("pci-bridge-many-disks", DO_TEST("pci-bridge-many-disks",
QEMU_CAPS_DEVICE_PCI_BRIDGE); QEMU_CAPS_DEVICE_PCI_BRIDGE);
DO_TEST("pcie-root", DO_TEST("pcie-root",
@ -2131,7 +2149,7 @@ mymain(void)
DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS, DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS,
QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV, QEMU_CAPS_VNC, QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV, QEMU_CAPS_VNC,
QEMU_CAPS_NAME_GUEST); QEMU_CAPS_NAME_GUEST, QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS); DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET); DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);