Re: [PATCH 2/3] vz: implement API calls of nodeGetxxx family

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/14/2015 12:50 PM, Maxim Nestratov wrote:
From: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>

The following functions were implemented:

  vzNodeGetCPUStats, vzNodeGetMemoryStats,
  vzNodeGetCellsFreeMemory and vzNodeGetFreeMemory.

Looks good to me, ACK.


Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
---
  src/vz/vz_driver.c |   42 ++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 3cd6096..8a311ed 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1354,6 +1354,44 @@ static const char *vzConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
      return "vz";
  }
+static int
+vzNodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
+                  int cpuNum,
+                  virNodeCPUStatsPtr params,
+                  int *nparams,
+                  unsigned int flags)
+{
+    return nodeGetCPUStats(cpuNum, params, nparams, flags);
+}
+
+static int
+vzNodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
+                     int cellNum,
+                     virNodeMemoryStatsPtr params,
+                     int *nparams,
+                     unsigned int flags)
+{
+    return nodeGetMemoryStats(NULL, cellNum, params, nparams, flags);
+}
+
+static int
+vzNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
+                         unsigned long long *freeMems,
+                         int startCell,
+                         int maxCells)
+{
+    return nodeGetCellsFreeMemory(freeMems, startCell, maxCells);
+}
+
+static unsigned long long
+vzNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
+{
+    unsigned long long freeMem;
+    if (nodeGetMemory(NULL, &freeMem) < 0)
+        return 0;
+    return freeMem;
+}
+
  static virHypervisorDriver vzDriver = {
      .name = "vz",
      .connectOpen = vzConnectOpen,            /* 0.10.0 */
@@ -1363,6 +1401,10 @@ static virHypervisorDriver vzDriver = {
      .connectGetType = vzConnectGetType,        /* 1.2.21 */
      .connectGetMaxVcpus = vzConnectGetMaxVcpus, /* 1.2.21 */
      .nodeGetInfo = vzNodeGetInfo,      /* 0.10.0 */
+    .nodeGetCPUStats = vzNodeGetCPUStats,      /* 1.2.21 */
+    .nodeGetMemoryStats = vzNodeGetMemoryStats, /* 1.2.21 */
+    .nodeGetCellsFreeMemory = vzNodeGetCellsFreeMemory, /* 1.2.21 */
+    .nodeGetFreeMemory = vzNodeGetFreeMemory, /* 1.2.21 */
      .connectGetCapabilities = vzConnectGetCapabilities,      /* 0.10.0 */
      .connectBaselineCPU = vzConnectBaselineCPU, /* 1.2.6 */
      .connectListDomains = vzConnectListDomains,      /* 0.10.0 */

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]