[PATCH] Revert "lxc: controller: Fix container launch on cgroup v1"

Michal Privoznik posted 1 patch 2 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/06d6a324c4620c19cacfaeef52c0b6dff84b74a2.1639140523.git.mprivozn@redhat.com
src/lxc/lxc_controller.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] Revert "lxc: controller: Fix container launch on cgroup v1"
Posted by Michal Privoznik 2 years, 3 months ago
Unfortunately, this fix breakes machinectl in a very nasty way,
for instance 'machinectl shell' drops into the host shell. It's
worse than being unable to start a container with CGroupsV1.

Revert until a proper fix is figured out.

This reverts commit 1b9ce05ce241a581d4e80228c92ceb0266f21f94.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/lxc/lxc_controller.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 039efcd7c7..7c593ee3a9 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -865,12 +865,12 @@ static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
     nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
 
     if (!(ctrl->cgroup = virLXCCgroupCreate(ctrl->def,
-                                            getpid(),
+                                            ctrl->initpid,
                                             ctrl->nnicindexes,
                                             ctrl->nicindexes)))
         goto cleanup;
 
-    if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->initpid) < 0)
+    if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0)
         goto cleanup;
 
     /* Add all qemu-nbd tasks to the cgroup */
-- 
2.32.0

Re: [PATCH] Revert "lxc: controller: Fix container launch on cgroup v1"
Posted by Pavel Hrdina 2 years, 3 months ago
On Fri, Dec 10, 2021 at 01:48:43PM +0100, Michal Privoznik wrote:
> Unfortunately, this fix breakes machinectl in a very nasty way,
> for instance 'machinectl shell' drops into the host shell. It's
> worse than being unable to start a container with CGroupsV1.
> 
> Revert until a proper fix is figured out.
> 
> This reverts commit 1b9ce05ce241a581d4e80228c92ceb0266f21f94.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/lxc/lxc_controller.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>