]> xenbits.xensource.com Git - libvirt.git/commitdiff
bhyve: implement node information reporting
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 24 Feb 2014 08:23:27 +0000 (12:23 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 24 Feb 2014 15:03:46 +0000 (19:03 +0400)
- Implement nodeGetCPUStats using nodeGetCPUStats()
- Implement nodeGetMemoryStats using nodeGetMemoryStats()

src/bhyve/bhyve_driver.c

index 7c6500ffe08da92600d8a8d3848224c47d598225..accb37fa4aec859ea344e15bed4d7784c39c1c0a 100644 (file)
@@ -48,6 +48,7 @@
 #include "virstring.h"
 #include "cpu/cpu.h"
 #include "viraccessapicheck.h"
+#include "nodeinfo.h"
 
 #include "bhyve_driver.h"
 #include "bhyve_process.h"
@@ -496,6 +497,32 @@ cleanup:
     return ret;
 }
 
+static int
+bhyveNodeGetCPUStats(virConnectPtr conn,
+                     int cpuNum,
+                     virNodeCPUStatsPtr params,
+                     int *nparams,
+                     unsigned int flags)
+{
+    if (virNodeGetCPUStatsEnsureACL(conn) < 0)
+        return -1;
+
+    return nodeGetCPUStats(cpuNum, params, nparams, flags);
+}
+
+static int
+bhyveNodeGetMemoryStats(virConnectPtr conn,
+                        int cellNum,
+                        virNodeMemoryStatsPtr params,
+                        int *nparams,
+                        unsigned int flags)
+{
+    if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
+        return -1;
+
+    return nodeGetMemoryStats(cellNum, params, nparams, flags);
+}
+
 static int
 bhyveStateCleanup(void)
 {
@@ -594,6 +621,8 @@ static virDriver bhyveDriver = {
     .domainLookupByName = bhyveDomainLookupByName, /* 1.2.2 */
     .domainDefineXML = bhyveDomainDefineXML, /* 1.2.2 */
     .domainGetXMLDesc = bhyveDomainGetXMLDesc, /* 1.2.2 */
+    .nodeGetCPUStats = bhyveNodeGetCPUStats, /* 1.2.2 */
+    .nodeGetMemoryStats = bhyveNodeGetMemoryStats, /* 1.2.2 */
 };