404507
From c77b3a25ee9f277359018a1b65ea73fefd9d4c4e Mon Sep 17 00:00:00 2001
404507
Message-Id: <c77b3a25ee9f277359018a1b65ea73fefd9d4c4e@dist-git>
404507
From: Pino Toscano <ptoscano@redhat.com>
404507
Date: Wed, 29 Nov 2017 16:22:53 +0100
404507
Subject: [PATCH] qemu: add QEMU_CAPS_DEVICE_SCLPLMCONSOLE
404507
404507
Add a separate capability for the sclplmconsole device, and check it
404507
specifically instead of using QEMU_CAPS_DEVICE_SCLPCONSOLE for that too.
404507
404507
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
404507
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
404507
(cherry picked from commit 593639ffffa43f52aae53038bc8bd75ec700b12f)
404507
404507
 Conflicts:
404507
	src/qemu/qemu_capabilities.c
404507
	src/qemu/qemu_capabilities.h
404507
	tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
404507
	tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
404507
404507
	Insert the new capability in the right place, both in the
404507
	declaration and in 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                          | 22 +++++++++++++++++++++-
404507
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml |  1 +
404507
 tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml  |  1 +
404507
 tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml  |  1 +
404507
 tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml  |  1 +
404507
 7 files changed, 28 insertions(+), 3 deletions(-)
404507
404507
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
404507
index 374a2e79a7..322e0423d6 100644
404507
--- a/src/qemu/qemu_capabilities.c
404507
+++ b/src/qemu/qemu_capabilities.c
404507
@@ -448,7 +448,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
404507
               "spapr-vty",
404507
 
404507
               /* 275 */
404507
-
404507
+              "sclplmconsole",
404507
 
404507
               "disk-share-rw",
404507
     );
404507
@@ -1680,6 +1680,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
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
+    { "sclplmconsole", QEMU_CAPS_DEVICE_SCLPLMCONSOLE },
404507
 };
404507
 
404507
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
404507
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
404507
index f115738b6b..c3a15948cf 100644
404507
--- a/src/qemu/qemu_capabilities.h
404507
+++ b/src/qemu/qemu_capabilities.h
404507
@@ -434,7 +434,7 @@ typedef enum {
404507
     QEMU_CAPS_DEVICE_SPAPR_VTY, /* -device spapr-vty */
404507
 
404507
     /* 275 */
404507
-
404507
+    QEMU_CAPS_DEVICE_SCLPLMCONSOLE, /* -device sclplmconsole */
404507
 
404507
     QEMU_CAPS_DISK_SHARE_RW, /* share-rw=on for concurrent disk access */
404507
 
404507
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
404507
index 092d820b1d..19a819a3aa 100644
404507
--- a/src/qemu/qemu_command.c
404507
+++ b/src/qemu/qemu_command.c
404507
@@ -9419,7 +9419,6 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManager,
404507
 
404507
         switch (console->targetType) {
404507
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP:
404507
-        case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM:
404507
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPCONSOLE)) {
404507
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
404507
                                _("sclpconsole is not supported in this QEMU binary"));
404507
@@ -9440,6 +9439,27 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManager,
404507
                 return -1;
404507
             break;
404507
 
404507
+        case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM:
404507
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPLMCONSOLE)) {
404507
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
404507
+                               _("sclplmconsole is not supported in this QEMU binary"));
404507
+                return -1;
404507
+            }
404507
+
404507
+            if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
404507
+                                                  console->source,
404507
+                                                  console->info.alias,
404507
+                                                  qemuCaps, true,
404507
+                                                  chardevStdioLogd)))
404507
+                return -1;
404507
+            virCommandAddArg(cmd, "-chardev");
404507
+            virCommandAddArg(cmd, devstr);
404507
+            VIR_FREE(devstr);
404507
+
404507
+            if (qemuBuildChrDeviceCommandLine(cmd, def, console, qemuCaps) < 0)
404507
+                return -1;
404507
+            break;
404507
+
404507
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
404507
             if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
404507
                                                   console->source,
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
404507
index a6900bf1ef..463c30c77a 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
404507
@@ -141,6 +141,7 @@
404507
   <flag name='virtio-gpu.max_outputs'/>
404507
   <flag name='vxhs'/>
404507
   <flag name='virtio-blk.num-queues'/>
404507
+  <flag name='sclplmconsole'/>
404507
   <flag name='disk-share-rw'/>
404507
   <version>2010000</version>
404507
   <kvmVersion>0</kvmVersion>
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
404507
index c5dfa2a9d0..c2f310cd46 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
404507
@@ -135,6 +135,7 @@
404507
   <flag name='chardev-reconnect'/>
404507
   <flag name='virtio-gpu.max_outputs'/>
404507
   <flag name='virtio-blk.num-queues'/>
404507
+  <flag name='sclplmconsole'/>
404507
   <version>2007000</version>
404507
   <kvmVersion>0</kvmVersion>
404507
   <package></package>
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
404507
index 6d26896ef9..f6e024dc61 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
404507
@@ -137,6 +137,7 @@
404507
   <flag name='chardev-reconnect'/>
404507
   <flag name='virtio-gpu.max_outputs'/>
404507
   <flag name='virtio-blk.num-queues'/>
404507
+  <flag name='sclplmconsole'/>
404507
   <version>2007093</version>
404507
   <kvmVersion>0</kvmVersion>
404507
   <package></package>
404507
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
404507
index 4150b8eee7..5c4a02c8b1 100644
404507
--- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
404507
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml
404507
@@ -138,6 +138,7 @@
404507
   <flag name='chardev-reconnect'/>
404507
   <flag name='virtio-gpu.max_outputs'/>
404507
   <flag name='virtio-blk.num-queues'/>
404507
+  <flag name='sclplmconsole'/>
404507
   <flag name='disk-share-rw'/>
404507
   <version>2009000</version>
404507
   <kvmVersion>0</kvmVersion>
404507
-- 
404507
2.15.1
404507