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