|
|
c480ed |
From 40a3ab5f35bb847ae210160b5bcb2b3ab8990e5a Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <40a3ab5f35bb847ae210160b5bcb2b3ab8990e5a@dist-git>
|
|
|
c480ed |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Date: Mon, 1 Jul 2019 17:07:28 +0200
|
|
|
c480ed |
Subject: [PATCH] vircgroup: introduce virCgroupV2HasEmptyTasks
|
|
|
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 38411bb831a8c5086145b9781168349bc64fbc25)
|
|
|
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: <36bb2bd62faa6528de46da822d026f67be9f6d16.1561993100.git.phrdina@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/util/vircgroupv2.c | 17 +++++++++++++++++
|
|
|
c480ed |
1 file changed, 17 insertions(+)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
|
|
c480ed |
index 6ffb5ce786..074e6ec110 100644
|
|
|
c480ed |
--- a/src/util/vircgroupv2.c
|
|
|
c480ed |
+++ b/src/util/vircgroupv2.c
|
|
|
c480ed |
@@ -446,6 +446,22 @@ virCgroupV2AddTask(virCgroupPtr group,
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
+static int
|
|
|
c480ed |
+virCgroupV2HasEmptyTasks(virCgroupPtr cgroup,
|
|
|
c480ed |
+ int controller)
|
|
|
c480ed |
+{
|
|
|
c480ed |
+ int ret = -1;
|
|
|
c480ed |
+ VIR_AUTOFREE(char *) content = NULL;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ ret = virCgroupGetValueStr(cgroup, controller, "cgroup.procs", &content);
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (ret == 0 && content[0] == '\0')
|
|
|
c480ed |
+ ret = 1;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ return ret;
|
|
|
c480ed |
+}
|
|
|
c480ed |
+
|
|
|
c480ed |
+
|
|
|
c480ed |
virCgroupBackend virCgroupV2Backend = {
|
|
|
c480ed |
.type = VIR_CGROUP_BACKEND_TYPE_V2,
|
|
|
c480ed |
|
|
|
c480ed |
@@ -464,6 +480,7 @@ virCgroupBackend virCgroupV2Backend = {
|
|
|
c480ed |
.makeGroup = virCgroupV2MakeGroup,
|
|
|
c480ed |
.remove = virCgroupV2Remove,
|
|
|
c480ed |
.addTask = virCgroupV2AddTask,
|
|
|
c480ed |
+ .hasEmptyTasks = virCgroupV2HasEmptyTasks,
|
|
|
c480ed |
};
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|