mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
util: Add interface for creating monitor group
Add interface for creating the resource monitoring group according to '@virResctrlMonitor->path'. Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
4f5bc6cc10
commit
2f22364688
@ -2682,6 +2682,7 @@ virResctrlInfoGetMonitorPrefix;
|
|||||||
virResctrlInfoMonFree;
|
virResctrlInfoMonFree;
|
||||||
virResctrlInfoNew;
|
virResctrlInfoNew;
|
||||||
virResctrlMonitorAddPID;
|
virResctrlMonitorAddPID;
|
||||||
|
virResctrlMonitorCreate;
|
||||||
virResctrlMonitorDeterminePath;
|
virResctrlMonitorDeterminePath;
|
||||||
virResctrlMonitorNew;
|
virResctrlMonitorNew;
|
||||||
|
|
||||||
|
@ -2546,3 +2546,27 @@ virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
|
|||||||
{
|
{
|
||||||
return virResctrlAddPID(monitor->path, pid);
|
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;
|
||||||
|
}
|
||||||
|
@ -201,4 +201,8 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
|
|||||||
int
|
int
|
||||||
virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
|
virResctrlMonitorAddPID(virResctrlMonitorPtr monitor,
|
||||||
pid_t pid);
|
pid_t pid);
|
||||||
|
|
||||||
|
int
|
||||||
|
virResctrlMonitorCreate(virResctrlMonitorPtr monitor,
|
||||||
|
const char *machinename);
|
||||||
#endif /* __VIR_RESCTRL_H__ */
|
#endif /* __VIR_RESCTRL_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user