[PATCH v2 07/10] qemu: Introduce qemuBuildNumaCommandLine

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

 



Add new function to manage adding the '-numa' options to the command
line removing that task from the mainline qemuBuildCommandLine

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

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3449dea..27952e5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5523,6 +5523,44 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
 
 
 static int
+qemuBuildNumaCommandLine(virCommandPtr cmd,
+                         virQEMUDriverConfigPtr cfg,
+                         virDomainDefPtr def,
+                         virQEMUCapsPtr qemuCaps,
+                         virBitmapPtr nodeset)
+{
+    size_t i;
+
+    if (virDomainNumaGetNodeCount(def->numa) &&
+        qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0)
+        return -1;
+
+    /* memory hotplug requires NUMA to be enabled - we already checked
+     * that memory devices are present only when NUMA is */
+    for (i = 0; i < def->nmems; i++) {
+        char *backStr;
+        char *dimmStr;
+
+        if (!(backStr = qemuBuildMemoryDimmBackendStr(def->mems[i], def,
+                                                      qemuCaps, cfg)))
+            return -1;
+
+        if (!(dimmStr = qemuBuildMemoryDeviceStr(def->mems[i]))) {
+            VIR_FREE(backStr);
+            return -1;
+        }
+
+        virCommandAddArgList(cmd, "-object", backStr, "-device", dimmStr, NULL);
+
+        VIR_FREE(backStr);
+        VIR_FREE(dimmStr);
+    }
+
+    return 0;
+}
+
+
+static int
 qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
                                 virCommandPtr cmd,
                                 virDomainDefPtr def,
@@ -6930,32 +6968,8 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (qemuBuildIOThreadCommandLine(cmd, def, qemuCaps) < 0)
         goto error;
 
-    if (virDomainNumaGetNodeCount(def->numa) &&
-        qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0)
-            goto error;
-
-    /* memory hotplug requires NUMA to be enabled - we already checked
-     * that memory devices are present only when NUMA is */
-
-
-    for (i = 0; i < def->nmems; i++) {
-        char *backStr;
-        char *dimmStr;
-
-        if (!(backStr = qemuBuildMemoryDimmBackendStr(def->mems[i], def,
-                                                      qemuCaps, cfg)))
-            goto error;
-
-        if (!(dimmStr = qemuBuildMemoryDeviceStr(def->mems[i]))) {
-            VIR_FREE(backStr);
-            goto error;
-        }
-
-        virCommandAddArgList(cmd, "-object", backStr, "-device", dimmStr, NULL);
-
-        VIR_FREE(backStr);
-        VIR_FREE(dimmStr);
-    }
+    if (qemuBuildNumaCommandLine(cmd, cfg, def, qemuCaps, nodeset) < 0)
+        goto error;
 
     virCommandAddArgList(cmd, "-uuid", uuid, NULL);
 
-- 
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]