File aa668fcc-qemu-cpuset-mems-refactor.patch of Package libvirt.11695

commit aa668fccf078bf9833047776549a5a06435cf470
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Tue Jul 8 09:53:06 2014 +0200

    qemu: split out cpuset.mems setting
    
    Signed-off-by: Martin Kletzander <mkletzan@redhat.com>

Index: libvirt-1.2.5/src/qemu/qemu_cgroup.c
===================================================================
--- libvirt-1.2.5.orig/src/qemu/qemu_cgroup.c
+++ libvirt-1.2.5/src/qemu/qemu_cgroup.c
@@ -576,13 +576,11 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr
 
 
 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))
@@ -609,6 +607,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)) {
 
@@ -634,7 +654,6 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm
 
     ret = 0;
  cleanup:
-    VIR_FREE(mem_mask);
     VIR_FREE(cpu_mask);
     return ret;
 }