[PATCH 12/25] qemu: Introduce qemuBuildParallelsCommandLine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add new function to manage adding the parallels device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 77 +++++++++++++++++++++++++++++--------------------
 1 file changed, 46 insertions(+), 31 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 44fefc3..f161c4f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7622,6 +7622,50 @@ qemuBuildSerialCommandLine(virCommandPtr cmd,
 
 
 static int
+qemuBuildParallelsCommandLine(virCommandPtr cmd,
+                              const virDomainDef *def,
+                              virQEMUCapsPtr qemuCaps)
+{
+    size_t i;
+
+    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;
+
+            /* Use -chardev with -device if they are available */
+            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) &&
+                virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+                virCommandAddArg(cmd, "-chardev");
+                if (!(devstr = qemuBuildChrChardevStr(&parallel->source,
+                                                      parallel->info.alias,
+                                                      qemuCaps)))
+                    return -1;
+                virCommandAddArg(cmd, devstr);
+                VIR_FREE(devstr);
+
+                if (qemuBuildChrDeviceCommandLine(cmd, def, parallel,
+                                                  qemuCaps) < 0)
+                    return -1;
+            } else {
+                virCommandAddArg(cmd, "-parallel");
+                if (!(devstr = qemuBuildChrArgStr(&parallel->source, NULL)))
+                    return -1;
+                virCommandAddArg(cmd, devstr);
+                VIR_FREE(devstr);
+            }
+        }
+    }
+
+    return 0;
+}
+
+
+static int
 qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
                                  virDomainDefPtr def,
                                  virQEMUCapsPtr qemuCaps)
@@ -8174,37 +8218,8 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (qemuBuildSerialCommandLine(cmd, def, qemuCaps) < 0)
         goto error;
 
-    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;
-
-            /* Use -chardev with -device if they are available */
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) &&
-                virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-                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 (qemuBuildParallelsCommandLine(cmd, def, qemuCaps) < 0)
+        goto error;
 
     for (i = 0; i < def->nchannels; i++) {
         virDomainChrDefPtr channel = def->channels[i];
-- 
2.5.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]