|
|
c480ed |
From dc8f41bf6bb689d86bc91d5aca7fb854a5ef847f Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <dc8f41bf6bb689d86bc91d5aca7fb854a5ef847f@dist-git>
|
|
|
c480ed |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Date: Mon, 1 Jul 2019 17:05:57 +0200
|
|
|
c480ed |
Subject: [PATCH] vircgroup: Use virCgroupMountOptsMatchController in
|
|
|
c480ed |
virCgroupDetectPlacement
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 801d95d2597572612c346508446320a33aebc50d)
|
|
|
c480ed |
|
|
|
c480ed |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Message-Id: <9c2bb230e14ced391b0731bc2964155960025aa5.1561993099.git.phrdina@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/util/vircgroup.c | 43 ++++++++++++++-----------------------------
|
|
|
c480ed |
1 file changed, 14 insertions(+), 29 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
|
|
c480ed |
index ec9994780a..7888dab716 100644
|
|
|
c480ed |
--- a/src/util/vircgroup.c
|
|
|
c480ed |
+++ b/src/util/vircgroup.c
|
|
|
c480ed |
@@ -598,42 +598,27 @@ virCgroupDetectPlacement(virCgroupPtr group,
|
|
|
c480ed |
|
|
|
c480ed |
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
|
|
c480ed |
const char *typestr = virCgroupControllerTypeToString(i);
|
|
|
c480ed |
- int typelen = strlen(typestr);
|
|
|
c480ed |
- char *tmp = controllers;
|
|
|
c480ed |
-
|
|
|
c480ed |
- while (tmp) {
|
|
|
c480ed |
- char *next = strchr(tmp, ',');
|
|
|
c480ed |
- int len;
|
|
|
c480ed |
- if (next) {
|
|
|
c480ed |
- len = next - tmp;
|
|
|
c480ed |
- next++;
|
|
|
c480ed |
- } else {
|
|
|
c480ed |
- len = strlen(tmp);
|
|
|
c480ed |
- }
|
|
|
c480ed |
|
|
|
c480ed |
+ if (virCgroupMountOptsMatchController(controllers, typestr) &&
|
|
|
c480ed |
+ group->controllers[i].mountPoint != NULL &&
|
|
|
c480ed |
+ group->controllers[i].placement == NULL) {
|
|
|
c480ed |
/*
|
|
|
c480ed |
* selfpath == "/" + path="" -> "/"
|
|
|
c480ed |
* selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"
|
|
|
c480ed |
* selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
|
|
|
c480ed |
*/
|
|
|
c480ed |
- if (typelen == len && STREQLEN(typestr, tmp, len) &&
|
|
|
c480ed |
- group->controllers[i].mountPoint != NULL &&
|
|
|
c480ed |
- group->controllers[i].placement == NULL) {
|
|
|
c480ed |
- if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
|
|
|
c480ed |
- if (VIR_STRDUP(group->controllers[i].placement,
|
|
|
c480ed |
- selfpath) < 0)
|
|
|
c480ed |
- goto cleanup;
|
|
|
c480ed |
- } else {
|
|
|
c480ed |
- if (virAsprintf(&group->controllers[i].placement,
|
|
|
c480ed |
- "%s%s%s", selfpath,
|
|
|
c480ed |
- (STREQ(selfpath, "/") ||
|
|
|
c480ed |
- STREQ(path, "") ? "" : "/"),
|
|
|
c480ed |
- path) < 0)
|
|
|
c480ed |
- goto cleanup;
|
|
|
c480ed |
- }
|
|
|
c480ed |
+ if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
|
|
|
c480ed |
+ if (VIR_STRDUP(group->controllers[i].placement,
|
|
|
c480ed |
+ selfpath) < 0)
|
|
|
c480ed |
+ goto cleanup;
|
|
|
c480ed |
+ } else {
|
|
|
c480ed |
+ if (virAsprintf(&group->controllers[i].placement,
|
|
|
c480ed |
+ "%s%s%s", selfpath,
|
|
|
c480ed |
+ (STREQ(selfpath, "/") ||
|
|
|
c480ed |
+ STREQ(path, "") ? "" : "/"),
|
|
|
c480ed |
+ path) < 0)
|
|
|
c480ed |
+ goto cleanup;
|
|
|
c480ed |
}
|
|
|
c480ed |
-
|
|
|
c480ed |
- tmp = next;
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|