[10/17] qemu: command: drop QEMU_CAPS_DEVICE for serial/parallel cli

Message ID c63dcc5db9ca14ec4e4f1019c3189356abd99908.1453489952.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Jan. 22, 2016, 7:30 p.m.
-serial none and -parallel none are never required anymore, even
platforms that can't use -device abide -nodefaults.

Additionally we conditionalized the cli building on nparallels != 0,
but that was pointless.
---
 src/qemu/qemu_command.c | 50 ++++++++++++++++++++-----------------------------
 1 file changed, 20 insertions(+), 30 deletions(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson Jan. 22, 2016, 7:33 p.m. | #1
On 01/22/2016 02:30 PM, Cole Robinson wrote:
> -serial none and -parallel none are never required anymore, even

> platforms that can't use -device abide -nodefaults.

> 

> Additionally we conditionalized the cli building on nparallels != 0,

> but that was pointless.


Whitespace-less diff attached

- Cole
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 55c869e..e3c6a51 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10403,38 +10403,28 @@  qemuBuildCommandLine(virConnectPtr conn,
         actualSerials++;
     }
 
-    /* If we have -device, then we set -nodefault already */
-    if (!actualSerials && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
-            virCommandAddArgList(cmd, "-serial", "none", NULL);
-
-    if (!def->nparallels) {
-        /* If we have -device, then we set -nodefault already */
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
-            virCommandAddArgList(cmd, "-parallel", "none", NULL);
-    } else {
-        for (i = 0; i < def->nparallels; i++) {
-            virDomainChrDefPtr parallel = def->parallels[i];
-            char *devstr;
+    for (i = 0; i < def->nparallels; i++) {
+        virDomainChrDefPtr parallel = def->parallels[i];
+        char *devstr;
 
-            /* Use -chardev with -device if they are available */
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV)) {
-                virCommandAddArg(cmd, "-chardev");
-                if (!(devstr = qemuBuildChrChardevStr(&parallel->source,
-                                                      parallel->info.alias,
-                                                      qemuCaps)))
-                    goto error;
-                virCommandAddArg(cmd, devstr);
-                VIR_FREE(devstr);
+        /* Use -chardev with -device if they are available */
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV)) {
+            virCommandAddArg(cmd, "-chardev");
+            if (!(devstr = qemuBuildChrChardevStr(&parallel->source,
+                                                  parallel->info.alias,
+                                                  qemuCaps)))
+                goto error;
+            virCommandAddArg(cmd, devstr);
+            VIR_FREE(devstr);
 
-                if (qemuBuildChrDeviceCommandLine(cmd, def, parallel, qemuCaps) < 0)
-                    goto error;
-            } else {
-                virCommandAddArg(cmd, "-parallel");
-                if (!(devstr = qemuBuildChrArgStr(&parallel->source, NULL)))
-                    goto error;
-                virCommandAddArg(cmd, devstr);
-                VIR_FREE(devstr);
-            }
+            if (qemuBuildChrDeviceCommandLine(cmd, def, parallel, qemuCaps) < 0)
+                goto error;
+        } else {
+            virCommandAddArg(cmd, "-parallel");
+            if (!(devstr = qemuBuildChrArgStr(&parallel->source, NULL)))
+                goto error;
+            virCommandAddArg(cmd, devstr);
+            VIR_FREE(devstr);
         }
     }