[PATCH v2 17/53] [ACKED] vircgroup: introduce virCgroupV2HasEmptyTasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/util/vircgroupv2.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 3e8238ba1d..d20221cf9d 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -454,6 +454,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,
 
@@ -472,6 +488,7 @@ virCgroupBackend virCgroupV2Backend = {
     .makeGroup = virCgroupV2MakeGroup,
     .remove = virCgroupV2Remove,
     .addTask = virCgroupV2AddTask,
+    .hasEmptyTasks = virCgroupV2HasEmptyTasks,
 };
 
 
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux