Blob Blame History Raw
From 118598c04ba4dc1128ca475199551b6645c83736 Mon Sep 17 00:00:00 2001
Message-Id: <118598c04ba4dc1128ca475199551b6645c83736@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Mon, 1 Sep 2014 14:02:22 +0200
Subject: [PATCH] qemu: split out cpuset.mems setting

https://bugzilla.redhat.com/show_bug.cgi?id=1135871

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit aa668fccf078bf9833047776549a5a06435cf470)

Conflicts:
	src/qemu/qemu_cgroup.c -- whitespace before 'cleanup:'
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_cgroup.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index e0e1041..7e60c19 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -542,13 +542,11 @@ cleanup:
 
 
 static int
-qemuSetupCpusetCgroup(virDomainObjPtr vm,
-                      virBitmapPtr nodemask,
-                      virCapsPtr caps)
+qemuSetupCpusetMems(virDomainObjPtr vm,
+                    virBitmapPtr nodemask)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *mem_mask = NULL;
-    char *cpu_mask = NULL;
     int ret = -1;
 
     if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
@@ -575,6 +573,28 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
             goto cleanup;
     }
 
+    ret = 0;
+ cleanup:
+    VIR_FREE(mem_mask);
+    return ret;
+}
+
+
+static int
+qemuSetupCpusetCgroup(virDomainObjPtr vm,
+                      virBitmapPtr nodemask,
+                      virCapsPtr caps)
+{
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    char *cpu_mask = NULL;
+    int ret = -1;
+
+    if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
+        return 0;
+
+    if (qemuSetupCpusetMems(vm, nodemask) < 0)
+        goto cleanup;
+
     if (vm->def->cpumask ||
         (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) {
 
@@ -600,7 +620,6 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
 
     ret = 0;
 cleanup:
-    VIR_FREE(mem_mask);
     VIR_FREE(cpu_mask);
     return ret;
 }
-- 
2.1.0