[PATCHv5 08/19] util: Add interface for creating monitor group

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

 



Add interface for creating the resource monitoring group according
to '@virResctrlMonitor->path'.

Signed-off-by: Wang Huaqiang <huaqiang.wang@xxxxxxxxx>
---
 src/libvirt_private.syms |  1 +
 src/util/virresctrl.c    | 28 ++++++++++++++++++++++++++++
 src/util/virresctrl.h    |  6 ++++++
 3 files changed, 35 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e175c8b..a878083 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2681,6 +2681,7 @@ virResctrlInfoGetMonitorPrefix;
 virResctrlInfoMonFree;
 virResctrlInfoNew;
 virResctrlMonitorAddPID;
+virResctrlMonitorCreate;
 virResctrlMonitorDeterminePath;
 virResctrlMonitorNew;
 
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 8b617a6..b3d20cc 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2475,6 +2475,7 @@ virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
     return virResctrlAddPID(monitor->path, pid);
 }
 
+
 int
 virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
                                const char *machinename)
@@ -2506,3 +2507,30 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
 
     return 0;
 }
+
+
+int
+virResctrlMonitorCreate(virResctrlAllocPtr alloc,
+                        virResctrlMonitorPtr monitor,
+                        const char *machinename)
+{
+    int lockfd = -1;
+    int ret = -1;
+
+    if (!monitor)
+        return 0;
+
+    monitor->alloc = virObjectRef(alloc);
+
+    if (virResctrlMonitorDeterminePath(monitor, machinename) < 0)
+        return -1;
+
+    lockfd = virResctrlLockWrite();
+    if (lockfd < 0)
+        return -1;
+
+    ret = virResctrlCreateGroupPath(monitor->path);
+
+    virResctrlUnlock(lockfd);
+    return ret;
+}
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
index 69b6b1d..1efe394 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -196,7 +196,13 @@ virResctrlMonitorNew(void);
 int
 virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
                         pid_t pid);
+
 int
 virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
                                const char *machinename);
+
+int
+virResctrlMonitorCreate(virResctrlAllocPtr alloc,
+                        virResctrlMonitorPtr monitor,
+                        const char *machinename);
 #endif /*  __VIR_RESCTRL_H__ */
-- 
2.7.4

--
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