render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From 64cc7545de4c32deda12cd1c6088b065c0a09592 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <64cc7545de4c32deda12cd1c6088b065c0a09592@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:07:19 +0200
c480ed
Subject: [PATCH] vircgroup: introduce virCgroupV2ValidatePlacement
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 9aa8226d866f7a274179bfe900d441cbd2f5ae12)
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: <db5e4f6695d27deead1d53a7397101e086261039.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroupv2.c | 15 +++++++++++++++
c480ed
 1 file changed, 15 insertions(+)
c480ed
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index fb1aa2de0a..815d8fca9b 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -206,6 +206,20 @@ virCgroupV2DetectPlacement(virCgroupPtr group,
c480ed
 }
c480ed
 
c480ed
 
c480ed
+static int
c480ed
+virCgroupV2ValidatePlacement(virCgroupPtr group,
c480ed
+                             pid_t pid ATTRIBUTE_UNUSED)
c480ed
+{
c480ed
+    if (!group->unified.placement) {
c480ed
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
c480ed
+                       _("Could not find placement for v2 controller"));
c480ed
+        return -1;
c480ed
+    }
c480ed
+
c480ed
+    return 0;
c480ed
+}
c480ed
+
c480ed
+
c480ed
 virCgroupBackend virCgroupV2Backend = {
c480ed
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
c480ed
 
c480ed
@@ -215,6 +229,7 @@ virCgroupBackend virCgroupV2Backend = {
c480ed
     .copyPlacement = virCgroupV2CopyPlacement,
c480ed
     .detectMounts = virCgroupV2DetectMounts,
c480ed
     .detectPlacement = virCgroupV2DetectPlacement,
c480ed
+    .validatePlacement = virCgroupV2ValidatePlacement,
c480ed
 };
c480ed
 
c480ed
 
c480ed
-- 
c480ed
2.22.0
c480ed