From 64cc7545de4c32deda12cd1c6088b065c0a09592 Mon Sep 17 00:00:00 2001
Message-Id: <64cc7545de4c32deda12cd1c6088b065c0a09592@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:07:19 +0200
Subject: [PATCH] vircgroup: introduce virCgroupV2ValidatePlacement
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 9aa8226d866f7a274179bfe900d441cbd2f5ae12)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <db5e4f6695d27deead1d53a7397101e086261039.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/util/vircgroupv2.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index fb1aa2de0a..815d8fca9b 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -206,6 +206,20 @@ virCgroupV2DetectPlacement(virCgroupPtr group,
}
+static int
+virCgroupV2ValidatePlacement(virCgroupPtr group,
+ pid_t pid ATTRIBUTE_UNUSED)
+{
+ if (!group->unified.placement) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not find placement for v2 controller"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
virCgroupBackend virCgroupV2Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V2,
@@ -215,6 +229,7 @@ virCgroupBackend virCgroupV2Backend = {
.copyPlacement = virCgroupV2CopyPlacement,
.detectMounts = virCgroupV2DetectMounts,
.detectPlacement = virCgroupV2DetectPlacement,
+ .validatePlacement = virCgroupV2ValidatePlacement,
};
--
2.22.0