From 04ada155e4e1a193f896d2dce802994756af8e36c3702f30fa21efe87883d23a Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Fri, 8 Oct 2021 20:49:54 +0000 Subject: [PATCH] - lxc: controller: Fix container launch on cgroup v1 1b9ce05c-lxc-fix-cgroupV1.patch boo#1183247 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=907 --- 1b9ce05c-lxc-fix-cgroupV1.patch | 57 +++++++++++++++++++++++++++++++++ libvirt.changes | 7 ++++ libvirt.spec | 1 + 3 files changed, 65 insertions(+) create mode 100644 1b9ce05c-lxc-fix-cgroupV1.patch diff --git a/1b9ce05c-lxc-fix-cgroupV1.patch b/1b9ce05c-lxc-fix-cgroupV1.patch new file mode 100644 index 0000000..97cb604 --- /dev/null +++ b/1b9ce05c-lxc-fix-cgroupV1.patch @@ -0,0 +1,57 @@ +commit 1b9ce05ce241a581d4e80228c92ceb0266f21f94 +Author: Cole Robinson +Date: Tue Oct 5 09:42:12 2021 -0400 + + lxc: controller: Fix container launch on cgroup v1 + + With cgroup v1 I'm seeing LXC container startup failures: + + $ sudo virt-install --connect lxc:/// --name test-container --memory 128 + --boot init=/bin/sh + + Starting install... + ERROR error from service: + GDBus.Error:org.freedesktop.machine1.NoMachineForPID: PID 2145047 does + not belong to any known machine + + libvirt 7.0.0 works but 7.1.0+ does not. The root error seems to predate + that, showing up in syslog, but commit 9c1693eff made it fatal: + + commit 9c1693eff427661616ce1bd2795688f87288a412 + Author: Pavel Hrdina + Date: Fri Feb 5 16:17:35 2021 +0100 + + vircgroup: use DBus call to systemd for some APIs + + The error comes from virSystemdGetMachineByPID. The PID that shows up in + the above error message does not match the leader PID as reported by + machinectl. + + This change fixes the error. Things seem to continue to work with + cgroupsv2 after this change. + + https://gitlab.com/libvirt/libvirt/-/issues/182 + + Tested-by: Jim Fehlig + Reviewed-by: Michal Privoznik + Signed-off-by: Cole Robinson + +Index: libvirt-7.8.0/src/lxc/lxc_controller.c +=================================================================== +--- libvirt-7.8.0.orig/src/lxc/lxc_controller.c ++++ libvirt-7.8.0/src/lxc/lxc_controller.c +@@ -865,12 +865,12 @@ static int virLXCControllerSetupCgroupLi + nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1); + + if (!(ctrl->cgroup = virLXCCgroupCreate(ctrl->def, +- ctrl->initpid, ++ getpid(), + ctrl->nnicindexes, + ctrl->nicindexes))) + goto cleanup; + +- if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0) ++ if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->initpid) < 0) + goto cleanup; + + /* Add all qemu-nbd tasks to the cgroup */ diff --git a/libvirt.changes b/libvirt.changes index faaaa23..ccc18e2 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 8 20:47:47 UTC 2021 - James Fehlig + +- lxc: controller: Fix container launch on cgroup v1 + 1b9ce05c-lxc-fix-cgroupV1.patch + boo#1183247 + ------------------------------------------------------------------- Thu Oct 7 04:14:22 UTC 2021 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index ebee90e..5a16c46 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -286,6 +286,7 @@ Source99: baselibs.conf Source100: %{name}-rpmlintrc # Upstream patches Patch0: 3f9c1a4b-fix-host-validate-sev.patch +Patch1: 1b9ce05c-lxc-fix-cgroupV1.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch