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