render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From 2395bf301cf76ffa863a3c2e125d52345cfbf6b5 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <2395bf301cf76ffa863a3c2e125d52345cfbf6b5@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:08:23 +0200
Pablo Greco 40546a
Subject: [PATCH] Revert "util: vircgroup: pass parent cgroup into
Pablo Greco 40546a
 virCgroupDetectControllersCB"
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
This reverts commit 7bca1c9bdc85247446129f856e27c80a32819e17.
Pablo Greco 40546a
Pablo Greco 40546a
As it turns out it's not a good idea on systemd hosts.  The root
Pablo Greco 40546a
cgroup can have all controllers enabled but they don't have to be
Pablo Greco 40546a
enabled for sub-cgroups.
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
(cherry picked from commit d117431143d5b6dcfc8fae4a6b3fae23881d0937)
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: <754b0ac5a0f1bd21e79eaeb71f6d2ab811446168.1561993100.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/vircgroup.c        |  2 +-
Pablo Greco 40546a
 src/util/vircgroupbackend.h |  3 +--
Pablo Greco 40546a
 src/util/vircgroupv1.c      |  3 +--
Pablo Greco 40546a
 src/util/vircgroupv2.c      | 17 ++++++-----------
Pablo Greco 40546a
 4 files changed, 9 insertions(+), 16 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
Pablo Greco 40546a
index ff2a0b75b5..a7fb595bce 100644
Pablo Greco 40546a
--- a/src/util/vircgroup.c
Pablo Greco 40546a
+++ b/src/util/vircgroup.c
Pablo Greco 40546a
@@ -412,7 +412,7 @@ virCgroupDetect(virCgroupPtr group,
Pablo Greco 40546a
 
Pablo Greco 40546a
     for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
Pablo Greco 40546a
         if (group->backends[i]) {
Pablo Greco 40546a
-            int rc = group->backends[i]->detectControllers(group, controllers, parent);
Pablo Greco 40546a
+            int rc = group->backends[i]->detectControllers(group, controllers);
Pablo Greco 40546a
             if (rc < 0)
Pablo Greco 40546a
                 return -1;
Pablo Greco 40546a
             controllersAvailable |= rc;
Pablo Greco 40546a
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
Pablo Greco 40546a
index 05af118ec1..a825dc4be7 100644
Pablo Greco 40546a
--- a/src/util/vircgroupbackend.h
Pablo Greco 40546a
+++ b/src/util/vircgroupbackend.h
Pablo Greco 40546a
@@ -96,8 +96,7 @@ typedef char *
Pablo Greco 40546a
 
Pablo Greco 40546a
 typedef int
Pablo Greco 40546a
 (*virCgroupDetectControllersCB)(virCgroupPtr group,
Pablo Greco 40546a
-                                int controllers,
Pablo Greco 40546a
-                                virCgroupPtr parent);
Pablo Greco 40546a
+                                int controllers);
Pablo Greco 40546a
 
Pablo Greco 40546a
 typedef bool
Pablo Greco 40546a
 (*virCgroupHasControllerCB)(virCgroupPtr cgroup,
Pablo Greco 40546a
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
Pablo Greco 40546a
index 5b218c7f78..58bd20d636 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv1.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv1.c
Pablo Greco 40546a
@@ -419,8 +419,7 @@ virCgroupV1StealPlacement(virCgroupPtr group)
Pablo Greco 40546a
 
Pablo Greco 40546a
 static int
Pablo Greco 40546a
 virCgroupV1DetectControllers(virCgroupPtr group,
Pablo Greco 40546a
-                             int controllers,
Pablo Greco 40546a
-                             virCgroupPtr parent ATTRIBUTE_UNUSED)
Pablo Greco 40546a
+                             int controllers)
Pablo Greco 40546a
 {
Pablo Greco 40546a
     size_t i;
Pablo Greco 40546a
     size_t j;
Pablo Greco 40546a
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
Pablo Greco 40546a
index bdeab397a3..b0ed889cc8 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv2.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv2.c
Pablo Greco 40546a
@@ -285,21 +285,16 @@ virCgroupV2ParseControllersFile(virCgroupPtr group)
Pablo Greco 40546a
 
Pablo Greco 40546a
 static int
Pablo Greco 40546a
 virCgroupV2DetectControllers(virCgroupPtr group,
Pablo Greco 40546a
-                             int controllers,
Pablo Greco 40546a
-                             virCgroupPtr parent)
Pablo Greco 40546a
+                             int controllers)
Pablo Greco 40546a
 {
Pablo Greco 40546a
     size_t i;
Pablo Greco 40546a
 
Pablo Greco 40546a
-    if (parent) {
Pablo Greco 40546a
-        group->unified.controllers = parent->unified.controllers;
Pablo Greco 40546a
-    } else {
Pablo Greco 40546a
-        if (virCgroupV2ParseControllersFile(group) < 0)
Pablo Greco 40546a
-            return -1;
Pablo Greco 40546a
+    if (virCgroupV2ParseControllersFile(group) < 0)
Pablo Greco 40546a
+        return -1;
Pablo Greco 40546a
 
Pablo Greco 40546a
-        /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
Pablo Greco 40546a
-         * exists with usage stats. */
Pablo Greco 40546a
-        group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
Pablo Greco 40546a
-    }
Pablo Greco 40546a
+    /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
Pablo Greco 40546a
+     * exists with usage stats. */
Pablo Greco 40546a
+    group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (controllers >= 0)
Pablo Greco 40546a
         group->unified.controllers &= controllers;
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a