|
|
c480ed |
From 2a826bcdbe8e34af71634250ae814d5ff81d6ffc Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <2a826bcdbe8e34af71634250ae814d5ff81d6ffc@dist-git>
|
|
|
c480ed |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Date: Mon, 1 Jul 2019 17:07:24 +0200
|
|
|
c480ed |
Subject: [PATCH] vircgroup: introduce virCgroupV2PathOfController
|
|
|
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 0542640a9c480993c7e8be6917b0f513277b4cea)
|
|
|
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: <91b63d07af48bdb0fdc9648f4e5e4808cc90ad0e.1561993100.git.phrdina@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/util/vircgroupv2.c | 24 ++++++++++++++++++++++++
|
|
|
c480ed |
1 file changed, 24 insertions(+)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
|
|
c480ed |
index 65cbad533b..6695901766 100644
|
|
|
c480ed |
--- a/src/util/vircgroupv2.c
|
|
|
c480ed |
+++ b/src/util/vircgroupv2.c
|
|
|
c480ed |
@@ -315,6 +315,29 @@ virCgroupV2GetAnyController(virCgroupPtr group)
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
+static int
|
|
|
c480ed |
+virCgroupV2PathOfController(virCgroupPtr group,
|
|
|
c480ed |
+ int controller,
|
|
|
c480ed |
+ const char *key,
|
|
|
c480ed |
+ char **path)
|
|
|
c480ed |
+{
|
|
|
c480ed |
+ if (!virCgroupV2HasController(group, controller)) {
|
|
|
c480ed |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c480ed |
+ _("v2 controller '%s' is not available"),
|
|
|
c480ed |
+ virCgroupV2ControllerTypeToString(controller));
|
|
|
c480ed |
+ return -1;
|
|
|
c480ed |
+ }
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (virAsprintf(path, "%s%s/%s",
|
|
|
c480ed |
+ group->unified.mountPoint,
|
|
|
c480ed |
+ group->unified.placement,
|
|
|
c480ed |
+ key ? key : "") < 0)
|
|
|
c480ed |
+ return -1;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ return 0;
|
|
|
c480ed |
+}
|
|
|
c480ed |
+
|
|
|
c480ed |
+
|
|
|
c480ed |
virCgroupBackend virCgroupV2Backend = {
|
|
|
c480ed |
.type = VIR_CGROUP_BACKEND_TYPE_V2,
|
|
|
c480ed |
|
|
|
c480ed |
@@ -329,6 +352,7 @@ virCgroupBackend virCgroupV2Backend = {
|
|
|
c480ed |
.detectControllers = virCgroupV2DetectControllers,
|
|
|
c480ed |
.hasController = virCgroupV2HasController,
|
|
|
c480ed |
.getAnyController = virCgroupV2GetAnyController,
|
|
|
c480ed |
+ .pathOfController = virCgroupV2PathOfController,
|
|
|
c480ed |
};
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|