c1c534
From 4ab9c0ceda884c08553ebca52ab24a9de0971251 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <4ab9c0ceda884c08553ebca52ab24a9de0971251@dist-git>
c1c534
From: Andrea Bolognani <abologna@redhat.com>
c1c534
Date: Wed, 29 Nov 2017 16:23:18 +0100
c1c534
Subject: [PATCH] qemu: Require QEMU_CAPS_DEVICE_ISA_SERIAL for isa-serial
c1c534
c1c534
We should make sure the isa-serial device is available before
c1c534
formatting it on the QEMU command line.
c1c534
c1c534
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c1c534
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
c1c534
(cherry picked from commit b9be657b6807ddab3d4872723f4d5e53f8f49b01)
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1512929
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_command.c  |  7 +++----
c1c534
 tests/qemuxml2argvtest.c | 29 +++++++++++++++++++++++++++--
c1c534
 2 files changed, 30 insertions(+), 6 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
c1c534
index a2cfb3d4a3..5c246698c0 100644
c1c534
--- a/src/qemu/qemu_command.c
c1c534
+++ b/src/qemu/qemu_command.c
c1c534
@@ -9223,6 +9223,8 @@ static virQEMUCapsFlags
c1c534
 qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel)
c1c534
 {
c1c534
     switch (targetModel) {
c1c534
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
c1c534
+        return QEMU_CAPS_DEVICE_ISA_SERIAL;
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
c1c534
         return QEMU_CAPS_DEVICE_USB_SERIAL;
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
c1c534
@@ -9233,7 +9235,6 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel)
c1c534
         return QEMU_CAPS_DEVICE_SCLPCONSOLE;
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
c1c534
         return QEMU_CAPS_DEVICE_SCLPLMCONSOLE;
c1c534
-    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
c1c534
@@ -10356,6 +10357,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
c1c534
     virQEMUCapsFlags caps;
c1c534
 
c1c534
     switch ((virDomainChrSerialTargetModel) serial->targetModel) {
c1c534
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
c1c534
@@ -10372,9 +10374,6 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
c1c534
         }
c1c534
         break;
c1c534
 
c1c534
-    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
c1c534
-        break;
c1c534
-
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
c1c534
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
c1c534
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
c1c534
index 852525e7b4..b61cee74c7 100644
c1c534
--- a/tests/qemuxml2argvtest.c
c1c534
+++ b/tests/qemuxml2argvtest.c
c1c534
@@ -771,6 +771,7 @@ mymain(void)
c1c534
     DO_TEST_FAILURE("reboot-timeout-enabled", NONE);
c1c534
 
c1c534
     DO_TEST("bios",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_SGA);
c1c534
     DO_TEST("bios-nvram", NONE);
c1c534
     DO_TEST("bios-nvram-secure",
c1c534
@@ -814,6 +815,7 @@ mymain(void)
c1c534
             QEMU_CAPS_SPICE,
c1c534
             QEMU_CAPS_HDA_DUPLEX,
c1c534
             QEMU_CAPS_USB_HUB,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_DEVICE_CIRRUS_VGA);
c1c534
     DO_TEST("eoi-disabled", NONE);
c1c534
     DO_TEST("eoi-enabled", NONE);
c1c534
@@ -1231,48 +1233,64 @@ mymain(void)
c1c534
 
c1c534
     DO_TEST("serial-file-log",
c1c534
             QEMU_CAPS_CHARDEV_FILE_APPEND,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_CHARDEV_LOGFILE);
c1c534
     DO_TEST("serial-spiceport",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
c1c534
             QEMU_CAPS_DEVICE_QXL,
c1c534
             QEMU_CAPS_SPICE,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_CHARDEV_SPICEPORT);
c1c534
     DO_TEST("serial-spiceport-nospice", NONE);
c1c534
 
c1c534
-    DO_TEST("console-compat", NONE);
c1c534
-    DO_TEST("console-compat-auto", NONE);
c1c534
+    DO_TEST("console-compat",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL);
c1c534
+    DO_TEST("console-compat-auto",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL);
c1c534
 
c1c534
     DO_TEST("serial-vc-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-pty-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-dev-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-dev-chardev-iobase",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-file-chardev",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_CHARDEV_FILE_APPEND);
c1c534
     DO_TEST("serial-unix-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-tcp-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-udp-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("serial-tcp-telnet-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     driver.config->chardevTLS = 1;
c1c534
     DO_TEST("serial-tcp-tlsx509-chardev",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_OBJECT_TLS_CREDS_X509);
c1c534
     driver.config->chardevTLSx509verify = 1;
c1c534
     DO_TEST("serial-tcp-tlsx509-chardev-verify",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_OBJECT_TLS_CREDS_X509);
c1c534
     driver.config->chardevTLSx509verify = 0;
c1c534
     DO_TEST("serial-tcp-tlsx509-chardev-notls",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_OBJECT_TLS_CREDS_X509);
c1c534
     VIR_FREE(driver.config->chardevTLSx509certdir);
c1c534
     if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
c1c534
@@ -1284,22 +1302,26 @@ mymain(void)
c1c534
     DO_TEST("serial-tcp-tlsx509-secret-chardev",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
             QEMU_CAPS_OBJECT_SECRET,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_OBJECT_TLS_CREDS_X509);
c1c534
 # else
c1c534
     DO_TEST_FAILURE("serial-tcp-tlsx509-secret-chardev",
c1c534
                     QEMU_CAPS_NODEFCONFIG,
c1c534
                     QEMU_CAPS_OBJECT_SECRET,
c1c534
+                    QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
                     QEMU_CAPS_OBJECT_TLS_CREDS_X509);
c1c534
 # endif
c1c534
     driver.config->chardevTLS = 0;
c1c534
     VIR_FREE(driver.config->chardevTLSx509certdir);
c1c534
     DO_TEST("serial-many-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("parallel-tcp-chardev",
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("parallel-parport-chardev",
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("console-compat-chardev",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("pci-serial-dev-chardev",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
@@ -1320,6 +1342,7 @@ mymain(void)
c1c534
     DO_TEST("console-virtio",
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("console-virtio-many",
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_NODEFCONFIG);
c1c534
     DO_TEST("console-virtio-s390",
c1c534
             QEMU_CAPS_NODEFCONFIG,
c1c534
@@ -2310,6 +2333,7 @@ mymain(void)
c1c534
             QEMU_CAPS_CHARDEV_SPICEVMC,
c1c534
             QEMU_CAPS_DEVICE_QXL,
c1c534
             QEMU_CAPS_HDA_DUPLEX,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_USB_REDIR);
c1c534
 
c1c534
     /* Test automatic and manual setting of pcie-root-port attributes */
c1c534
@@ -2907,6 +2931,7 @@ mymain(void)
c1c534
     DO_TEST("user-aliases", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_CIRRUS_VGA,
c1c534
             QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3,
c1c534
             QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC,
c1c534
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
c1c534
             QEMU_CAPS_HDA_DUPLEX);
c1c534
     DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
c1c534
 
c1c534
-- 
c1c534
2.15.1
c1c534