mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
vircgroup: Use virCgroupMountOptsMatchController in virCgroupDetectPlacement
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
6d5b91f0f5
commit
801d95d259
@ -598,42 +598,27 @@ virCgroupDetectPlacement(virCgroupPtr group,
|
|||||||
|
|
||||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
||||||
const char *typestr = virCgroupControllerTypeToString(i);
|
const char *typestr = virCgroupControllerTypeToString(i);
|
||||||
int typelen = strlen(typestr);
|
|
||||||
char *tmp = controllers;
|
|
||||||
|
|
||||||
while (tmp) {
|
|
||||||
char *next = strchr(tmp, ',');
|
|
||||||
int len;
|
|
||||||
if (next) {
|
|
||||||
len = next - tmp;
|
|
||||||
next++;
|
|
||||||
} else {
|
|
||||||
len = strlen(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (virCgroupMountOptsMatchController(controllers, typestr) &&
|
||||||
|
group->controllers[i].mountPoint != NULL &&
|
||||||
|
group->controllers[i].placement == NULL) {
|
||||||
/*
|
/*
|
||||||
* selfpath == "/" + path="" -> "/"
|
* selfpath == "/" + path="" -> "/"
|
||||||
* selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"
|
* selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"
|
||||||
* selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
|
* selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
|
||||||
*/
|
*/
|
||||||
if (typelen == len && STREQLEN(typestr, tmp, len) &&
|
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
|
||||||
group->controllers[i].mountPoint != NULL &&
|
if (VIR_STRDUP(group->controllers[i].placement,
|
||||||
group->controllers[i].placement == NULL) {
|
selfpath) < 0)
|
||||||
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
|
goto cleanup;
|
||||||
if (VIR_STRDUP(group->controllers[i].placement,
|
} else {
|
||||||
selfpath) < 0)
|
if (virAsprintf(&group->controllers[i].placement,
|
||||||
goto cleanup;
|
"%s%s%s", selfpath,
|
||||||
} else {
|
(STREQ(selfpath, "/") ||
|
||||||
if (virAsprintf(&group->controllers[i].placement,
|
STREQ(path, "") ? "" : "/"),
|
||||||
"%s%s%s", selfpath,
|
path) < 0)
|
||||||
(STREQ(selfpath, "/") ||
|
goto cleanup;
|
||||||
STREQ(path, "") ? "" : "/"),
|
|
||||||
path) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user