mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Revert "cgroup/LXC: Do not condition availability of v2 by controllers"
This reverts commite49313b54e
. This reverts commita0f37232b9
. Revert them together to not break build. This fix of the issue is incorrect and breaks usage of other controllers in hybrid mode that systemd creates, specifically usage of devices and cpuacct controllers as they are now assumed to be part of the cgroup v2 topology which is not true. We need to find different solution to the issue. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
122064d449
commit
76c6e91402
@ -2921,12 +2921,10 @@ int
|
|||||||
virCgroupBindMount(virCgroup *group, const char *oldroot,
|
virCgroupBindMount(virCgroup *group, const char *oldroot,
|
||||||
const char *mountopts)
|
const char *mountopts)
|
||||||
{
|
{
|
||||||
ssize_t i;
|
size_t i;
|
||||||
virCgroup *parent = virCgroupGetNested(group);
|
virCgroup *parent = virCgroupGetNested(group);
|
||||||
|
|
||||||
/* In hybrid environments, V2 may be mounted over V1.
|
for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
|
||||||
* Mount the backends in reverse order. */
|
|
||||||
for (i = VIR_CGROUP_BACKEND_TYPE_LAST - 1; i >= 0; i--) {
|
|
||||||
if (parent->backends[i] &&
|
if (parent->backends[i] &&
|
||||||
parent->backends[i]->bindMount(parent, oldroot, mountopts) < 0) {
|
parent->backends[i]->bindMount(parent, oldroot, mountopts) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -69,13 +69,28 @@ virCgroupV2Available(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (getmntent_r(mounts, &entry, buf, sizeof(buf)) != NULL) {
|
while (getmntent_r(mounts, &entry, buf, sizeof(buf)) != NULL) {
|
||||||
|
g_autofree char *contFile = NULL;
|
||||||
|
g_autofree char *contStr = NULL;
|
||||||
|
|
||||||
if (STRNEQ(entry.mnt_type, "cgroup2"))
|
if (STRNEQ(entry.mnt_type, "cgroup2"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* Systemd uses cgroup v2 for process tracking but no controller is
|
||||||
|
* available. We should consider this configuration as cgroup v2 is
|
||||||
|
* not available. */
|
||||||
|
contFile = g_strdup_printf("%s/cgroup.controllers", entry.mnt_dir);
|
||||||
|
|
||||||
|
if (virFileReadAll(contFile, 1024 * 1024, &contStr) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (STREQ(contStr, ""))
|
||||||
|
continue;
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
VIR_FORCE_FCLOSE(mounts);
|
VIR_FORCE_FCLOSE(mounts);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user