ch: enable virNodeGetMemoryStats API

Enable virNodeGetMemoryStats API to return the stats of host memory.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Praveen K Paladugu 2024-11-15 13:48:58 -06:00 committed by Michal Privoznik
parent 91d6a0a1a9
commit ed1cef6264

View File

@ -40,6 +40,7 @@
#include "virutil.h" #include "virutil.h"
#include "viruuid.h" #include "viruuid.h"
#include "virnuma.h" #include "virnuma.h"
#include "virhostmem.h"
#define VIR_FROM_THIS VIR_FROM_CH #define VIR_FROM_THIS VIR_FROM_CH
@ -2209,6 +2210,19 @@ chDomainSetNumaParameters(virDomainPtr dom,
return ret; return ret;
} }
static int
chNodeGetMemoryStats(virConnectPtr conn,
int cellNum,
virNodeMemoryStatsPtr params,
int *nparams,
unsigned int flags)
{
if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
return -1;
return virHostMemGetStats(cellNum, params, nparams, flags);
}
/* Function Tables */ /* Function Tables */
static virHypervisorDriver chHypervisorDriver = { static virHypervisorDriver chHypervisorDriver = {
.name = "CH", .name = "CH",
@ -2266,6 +2280,7 @@ static virHypervisorDriver chHypervisorDriver = {
.domainHasManagedSaveImage = chDomainHasManagedSaveImage, /* 10.2.0 */ .domainHasManagedSaveImage = chDomainHasManagedSaveImage, /* 10.2.0 */
.domainRestore = chDomainRestore, /* 10.2.0 */ .domainRestore = chDomainRestore, /* 10.2.0 */
.domainRestoreFlags = chDomainRestoreFlags, /* 10.2.0 */ .domainRestoreFlags = chDomainRestoreFlags, /* 10.2.0 */
.nodeGetMemoryStats = chNodeGetMemoryStats, /* 10.10.0 */
}; };
static virConnectDriver chConnectDriver = { static virConnectDriver chConnectDriver = {