|
Pablo Greco |
40546a |
From 1cabfada0f1a83ae78b6a7dbb9128512369fd6f4 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <1cabfada0f1a83ae78b6a7dbb9128512369fd6f4@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:07:16 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgroup: introduce virCgroupV2CopyPlacement
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 7a86201dd6e8cc7e418ea0891aeb44bacd08a10d)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <70993f08246ff3782d9b4a5bdf9187a0c1b57882.1561993100.git.phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/util/vircgroupv2.c | 27 +++++++++++++++++++++++++++
|
|
Pablo Greco |
40546a |
1 file changed, 27 insertions(+)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
|
Pablo Greco |
40546a |
index 5d3c80b309..ed87b35db7 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupv2.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupv2.c
|
|
Pablo Greco |
40546a |
@@ -140,12 +140,39 @@ virCgroupV2CopyMounts(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
+virCgroupV2CopyPlacement(virCgroupPtr group,
|
|
Pablo Greco |
40546a |
+ const char *path,
|
|
Pablo Greco |
40546a |
+ virCgroupPtr parent)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ if (path[0] == '/') {
|
|
Pablo Greco |
40546a |
+ if (VIR_STRDUP(group->unified.placement, path) < 0)
|
|
Pablo Greco |
40546a |
+ return -1;
|
|
Pablo Greco |
40546a |
+ } else {
|
|
Pablo Greco |
40546a |
+ /*
|
|
Pablo Greco |
40546a |
+ * parent == "/" + path="" => "/"
|
|
Pablo Greco |
40546a |
+ * parent == "/libvirt.service" + path == "" => "/libvirt.service"
|
|
Pablo Greco |
40546a |
+ * parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
|
|
Pablo Greco |
40546a |
+ */
|
|
Pablo Greco |
40546a |
+ if (virAsprintf(&group->unified.placement, "%s%s%s",
|
|
Pablo Greco |
40546a |
+ parent->unified.placement,
|
|
Pablo Greco |
40546a |
+ (STREQ(parent->unified.placement, "/") ||
|
|
Pablo Greco |
40546a |
+ STREQ(path, "") ? "" : "/"),
|
|
Pablo Greco |
40546a |
+ path) < 0)
|
|
Pablo Greco |
40546a |
+ return -1;
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ return 0;
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
virCgroupBackend virCgroupV2Backend = {
|
|
Pablo Greco |
40546a |
.type = VIR_CGROUP_BACKEND_TYPE_V2,
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
.available = virCgroupV2Available,
|
|
Pablo Greco |
40546a |
.validateMachineGroup = virCgroupV2ValidateMachineGroup,
|
|
Pablo Greco |
40546a |
.copyMounts = virCgroupV2CopyMounts,
|
|
Pablo Greco |
40546a |
+ .copyPlacement = virCgroupV2CopyPlacement,
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|