render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
404507
From a8befcda79640ae13c9787cb3be54ca2ee861077 Mon Sep 17 00:00:00 2001
404507
Message-Id: <a8befcda79640ae13c9787cb3be54ca2ee861077@dist-git>
404507
From: Andrea Bolognani <abologna@redhat.com>
404507
Date: Wed, 29 Nov 2017 16:22:51 +0100
404507
Subject: [PATCH] qemu: Add QEMU_CAPS_DEVICE_SPAPR_VTY
404507
404507
Up until now we assumed the spapr-vty device would always be
404507
present, which is not very nice. Check for its availability before
404507
using it instead.
404507
404507
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
404507
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
404507
(cherry picked from commit 87eabeb17d637b753dbb1e63e417e25bbd0f7d61)
404507
404507
 Conflicts:
404507
	src/qemu/qemu_capabilities.c
404507
	src/qemu/qemu_capabilities.h
404507
	tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
404507
	tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
404507
404507
	Insert the new capability in the right place, in both
404507
	declarations and caps.
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1449265
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1511421
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512929
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512934
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/qemu/qemu_capabilities.c                     |  3 ++-
404507
 src/qemu/qemu_capabilities.h                     |  2 +-
404507
 src/qemu/qemu_command.c                          |  6 ++++++
404507
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml |  1 +
404507
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml  |  1 +
404507
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml  |  1 +
404507
 tests/qemuxml2argvtest.c                         | 12 ++++++++++++
404507
 7 files changed, 24 insertions(+), 2 deletions(-)
404507
404507
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
404507
index 2f41e076cb..0defa9a3e4 100644
404507
--- a/src/qemu/qemu_capabilities.c
404507
+++ b/src/qemu/qemu_capabilities.c
404507
@@ -445,7 +445,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
404507
               "virtio-blk.num-queues",
404507
               "machine.pseries.resize-hpt",
404507
 
404507
-
404507
+              "spapr-vty",
404507
 
404507
               /* 275 */
404507
 
404507
@@ -1679,6 +1679,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
404507
     { "pcie-root-port", QEMU_CAPS_DEVICE_PCIE_ROOT_PORT },
404507
     { "qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI },
404507
     { "spapr-pci-host-bridge", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE },
404507
+    { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY },
404507
 };
404507
 
404507
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
404507
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
404507
index 60818daa1c..65b969a0ea 100644
404507
--- a/src/qemu/qemu_capabilities.h
404507
+++ b/src/qemu/qemu_capabilities.h
404507
@@ -431,7 +431,7 @@ typedef enum {
404507
     QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */
404507
     QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT, /* -machine pseries,resize-hpt */
404507
 
404507
-
404507
+    QEMU_CAPS_DEVICE_SPAPR_VTY, /* -device spapr-vty */
404507
 
404507
     /* 275 */
404507
 
404507
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
404507
index fc7f54e81e..65b6a59d3f 100644
404507
--- a/src/qemu/qemu_command.c
404507
+++ b/src/qemu/qemu_command.c
404507
@@ -10308,6 +10308,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
404507
     if (qemuDomainIsPSeries(def)) {
404507
         if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
404507
             serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
404507
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) {
404507
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
404507
+                               _("spapr-vty not supported in this QEMU binary"));
404507
+                goto error;
404507
+            }
404507
+
404507
             virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
404507
                               serial->info.alias);
404507
         }
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
404507
index c01777a5a3..c95025b41f 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
404507
@@ -178,6 +178,7 @@
404507
   <flag name='vxhs'/>
404507
   <flag name='virtio-blk.num-queues'/>
404507
   <flag name='machine.pseries.resize-hpt'/>
404507
+  <flag name='spapr-vty'/>
404507
   <flag name='disk-share-rw'/>
404507
   <version>2010000</version>
404507
   <kvmVersion>0</kvmVersion>
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
404507
index f1c9fc98a4..5ff8598fc8 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
404507
@@ -167,6 +167,7 @@
404507
   <flag name='vnc-multi-servers'/>
404507
   <flag name='chardev-reconnect'/>
404507
   <flag name='virtio-gpu.max_outputs'/>
404507
+  <flag name='spapr-vty'/>
404507
   <version>2006000</version>
404507
   <kvmVersion>0</kvmVersion>
404507
   <package></package>
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
404507
index e912211f40..3b70b1a407 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
404507
@@ -173,6 +173,7 @@
404507
   <flag name='chardev-reconnect'/>
404507
   <flag name='virtio-gpu.max_outputs'/>
404507
   <flag name='virtio-blk.num-queues'/>
404507
+  <flag name='spapr-vty'/>
404507
   <flag name='disk-share-rw'/>
404507
   <version>2009000</version>
404507
   <kvmVersion>0</kvmVersion>
404507
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
404507
index 4e981c9fab..70c72e4e64 100644
404507
--- a/tests/qemuxml2argvtest.c
404507
+++ b/tests/qemuxml2argvtest.c
404507
@@ -1756,50 +1756,62 @@ mymain(void)
404507
     DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE);
404507
 
404507
     DO_TEST("pseries-basic",
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST("pseries-vio",
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST("pseries-usb-default",
404507
             QEMU_CAPS_NODEFCONFIG,
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_PIIX3_USB_UHCI,
404507
             QEMU_CAPS_PCI_OHCI,
404507
             QEMU_CAPS_PCI_MULTIFUNCTION);
404507
     DO_TEST("pseries-usb-multi",
404507
             QEMU_CAPS_NODEFCONFIG,
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_PIIX3_USB_UHCI,
404507
             QEMU_CAPS_PCI_OHCI,
404507
             QEMU_CAPS_PCI_MULTIFUNCTION);
404507
     DO_TEST("pseries-vio-user-assigned",
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST_PARSE_ERROR("pseries-vio-address-clash",
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM);
404507
     DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
404507
             QEMU_CAPS_DEVICE_USB_KBD,
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST("pseries-cpu-exact",
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST_PARSE_ERROR("pseries-no-parallel",
404507
             QEMU_CAPS_NODEFCONFIG);
404507
 
404507
     qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
404507
     DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM,
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST_FAILURE("pseries-cpu-compat-power9", QEMU_CAPS_KVM);
404507
 
404507
     qemuTestSetHostCPU(driver.caps, cpuPower9);
404507
     DO_TEST("pseries-cpu-compat-power9",
404507
             QEMU_CAPS_KVM,
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     qemuTestSetHostCPU(driver.caps, NULL);
404507
 
404507
     qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
404507
 
404507
     DO_TEST("pseries-panic-missing",
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST("pseries-panic-no-address",
404507
+            QEMU_CAPS_DEVICE_SPAPR_VTY,
404507
             QEMU_CAPS_NODEFCONFIG);
404507
     DO_TEST_FAILURE("pseries-panic-address",
404507
                     QEMU_CAPS_NODEFCONFIG);
404507
-- 
404507
2.15.1
404507