mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
vircgroup: rework virCgroupNewSelf
With the introduction of `libvirt` sub-directory to the cgroup topology some of the cgroup configuration was moved into that sub-directory together with the VM processes. LXC uses virCgroupNewSelf() in the container process to detect cgroups in order to report various data from cgroups inside the container. We need to properly detect the new `libvirt` sub-directory here otherwise LXC will report incorrect data. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
76ff847386
commit
33178b9e52
@ -1024,7 +1024,20 @@ virCgroupNewNested(virCgroup *parent,
|
|||||||
int
|
int
|
||||||
virCgroupNewSelf(virCgroup **group)
|
virCgroupNewSelf(virCgroup **group)
|
||||||
{
|
{
|
||||||
return virCgroupNewDetect(-1, -1, group);
|
g_autoptr(virCgroup) newGroup = NULL;
|
||||||
|
g_autoptr(virCgroup) nested = NULL;
|
||||||
|
|
||||||
|
if (virCgroupNewDetect(-1, -1, &newGroup) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virCgroupNewNested(newGroup, -1, false, -1, &nested) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virCgroupExists(nested))
|
||||||
|
newGroup->nested = g_steal_pointer(&nested);
|
||||||
|
|
||||||
|
*group = g_steal_pointer(&newGroup);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1019,7 +1019,9 @@ mymain(void)
|
|||||||
DETECT_MOUNTS("cgroups1");
|
DETECT_MOUNTS("cgroups1");
|
||||||
DETECT_MOUNTS("cgroups2");
|
DETECT_MOUNTS("cgroups2");
|
||||||
DETECT_MOUNTS("cgroups3");
|
DETECT_MOUNTS("cgroups3");
|
||||||
|
fakerootdir = initFakeFS(NULL, "all-in-one");
|
||||||
DETECT_MOUNTS("all-in-one");
|
DETECT_MOUNTS("all-in-one");
|
||||||
|
cleanupFakeFS(fakerootdir);
|
||||||
DETECT_MOUNTS_FAIL("no-cgroups");
|
DETECT_MOUNTS_FAIL("no-cgroups");
|
||||||
DETECT_MOUNTS("kubevirt");
|
DETECT_MOUNTS("kubevirt");
|
||||||
fakerootdir = initFakeFS("unified", NULL);
|
fakerootdir = initFakeFS("unified", NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user