[PATCH] ch: enable virNodeGetMemoryStats API

Praveen K Paladugu posted 1 patch 3 weeks ago
src/ch/ch_driver.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
[PATCH] ch: enable virNodeGetMemoryStats API
Posted by Praveen K Paladugu 3 weeks ago
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>
---
 src/ch/ch_driver.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 17ae488a02..34f3a495fc 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -40,6 +40,7 @@
 #include "virutil.h"
 #include "viruuid.h"
 #include "virnuma.h"
+#include "virhostmem.h"
 
 #define VIR_FROM_THIS VIR_FROM_CH
 
@@ -2209,6 +2210,19 @@ chDomainSetNumaParameters(virDomainPtr dom,
     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 */
 static virHypervisorDriver chHypervisorDriver = {
     .name = "CH",
@@ -2266,6 +2280,7 @@ static virHypervisorDriver chHypervisorDriver = {
     .domainHasManagedSaveImage = chDomainHasManagedSaveImage,   /* 10.2.0 */
     .domainRestore = chDomainRestore,                       /* 10.2.0 */
     .domainRestoreFlags = chDomainRestoreFlags,             /* 10.2.0 */
+    .nodeGetMemoryStats = chNodeGetMemoryStats,             /* 10.10.0 */
 };
 
 static virConnectDriver chConnectDriver = {
-- 
2.47.0
Re: [PATCH] ch: enable virNodeGetMemoryStats API
Posted by Michal Prívozník 2 weeks, 4 days ago
On 11/15/24 20:48, Praveen K Paladugu wrote:
> 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>
> ---
>  src/ch/ch_driver.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal