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,27 +598,15 @@ virCgroupDetectPlacement(virCgroupPtr group,
|
||||
|
||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; 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 == "/libvirt.service" + path == "" -> "/libvirt.service"
|
||||
* selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
|
||||
*/
|
||||
if (typelen == len && STREQLEN(typestr, tmp, len) &&
|
||||
group->controllers[i].mountPoint != NULL &&
|
||||
group->controllers[i].placement == NULL) {
|
||||
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
|
||||
if (VIR_STRDUP(group->controllers[i].placement,
|
||||
selfpath) < 0)
|
||||
@ -632,9 +620,6 @@ virCgroupDetectPlacement(virCgroupPtr group,
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
tmp = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user