]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Convert QEMU driver to use virCgroupNewMachine
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 22 Jul 2013 15:44:52 +0000 (16:44 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 25 Jul 2013 10:42:47 +0000 (11:42 +0100)
Convert the QEMU driver code to use the new atomic API
for setup of cgroups

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_cgroup.c

index 11c9d29f507469646120b4a48f800f8ed1913aae..bca86303233edb326ec29ed43f61b32f763e065f 100644 (file)
@@ -633,7 +633,6 @@ qemuInitCgroup(virQEMUDriverPtr driver,
 {
     int ret = -1;
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    virCgroupPtr parent = NULL;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     if (!cfg->privileged)
@@ -664,32 +663,26 @@ qemuInitCgroup(virQEMUDriverPtr driver,
                        vm->def->resource->partition);
         goto cleanup;
     }
-    /* We only auto-create the default partition. In other
-     * cases we expect the sysadmin/app to have done so */
-    if (virCgroupNewPartition(vm->def->resource->partition,
-                              STREQ(vm->def->resource->partition, "/machine"),
-                              cfg->cgroupControllers,
-                              &parent) < 0) {
+
+    if (virCgroupNewMachine(vm->def->name,
+                            "qemu",
+                            cfg->privileged,
+                            vm->def->uuid,
+                            NULL,
+                            vm->pid,
+                            false,
+                            vm->def->resource->partition,
+                            cfg->cgroupControllers,
+                            &priv->cgroup) < 0) {
         if (virCgroupNewIgnoreError())
             goto done;
 
         goto cleanup;
     }
 
-    if (virCgroupNewDomainPartition(parent,
-                                    "qemu",
-                                    vm->def->name,
-                                    true,
-                                    &priv->cgroup) < 0)
-        goto cleanup;
-
-    if (virCgroupAddTask(priv->cgroup, vm->pid) < 0)
-        goto cleanup;
-
 done:
     ret = 0;
 cleanup:
-    virCgroupFree(&parent);
     virObjectUnref(cfg);
     return ret;
 }