[PATCH v1 rebase 3/6] create cgroup controllers for domain according to config

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

 



Add a parameter to virCgroupForDomain to indicate which
cgroup controllers to create for domain. The value of the
parameter is read from user config.
---
 src/lxc/lxc_cgroup.c      |  2 +-
 src/lxc/lxc_driver.c      | 20 +++++++++---------
 src/lxc/lxc_process.c     |  4 ++--
 src/qemu/qemu_cgroup.c    | 10 ++++-----
 src/qemu/qemu_driver.c    | 53 ++++++++++++++++++++++++++++++-----------------
 src/qemu/qemu_hotplug.c   |  9 +++++---
 src/qemu/qemu_migration.c |  2 +-
 src/util/cgroup.c         |  9 ++++++--
 src/util/cgroup.h         |  3 ++-
 9 files changed, 68 insertions(+), 44 deletions(-)

diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 0af9dcc..59007da 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -378,7 +378,7 @@ int virLXCCgroupSetup(virDomainDefPtr def)
         goto cleanup;
     }
 
-    rc = virCgroupForDomain(driver, def->name, &cgroup, 1);
+    rc = virCgroupForDomain(driver, def->name, &cgroup, 1, ~0);
     if (rc != 0) {
         virReportSystemError(-rc,
                              _("Unable to create cgroup for domain %s"),
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3f5aa80..0530af2 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -544,7 +544,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
         info->cpuTime = 0;
         info->memory = vm->def->mem.cur_balloon;
     } else {
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to get cgroup for %s"), vm->def->name);
             goto cleanup;
@@ -737,7 +737,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
         goto cleanup;
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to get cgroup for %s"), vm->def->name);
         goto cleanup;
@@ -794,7 +794,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("cannot find cgroup for domain %s"), vm->def->name);
         goto cleanup;
@@ -871,7 +871,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to get cgroup for %s"), vm->def->name);
         goto cleanup;
@@ -1795,7 +1795,7 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,
                            "%s", _("cgroup CPU controller is not mounted"));
             goto cleanup;
         }
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0, ~0) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"),
                            vm->def->name);
@@ -1939,7 +1939,7 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0, ~0) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("cannot find cgroup for domain %s"), vm->def->name);
         goto cleanup;
@@ -2044,7 +2044,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0, ~0) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"), vm->def->name);
             goto cleanup;
@@ -2149,7 +2149,7 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0, ~0) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"), vm->def->name);
             goto cleanup;
@@ -2383,7 +2383,7 @@ static int lxcFreezeContainer(virLXCDriverPtr driver, virDomainObjPtr vm)
     virCgroupPtr cgroup = NULL;
 
     if (!(driver->cgroup &&
-          virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) == 0))
+          virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) == 0))
         return -1;
 
     /* From here on, we know that cgroup != NULL.  */
@@ -2521,7 +2521,7 @@ static int lxcUnfreezeContainer(virLXCDriverPtr driver, virDomainObjPtr vm)
     virCgroupPtr cgroup = NULL;
 
     if (!(driver->cgroup &&
-        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) == 0))
+        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) == 0))
         return -1;
 
     ret = virCgroupSetFreezerState(cgroup, "THAWED");
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 3e7fcb8..383ca41 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -272,7 +272,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
     virDomainConfVMNWFilterTeardown(vm);
 
     if (driver->cgroup &&
-        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) == 0) {
+        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, ~0) == 0) {
         virCgroupRemove(cgroup);
         virCgroupFree(&cgroup);
     }
@@ -720,7 +720,7 @@ int virLXCProcessStop(virLXCDriverPtr driver,
         VIR_FREE(vm->def->seclabels[0]->imagelabel);
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) == 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0, ~0) == 0) {
         rc = virCgroupKillPainfully(group);
         if (rc < 0) {
             virReportSystemError(-rc, "%s",
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 30cd1d6..b868269 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -203,7 +203,7 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
     if (driver->cgroup == NULL)
         return 0; /* Not supported, so claim success */
 
-    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 1);
+    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 1, driver->cgroupControllers);
     if (rc != 0) {
         virReportSystemError(-rc,
                              _("Unable to create cgroup for %s"),
@@ -558,7 +558,7 @@ int qemuSetupCgroupForVcpu(virQEMUDriverPtr driver, virDomainObjPtr vm)
     if (driver->cgroup == NULL)
         return 0;
 
-    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0);
+    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, driver->cgroupControllers);
     if (rc != 0) {
         virReportSystemError(-rc,
                              _("Unable to find cgroup for %s"),
@@ -661,7 +661,7 @@ int qemuSetupCgroupForEmulator(virQEMUDriverPtr driver,
     if (driver->cgroup == NULL)
         return 0; /* Not supported, so claim success */
 
-    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0);
+    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, driver->cgroupControllers);
     if (rc != 0) {
         virReportSystemError(-rc,
                              _("Unable to find cgroup for %s"),
@@ -748,7 +748,7 @@ int qemuRemoveCgroup(virQEMUDriverPtr driver,
     if (driver->cgroup == NULL)
         return 0; /* Not supported, so claim success */
 
-    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0);
+    rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0, driver->cgroupControllers);
     if (rc != 0) {
         if (!quiet)
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -772,7 +772,7 @@ int qemuAddToCgroup(virQEMUDriverPtr driver,
     if (driver->cgroup == NULL)
         return 0; /* Not supported, so claim success */
 
-    rc = virCgroupForDomain(driver->cgroup, def->name, &cgroup, 0);
+    rc = virCgroupForDomain(driver->cgroup, def->name, &cgroup, 0, driver->cgroupControllers);
     if (rc != 0) {
         virReportSystemError(-rc,
                              _("unable to find cgroup for domain %s"),
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d155ea7..2b915ff 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3822,7 +3822,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
     }
 
     cgroup_available = (virCgroupForDomain(driver->cgroup, vm->def->name,
-                                           &cgroup, 0) == 0);
+                                           &cgroup, 0, driver->cgroupControllers) == 0);
 
     if (nvcpus > oldvcpus) {
         for (i = oldvcpus; i < nvcpus; i++) {
@@ -4148,7 +4148,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
 
         /* Configure the corresponding cpuset cgroup before set affinity. */
         if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPUSET)) {
-            if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup_dom, 0) == 0 &&
+            if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup_dom, 0,
+                                   driver->cgroupControllers) == 0 &&
                 virCgroupForVcpu(cgroup_dom, vcpu, &cgroup_vcpu, 0) == 0 &&
                 qemuSetupCgroupVcpuPin(cgroup_vcpu, newVcpuPin, newVcpuPinNum, vcpu) < 0) {
                 virReportError(VIR_ERR_OPERATION_INVALID,
@@ -4413,7 +4414,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
                  * If no cgroup for domain or hypervisor exists, do nothing.
                  */
                 if (virCgroupForDomain(driver->cgroup, vm->def->name,
-                                       &cgroup_dom, 0) == 0) {
+                                       &cgroup_dom, 0, driver->cgroupControllers) == 0) {
                     if (virCgroupForEmulator(cgroup_dom, &cgroup_emulator, 0) == 0) {
                         if (qemuSetupCgroupEmulatorPin(cgroup_emulator,
                                                        newVcpuPin[0]->cpumask) < 0) {
@@ -5997,7 +5998,8 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
         goto end;
 
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0)) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                               driver->cgroupControllers)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to find cgroup for %s"),
                            vm->def->name);
@@ -6227,8 +6229,8 @@ qemuDomainChangeDiskMediaLive(virDomainObjPtr vm,
         goto end;
 
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
-        if (virCgroupForDomain(driver->cgroup,
-                               vm->def->name, &cgroup, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to find cgroup for %s"),
                            vm->def->name);
@@ -7092,7 +7094,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"),
                            vm->def->name);
@@ -7253,7 +7256,8 @@ qemuDomainGetBlkioParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"), vm->def->name);
             goto cleanup;
@@ -7442,7 +7446,8 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"), vm->def->name);
             goto cleanup;
@@ -7599,7 +7604,8 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"), vm->def->name);
             goto cleanup;
@@ -7761,7 +7767,8 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"),
                            vm->def->name);
@@ -7917,7 +7924,8 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
             goto cleanup;
         }
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"),
                            vm->def->name);
@@ -8122,7 +8130,8 @@ qemuSetSchedulerParametersFlags(virDomainPtr dom,
                            "%s", _("cgroup CPU controller is not mounted"));
             goto cleanup;
         }
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("cannot find cgroup for domain %s"),
                            vm->def->name);
@@ -8409,7 +8418,8 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                           driver->cgroupControllers) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("cannot find cgroup for domain %s"), vm->def->name);
         goto cleanup;
@@ -11275,7 +11285,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
     }
 
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES) &&
-        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0)) {
+        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                           driver->cgroupControllers)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to find cgroup for %s"),
                        vm->def->name);
@@ -13017,7 +13028,8 @@ qemuDomainBlockPivot(virConnectPtr conn,
      * we know for sure that there is a backing chain.  */
     if (disk->mirrorFormat && disk->mirrorFormat != VIR_STORAGE_FILE_RAW &&
         qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES) &&
-        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) < 0) {
+        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                           driver->cgroupControllers) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to find cgroup for %s"),
                        vm->def->name);
@@ -13330,7 +13342,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path,
         goto cleanup;
     }
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES) &&
-        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) < 0) {
+        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                           driver->cgroupControllers) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to find cgroup for %s"),
                        vm->def->name);
@@ -13614,7 +13627,8 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
      * operation succeeds, but doing that requires tracking the
      * operation in XML across libvirtd restarts.  */
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES) &&
-        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) < 0) {
+        virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                           driver->cgroupControllers) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to find cgroup for %s"),
                        vm->def->name);
@@ -14546,7 +14560,8 @@ qemuDomainGetCPUStats(virDomainPtr domain,
         goto cleanup;
     }
 
-    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
+    if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0,
+                           driver->cgroupControllers) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("cannot find cgroup for domain %s"), vm->def->name);
         goto cleanup;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3dfdb65..3584a47 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1097,7 +1097,8 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
         usbDevice *usb;
         qemuCgroupData data;
 
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to find cgroup for %s"),
                            vm->def->name);
@@ -1995,7 +1996,8 @@ int qemuDomainDetachPciDiskDevice(virQEMUDriverPtr driver,
     }
 
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to find cgroup for %s"),
                            vm->def->name);
@@ -2108,7 +2110,8 @@ int qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
     }
 
     if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
-        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
+        if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0,
+                               driver->cgroupControllers) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to find cgroup for %s"),
                            vm->def->name);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5dcbb07..12dc719 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3617,7 +3617,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
         if (qemuCgroupControllerActive(driver,
                                        VIR_CGROUP_CONTROLLER_DEVICES)) {
             if (virCgroupForDomain(driver->cgroup, vm->def->name,
-                                   &cgroup, 0) != 0) {
+                                   &cgroup, 0, driver->cgroupControllers) != 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("Unable to find cgroup for %s"),
                                vm->def->name);
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 37a5c08..f3e4185 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -1009,14 +1009,19 @@ int virCgroupGetAppRoot(virCgroupPtr *group)
 int virCgroupForDomain(virCgroupPtr driver,
                        const char *name,
                        virCgroupPtr *group,
-                       bool create)
+                       bool create,
+                       int controllers)
 {
+    unsigned flags = VIR_CGROUP_MEM_HIERACHY;
     int rc;
     char *path;
 
     if (driver == NULL)
         return -EINVAL;
 
+    if (!(controllers & (1UL << VIR_CGROUP_CONTROLLER_CPUSET)))
+        flags |= VIR_CGROUP_DISABLE_CPUSET;
+
     if (virAsprintf(&path, "%s/%s", driver->path, name) < 0)
         return -ENOMEM;
 
@@ -1034,7 +1039,7 @@ int virCgroupForDomain(virCgroupPtr driver,
          * a group for driver, is to avoid overhead to track
          * cumulative usage that we don't need.
          */
-        rc = virCgroupMakeGroup(driver, *group, create, VIR_CGROUP_MEM_HIERACHY);
+        rc = virCgroupMakeGroup(driver, *group, create, flags);
         if (rc != 0)
             virCgroupFree(group);
     }
diff --git a/src/util/cgroup.h b/src/util/cgroup.h
index 3e3be91..f632240 100644
--- a/src/util/cgroup.h
+++ b/src/util/cgroup.h
@@ -53,7 +53,8 @@ int virCgroupGetAppRoot(virCgroupPtr *group);
 int virCgroupForDomain(virCgroupPtr driver,
                        const char *name,
                        virCgroupPtr *group,
-                       bool create);
+                       bool create,
+                       int controllers);
 
 int virCgroupForVcpu(virCgroupPtr driver,
                      int vcpuid,
-- 
1.8.0.1.240.ge8a1f5a

--
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]