6bf708
From 118598c04ba4dc1128ca475199551b6645c83736 Mon Sep 17 00:00:00 2001
6bf708
Message-Id: <118598c04ba4dc1128ca475199551b6645c83736@dist-git>
6bf708
From: Martin Kletzander <mkletzan@redhat.com>
6bf708
Date: Mon, 1 Sep 2014 14:02:22 +0200
6bf708
Subject: [PATCH] qemu: split out cpuset.mems setting
6bf708
6bf708
https://bugzilla.redhat.com/show_bug.cgi?id=1135871
6bf708
6bf708
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6bf708
(cherry picked from commit aa668fccf078bf9833047776549a5a06435cf470)
6bf708
6bf708
Conflicts:
6bf708
	src/qemu/qemu_cgroup.c -- whitespace before 'cleanup:'
6bf708
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6bf708
---
6bf708
 src/qemu/qemu_cgroup.c | 29 ++++++++++++++++++++++++-----
6bf708
 1 file changed, 24 insertions(+), 5 deletions(-)
6bf708
6bf708
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
6bf708
index e0e1041..7e60c19 100644
6bf708
--- a/src/qemu/qemu_cgroup.c
6bf708
+++ b/src/qemu/qemu_cgroup.c
6bf708
@@ -542,13 +542,11 @@ cleanup:
6bf708
 
6bf708
 
6bf708
 static int
6bf708
-qemuSetupCpusetCgroup(virDomainObjPtr vm,
6bf708
-                      virBitmapPtr nodemask,
6bf708
-                      virCapsPtr caps)
6bf708
+qemuSetupCpusetMems(virDomainObjPtr vm,
6bf708
+                    virBitmapPtr nodemask)
6bf708
 {
6bf708
     qemuDomainObjPrivatePtr priv = vm->privateData;
6bf708
     char *mem_mask = NULL;
6bf708
-    char *cpu_mask = NULL;
6bf708
     int ret = -1;
6bf708
 
6bf708
     if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
6bf708
@@ -575,6 +573,28 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
6bf708
             goto cleanup;
6bf708
     }
6bf708
 
6bf708
+    ret = 0;
6bf708
+ cleanup:
6bf708
+    VIR_FREE(mem_mask);
6bf708
+    return ret;
6bf708
+}
6bf708
+
6bf708
+
6bf708
+static int
6bf708
+qemuSetupCpusetCgroup(virDomainObjPtr vm,
6bf708
+                      virBitmapPtr nodemask,
6bf708
+                      virCapsPtr caps)
6bf708
+{
6bf708
+    qemuDomainObjPrivatePtr priv = vm->privateData;
6bf708
+    char *cpu_mask = NULL;
6bf708
+    int ret = -1;
6bf708
+
6bf708
+    if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
6bf708
+        return 0;
6bf708
+
6bf708
+    if (qemuSetupCpusetMems(vm, nodemask) < 0)
6bf708
+        goto cleanup;
6bf708
+
6bf708
     if (vm->def->cpumask ||
6bf708
         (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) {
6bf708
 
6bf708
@@ -600,7 +620,6 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
6bf708
 
6bf708
     ret = 0;
6bf708
 cleanup:
6bf708
-    VIR_FREE(mem_mask);
6bf708
     VIR_FREE(cpu_mask);
6bf708
     return ret;
6bf708
 }
6bf708
-- 
6bf708
2.1.0
6bf708