From: Maxim Nestratov <mnestratov(a)virtuozzo.com>
The following functions were implemented:
vzNodeGetCPUStats, vzNodeGetMemoryStats,
vzNodeGetCellsFreeMemory and vzNodeGetFreeMemory.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
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 */
--
1.7.1