vz: implement API calls of nodeGetxxx family

The following functions were implemented:

 vzNodeGetCPUStats, vzNodeGetMemoryStats,
 vzNodeGetCellsFreeMemory and vzNodeGetFreeMemory.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
This commit is contained in:
Maxim Nestratov 2015-10-19 22:02:00 +03:00 committed by Dmitry Guryanov
parent e16dd5f2d2
commit 4ff36e742b

View File

@ -1350,6 +1350,44 @@ static int vzConnectGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED,
return -1; return -1;
} }
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 = { static virHypervisorDriver vzDriver = {
.name = "vz", .name = "vz",
.connectOpen = vzConnectOpen, /* 0.10.0 */ .connectOpen = vzConnectOpen, /* 0.10.0 */
@ -1358,6 +1396,10 @@ static virHypervisorDriver vzDriver = {
.connectGetHostname = vzConnectGetHostname, /* 0.10.0 */ .connectGetHostname = vzConnectGetHostname, /* 0.10.0 */
.connectGetMaxVcpus = vzConnectGetMaxVcpus, /* 1.2.21 */ .connectGetMaxVcpus = vzConnectGetMaxVcpus, /* 1.2.21 */
.nodeGetInfo = vzNodeGetInfo, /* 0.10.0 */ .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 */ .connectGetCapabilities = vzConnectGetCapabilities, /* 0.10.0 */
.connectBaselineCPU = vzConnectBaselineCPU, /* 1.2.6 */ .connectBaselineCPU = vzConnectBaselineCPU, /* 1.2.6 */
.connectListDomains = vzConnectListDomains, /* 0.10.0 */ .connectListDomains = vzConnectListDomains, /* 0.10.0 */