mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-31 00:45:18 +00:00
qemu: Don't blindly assume VNC is supported
Currently it's assumed that qemu always supports VNC, however it is definitely possible to compile qemu without VNC support so we should at the very least check for it and handle that correctly.
This commit is contained in:
parent
8be88034bf
commit
2da776b1d6
@ -188,6 +188,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
|
||||
"dump-guest-core",
|
||||
"seamless-migration",
|
||||
"block-commit",
|
||||
"vnc",
|
||||
);
|
||||
|
||||
struct _qemuCaps {
|
||||
@ -938,6 +939,8 @@ qemuCapsComputeCmdFlags(const char *help,
|
||||
}
|
||||
if (strstr(help, "-spice"))
|
||||
qemuCapsSet(caps, QEMU_CAPS_SPICE);
|
||||
if (strstr(help, "-vnc"))
|
||||
qemuCapsSet(caps, QEMU_CAPS_VNC);
|
||||
if (strstr(help, "seamless-migration="))
|
||||
qemuCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION);
|
||||
if (strstr(help, "boot=on"))
|
||||
@ -1884,6 +1887,8 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps,
|
||||
qemuCapsSet(caps, QEMU_CAPS_KVM);
|
||||
else if (STREQ(name, "block-commit"))
|
||||
qemuCapsSet(caps, QEMU_CAPS_BLOCK_COMMIT);
|
||||
else if (STREQ(name, "query-vnc"))
|
||||
qemuCapsSet(caps, QEMU_CAPS_VNC);
|
||||
VIR_FREE(name);
|
||||
}
|
||||
VIR_FREE(commands);
|
||||
|
@ -151,6 +151,7 @@ enum qemuCapsFlags {
|
||||
QEMU_CAPS_DUMP_GUEST_CORE = 111, /* dump-guest-core-parameter */
|
||||
QEMU_CAPS_SEAMLESS_MIGRATION = 112, /* seamless-migration for SPICE */
|
||||
QEMU_CAPS_BLOCK_COMMIT = 113, /* block-commit */
|
||||
QEMU_CAPS_VNC = 114, /* Is -vnc available? */
|
||||
|
||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||
};
|
||||
|
@ -5857,6 +5857,12 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||
virBuffer opt = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (!qemuCapsGet(caps, QEMU_CAPS_VNC)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("vnc graphics are not supported with this QEMU"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (def->graphics[0]->data.vnc.socket ||
|
||||
driver->vncAutoUnixSocket) {
|
||||
|
||||
|
@ -147,7 +147,8 @@ mymain(void)
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
QEMU_CAPS_DRIVE,
|
||||
QEMU_CAPS_NAME,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("kvm-74", 9001, 1, 74,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -161,7 +162,8 @@ mymain(void)
|
||||
QEMU_CAPS_MEM_PATH,
|
||||
QEMU_CAPS_TDF,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("kvm-83-rhel56", 9001, 1, 83,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -189,7 +191,8 @@ mymain(void)
|
||||
QEMU_CAPS_SMBIOS_TYPE,
|
||||
QEMU_CAPS_SPICE,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-0.10.5", 10005, 0, 0,
|
||||
QEMU_CAPS_KQEMU,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
@ -210,7 +213,8 @@ mymain(void)
|
||||
QEMU_CAPS_NO_HPET,
|
||||
QEMU_CAPS_VGA_NONE,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.10.5", 10005, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -237,7 +241,8 @@ mymain(void)
|
||||
QEMU_CAPS_NESTING,
|
||||
QEMU_CAPS_VGA_NONE,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("kvm-86", 10050, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -264,7 +269,8 @@ mymain(void)
|
||||
QEMU_CAPS_SMBIOS_TYPE,
|
||||
QEMU_CAPS_VGA_NONE,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.11.0-rc2", 10092, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -296,7 +302,8 @@ mymain(void)
|
||||
QEMU_CAPS_SMBIOS_TYPE,
|
||||
QEMU_CAPS_VGA_NONE,
|
||||
QEMU_CAPS_NO_SHUTDOWN,
|
||||
QEMU_CAPS_NO_ACPI);
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-0.12.1", 12001, 0, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -331,7 +338,8 @@ mymain(void)
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO,
|
||||
QEMU_CAPS_CPU_HOST);
|
||||
QEMU_CAPS_CPU_HOST,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -382,7 +390,8 @@ mymain(void)
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO,
|
||||
QEMU_CAPS_CPU_HOST);
|
||||
QEMU_CAPS_CPU_HOST,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -424,7 +433,8 @@ mymain(void)
|
||||
QEMU_CAPS_PCI_ROMBAR,
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO,
|
||||
QEMU_CAPS_CPU_HOST);
|
||||
QEMU_CAPS_CPU_HOST,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -484,7 +494,8 @@ mymain(void)
|
||||
QEMU_CAPS_NO_ACPI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO,
|
||||
QEMU_CAPS_CPU_HOST,
|
||||
QEMU_CAPS_SCSI_LSI);
|
||||
QEMU_CAPS_SCSI_LSI,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -542,7 +553,8 @@ mymain(void)
|
||||
QEMU_CAPS_VIRTIO_BLK_SCSI,
|
||||
QEMU_CAPS_VIRTIO_BLK_SG_IO,
|
||||
QEMU_CAPS_CPU_HOST,
|
||||
QEMU_CAPS_BLOCKIO);
|
||||
QEMU_CAPS_BLOCKIO,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -610,7 +622,8 @@ mymain(void)
|
||||
QEMU_CAPS_DRIVE_COPY_ON_READ,
|
||||
QEMU_CAPS_CPU_HOST,
|
||||
QEMU_CAPS_SCSI_CD,
|
||||
QEMU_CAPS_BLOCKIO);
|
||||
QEMU_CAPS_BLOCKIO,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-1.0", 1000000, 0, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -683,7 +696,8 @@ mymain(void)
|
||||
QEMU_CAPS_SCSI_CD,
|
||||
QEMU_CAPS_IDE_CD,
|
||||
QEMU_CAPS_SCSI_LSI,
|
||||
QEMU_CAPS_BLOCKIO);
|
||||
QEMU_CAPS_BLOCKIO,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-1.1.0", 1001000, 0, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -764,7 +778,8 @@ mymain(void)
|
||||
QEMU_CAPS_NETDEV_BRIDGE,
|
||||
QEMU_CAPS_SCSI_LSI,
|
||||
QEMU_CAPS_VIRTIO_SCSI_PCI,
|
||||
QEMU_CAPS_BLOCKIO);
|
||||
QEMU_CAPS_BLOCKIO,
|
||||
QEMU_CAPS_VNC);
|
||||
DO_TEST("qemu-1.2.0", 1002000, 0, 0,
|
||||
QEMU_CAPS_VNC_COLON,
|
||||
QEMU_CAPS_NO_REBOOT,
|
||||
@ -848,7 +863,8 @@ mymain(void)
|
||||
QEMU_CAPS_BLOCKIO,
|
||||
QEMU_CAPS_SCSI_DISK_WWN,
|
||||
QEMU_CAPS_SECCOMP_SANDBOX,
|
||||
QEMU_CAPS_DUMP_GUEST_CORE);
|
||||
QEMU_CAPS_DUMP_GUEST_CORE,
|
||||
QEMU_CAPS_VNC);
|
||||
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
@ -536,16 +536,16 @@ mymain(void)
|
||||
QEMU_CAPS_SCSI_BLOCK, QEMU_CAPS_VIRTIO_BLK_SG_IO,
|
||||
QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI_PCI);
|
||||
|
||||
DO_TEST("graphics-vnc", NONE);
|
||||
DO_TEST("graphics-vnc-socket", NONE);
|
||||
DO_TEST("graphics-vnc", QEMU_CAPS_VNC);
|
||||
DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC);
|
||||
|
||||
driver.vncSASL = 1;
|
||||
driver.vncSASLdir = strdup("/root/.sasl2");
|
||||
DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VGA);
|
||||
DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_VGA);
|
||||
driver.vncTLS = 1;
|
||||
driver.vncTLSx509verify = 1;
|
||||
driver.vncTLSx509certdir = strdup("/etc/pki/tls/qemu");
|
||||
DO_TEST("graphics-vnc-tls", NONE);
|
||||
DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC);
|
||||
driver.vncSASL = driver.vncTLSx509verify = driver.vncTLS = 0;
|
||||
VIR_FREE(driver.vncSASLdir);
|
||||
VIR_FREE(driver.vncTLSx509certdir);
|
||||
@ -585,7 +585,7 @@ mymain(void)
|
||||
|
||||
DO_TEST("input-usbmouse", NONE);
|
||||
DO_TEST("input-usbtablet", NONE);
|
||||
DO_TEST("input-xen", QEMU_CAPS_DOMID, QEMU_CAPS_KVM);
|
||||
DO_TEST("input-xen", QEMU_CAPS_DOMID, QEMU_CAPS_KVM, QEMU_CAPS_VNC);
|
||||
DO_TEST("misc-acpi", NONE);
|
||||
DO_TEST("misc-disable-s3", QEMU_CAPS_DISABLE_S3);
|
||||
DO_TEST("misc-disable-suspends", QEMU_CAPS_DISABLE_S3, QEMU_CAPS_DISABLE_S4);
|
||||
|
Loading…
x
Reference in New Issue
Block a user