]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: cgroups do not implicitly add task to new machine cgroup
authorHenning Schild <henning.schild@siemens.com>
Wed, 9 Dec 2015 16:58:10 +0000 (17:58 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 14 Dec 2015 20:43:29 +0000 (15:43 -0500)
virCgroupNewMachine used to add the pidleader to the newly created
machine cgroup. Do not do this implicit anymore.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
src/lxc/lxc_cgroup.c
src/qemu/qemu_cgroup.c
src/util/vircgroup.c

index ad254e4934fca9a2b9c1d95aae83822030e98803..609e9eafd883092434edc39a5c80b29029ff7e00 100644 (file)
@@ -504,6 +504,17 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr def,
                             &cgroup) < 0)
         goto cleanup;
 
+    if (virCgroupAddTask(cgroup, initpid) < 0) {
+        virErrorPtr saved = virSaveLastError();
+        virCgroupRemove(cgroup);
+        virCgroupFree(&cgroup);
+        if (saved) {
+            virSetError(saved);
+            virFreeError(saved);
+        }
+        goto cleanup;
+    }
+
     /* setup control group permissions for user namespace */
     if (def->idmap.uidmap) {
         if (virCgroupSetOwner(cgroup,
index 8d88f9abb230bf3bf6578a396e8ad94eb9440522..5df5e4537d765de2b41e3739dda580e66d3a2e62 100644 (file)
@@ -789,6 +789,17 @@ qemuInitCgroup(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
+    if (virCgroupAddTask(priv->cgroup, vm->pid) < 0) {
+        virErrorPtr saved = virSaveLastError();
+        virCgroupRemove(priv->cgroup);
+        virCgroupFree(&priv->cgroup);
+        if (saved) {
+            virSetError(saved);
+            virFreeError(saved);
+        }
+        goto cleanup;
+    }
+
  done:
     ret = 0;
  cleanup:
index 0379c2e446cd614af020721a72bf8dd50d643ebf..a07f3c255be4f451061f1f2e673367a4852fc270 100644 (file)
@@ -1669,16 +1669,6 @@ virCgroupNewMachineSystemd(const char *name,
         }
     }
 
-    if (virCgroupAddTask(*group, pidleader) < 0) {
-        virErrorPtr saved = virSaveLastError();
-        virCgroupRemove(*group);
-        virCgroupFree(group);
-        if (saved) {
-            virSetError(saved);
-            virFreeError(saved);
-        }
-    }
-
     ret = 0;
  cleanup:
     virCgroupFree(&parent);
@@ -1701,7 +1691,6 @@ int virCgroupTerminateMachine(const char *name,
 static int
 virCgroupNewMachineManual(const char *name,
                           const char *drivername,
-                          pid_t pidleader,
                           const char *partition,
                           int controllers,
                           virCgroupPtr *group)
@@ -1727,16 +1716,6 @@ virCgroupNewMachineManual(const char *name,
                                     group) < 0)
         goto cleanup;
 
-    if (virCgroupAddTask(*group, pidleader) < 0) {
-        virErrorPtr saved = virSaveLastError();
-        virCgroupRemove(*group);
-        virCgroupFree(group);
-        if (saved) {
-            virSetError(saved);
-            virFreeError(saved);
-        }
-    }
-
  done:
     ret = 0;
 
@@ -1783,7 +1762,6 @@ virCgroupNewMachine(const char *name,
 
     return virCgroupNewMachineManual(name,
                                      drivername,
-                                     pidleader,
                                      partition,
                                      controllers,
                                      group);