File 1b9ce05c-lxc-fix-cgroupV1.patch of Package libvirt
xxxxxxxxxx
1
commit 1b9ce05ce241a581d4e80228c92ceb0266f21f94
2
Author: Cole Robinson <crobinso@redhat.com>
3
Date: Tue Oct 5 09:42:12 2021 -0400
4
5
lxc: controller: Fix container launch on cgroup v1
6
7
With cgroup v1 I'm seeing LXC container startup failures:
8
9
$ sudo virt-install --connect lxc:/// --name test-container --memory 128
10
--boot init=/bin/sh
11
12
Starting install...
13
ERROR error from service:
14
GDBus.Error:org.freedesktop.machine1.NoMachineForPID: PID 2145047 does
15
not belong to any known machine
16
17
libvirt 7.0.0 works but 7.1.0+ does not. The root error seems to predate
18
that, showing up in syslog, but commit 9c1693eff made it fatal:
19
20
commit 9c1693eff427661616ce1bd2795688f87288a412
21
Author: Pavel Hrdina <phrdina@redhat.com>
22
Date: Fri Feb 5 16:17:35 2021 +0100
23
24
vircgroup: use DBus call to systemd for some APIs
25
26
The error comes from virSystemdGetMachineByPID. The PID that shows up in
27
the above error message does not match the leader PID as reported by
28
machinectl.
29
30
This change fixes the error. Things seem to continue to work with
31
cgroupsv2 after this change.
32
33
https://gitlab.com/libvirt/libvirt/-/issues/182
34
35
Tested-by: Jim Fehlig <jfehlig@suse.com>
36
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
37
Signed-off-by: Cole Robinson <crobinso@redhat.com>
38
39
Index: libvirt-7.1.0/src/lxc/lxc_controller.c
40
===================================================================
41
--- libvirt-7.1.0.orig/src/lxc/lxc_controller.c
42
+++ libvirt-7.1.0/src/lxc/lxc_controller.c
43
44
nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
45
46
if (!(ctrl->cgroup = virLXCCgroupCreate(ctrl->def,
47
- ctrl->initpid,
48
+ getpid(),
49
ctrl->nnicindexes,
50
ctrl->nicindexes)))
51
goto cleanup;
52
53
- if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0)
54
+ if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->initpid) < 0)
55
goto cleanup;
56
57
/* Add all qemu-nbd tasks to the cgroup */
58