Add interface for creating the resource monitoring group according
to '@virResctrlMonitor->path'.
Signed-off-by: Wang Huaqiang <huaqiang.wang(a)intel.com>
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virresctrl.c | 24 ++++++++++++++++++++++++
src/util/virresctrl.h | 4 ++++
3 files changed, 29 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 94689dd..3216abe 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2542,3 +2542,27 @@ virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
{
return virResctrlAddPID(monitor->path, pid);
}
+
+
+int
+virResctrlMonitorCreate(virResctrlMonitorPtr monitor,
+ const char *machinename)
+{
+ int lockfd = -1;
+ int ret = -1;
+
+ if (!monitor)
+ return 0;
+
+ 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 52d283a..76e40a2 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -201,4 +201,8 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
int
virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
pid_t pid);
+
+int
+virResctrlMonitorCreate(virResctrlMonitorPtr monitor,
+ const char *machinename);
#endif /* __VIR_RESCTRL_H__ */
--
2.7.4