]> xenbits.xensource.com Git - libvirt.git/commitdiff
Avoid creating top level cgroups if just querying for existance
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 4 Mar 2010 11:01:52 +0000 (11:01 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 5 Mar 2010 15:00:58 +0000 (15:00 +0000)
When getting the driver/domain cgroup it is possible to specify
whether it should be auto created. If auto-creation was turned
off, libvirt still mistakenly created its own top level cgroup

* src/util/cgroup.c: Honour autocreate flag for top level cgroup

src/util/cgroup.c

index ad0d5955a42de6d3cedf0e9096f243d7da914fb1..b4c3353fb2674a3237988f967580a168d98bcf1f 100644 (file)
@@ -519,7 +519,8 @@ err:
 }
 
 static int virCgroupAppRoot(int privileged,
-                            virCgroupPtr *group)
+                            virCgroupPtr *group,
+                            int create)
 {
     virCgroupPtr rootgrp = NULL;
     int rc;
@@ -551,7 +552,7 @@ static int virCgroupAppRoot(int privileged,
     if (rc != 0)
         goto cleanup;
 
-    rc = virCgroupMakeGroup(rootgrp, *group, 1);
+    rc = virCgroupMakeGroup(rootgrp, *group, create);
 
 cleanup:
     virCgroupFree(&rootgrp);
@@ -638,7 +639,7 @@ int virCgroupForDriver(const char *name,
     char *path = NULL;
     virCgroupPtr rootgrp = NULL;
 
-    rc = virCgroupAppRoot(privileged, &rootgrp);
+    rc = virCgroupAppRoot(privileged, &rootgrp, create);
     if (rc != 0)
         goto out;