mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Separate internal node device APIs from public API
The individual hypervisor drivers were directly referencing APIs in src/nodeinfo.c in their virDriverPtr struct. Separate these methods, so there is always a wrapper in the hypervisor driver. This allows the unused virConnectPtr args to be removed from the nodeinfo.c file. Again this will ensure that ACL checks will only be performed on invocations that are directly associated with public API usage. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
ead630319d
commit
1c6d4ca557
@ -4402,6 +4402,82 @@ lxcConnectGetSysinfo(virConnectPtr conn, unsigned int flags)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
return nodeGetInfo(nodeinfo);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUStats(cpuNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cellNum,
|
||||
virNodeMemoryStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryStats(cellNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
return nodeGetCellsFreeMemory(freeMems, startCell, maxCells);
|
||||
}
|
||||
|
||||
|
||||
static unsigned long long
|
||||
lxcNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return nodeGetFreeMemory();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeSetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUMap(cpumap, online, flags);
|
||||
}
|
||||
|
||||
/* Function Tables */
|
||||
static virDriver lxcDriver = {
|
||||
.no = VIR_DRV_LXC,
|
||||
@ -4411,7 +4487,7 @@ static virDriver lxcDriver = {
|
||||
.connectGetVersion = lxcConnectGetVersion, /* 0.4.6 */
|
||||
.connectGetHostname = lxcConnectGetHostname, /* 0.6.3 */
|
||||
.connectGetSysinfo = lxcConnectGetSysinfo, /* 1.0.5 */
|
||||
.nodeGetInfo = nodeGetInfo, /* 0.6.5 */
|
||||
.nodeGetInfo = lxcNodeGetInfo, /* 0.6.5 */
|
||||
.connectGetCapabilities = lxcConnectGetCapabilities, /* 0.6.5 */
|
||||
.connectListDomains = lxcConnectListDomains, /* 0.4.2 */
|
||||
.connectNumOfDomains = lxcConnectNumOfDomains, /* 0.4.2 */
|
||||
@ -4457,11 +4533,11 @@ static virDriver lxcDriver = {
|
||||
.domainSetSchedulerParameters = lxcDomainSetSchedulerParameters, /* 0.5.0 */
|
||||
.domainSetSchedulerParametersFlags = lxcDomainSetSchedulerParametersFlags, /* 0.9.2 */
|
||||
.domainInterfaceStats = lxcDomainInterfaceStats, /* 0.7.3 */
|
||||
.nodeGetCPUStats = nodeGetCPUStats, /* 0.9.3 */
|
||||
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
|
||||
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.6.5 */
|
||||
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.6.5 */
|
||||
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
|
||||
.nodeGetCPUStats = lxcNodeGetCPUStats, /* 0.9.3 */
|
||||
.nodeGetMemoryStats = lxcNodeGetMemoryStats, /* 0.9.3 */
|
||||
.nodeGetCellsFreeMemory = lxcNodeGetCellsFreeMemory, /* 0.6.5 */
|
||||
.nodeGetFreeMemory = lxcNodeGetFreeMemory, /* 0.6.5 */
|
||||
.nodeGetCPUMap = lxcNodeGetCPUMap, /* 1.0.0 */
|
||||
.connectDomainEventRegister = lxcConnectDomainEventRegister, /* 0.7.0 */
|
||||
.connectDomainEventDeregister = lxcConnectDomainEventDeregister, /* 0.7.0 */
|
||||
.connectIsEncrypted = lxcConnectIsEncrypted, /* 0.7.3 */
|
||||
@ -4474,8 +4550,8 @@ static virDriver lxcDriver = {
|
||||
.domainOpenConsole = lxcDomainOpenConsole, /* 0.8.6 */
|
||||
.connectIsAlive = lxcConnectIsAlive, /* 0.9.8 */
|
||||
.nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
|
||||
.nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
|
||||
.nodeGetMemoryParameters = lxcNodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = lxcNodeSetMemoryParameters, /* 0.10.2 */
|
||||
.domainSendProcessSignal = lxcDomainSendProcessSignal, /* 1.0.1 */
|
||||
.domainShutdown = lxcDomainShutdown, /* 1.0.1 */
|
||||
.domainShutdownFlags = lxcDomainShutdownFlags, /* 1.0.1 */
|
||||
|
@ -866,7 +866,7 @@ error:
|
||||
}
|
||||
#endif
|
||||
|
||||
int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo)
|
||||
int nodeGetInfo(virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
virArch hostarch = virArchFromHost();
|
||||
|
||||
@ -940,8 +940,7 @@ cleanup:
|
||||
#endif
|
||||
}
|
||||
|
||||
int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cpuNum ATTRIBUTE_UNUSED,
|
||||
int nodeGetCPUStats(int cpuNum ATTRIBUTE_UNUSED,
|
||||
virNodeCPUStatsPtr params ATTRIBUTE_UNUSED,
|
||||
int *nparams ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
@ -969,8 +968,7 @@ int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
#endif
|
||||
}
|
||||
|
||||
int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cellNum ATTRIBUTE_UNUSED,
|
||||
int nodeGetMemoryStats(int cellNum ATTRIBUTE_UNUSED,
|
||||
virNodeMemoryStatsPtr params ATTRIBUTE_UNUSED,
|
||||
int *nparams ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
@ -1191,8 +1189,7 @@ nodeMemoryParametersIsAllSupported(virTypedParameterPtr params,
|
||||
#endif
|
||||
|
||||
int
|
||||
nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params ATTRIBUTE_UNUSED,
|
||||
nodeSetMemoryParameters(virTypedParameterPtr params ATTRIBUTE_UNUSED,
|
||||
int nparams ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -1287,8 +1284,7 @@ cleanup:
|
||||
|
||||
#define NODE_MEMORY_PARAMETERS_NUM 8
|
||||
int
|
||||
nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params ATTRIBUTE_UNUSED,
|
||||
nodeGetMemoryParameters(virTypedParameterPtr params ATTRIBUTE_UNUSED,
|
||||
int *nparams ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -1435,8 +1431,7 @@ nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
int
|
||||
nodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned char **cpumap,
|
||||
nodeGetCPUMap(unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -1475,7 +1470,7 @@ nodeCapsInitNUMAFake(virCapsPtr caps ATTRIBUTE_UNUSED)
|
||||
int s, c, t;
|
||||
int id;
|
||||
|
||||
if (nodeGetInfo(NULL, &nodeinfo) < 0)
|
||||
if (nodeGetInfo(&nodeinfo) < 0)
|
||||
return -1;
|
||||
|
||||
ncpus = VIR_NODEINFO_MAXCPUS(nodeinfo);
|
||||
@ -1517,8 +1512,7 @@ nodeCapsInitNUMAFake(virCapsPtr caps ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
static int
|
||||
nodeGetCellsFreeMemoryFake(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned long long *freeMems,
|
||||
nodeGetCellsFreeMemoryFake(unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -1543,7 +1537,7 @@ nodeGetCellsFreeMemoryFake(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
static unsigned long long
|
||||
nodeGetFreeMemoryFake(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
nodeGetFreeMemoryFake(void)
|
||||
{
|
||||
double avail = physmem_available();
|
||||
unsigned long long ret;
|
||||
@ -1700,8 +1694,7 @@ cleanup:
|
||||
|
||||
|
||||
int
|
||||
nodeGetCellsFreeMemory(virConnectPtr conn,
|
||||
unsigned long long *freeMems,
|
||||
nodeGetCellsFreeMemory(unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
@ -1710,7 +1703,7 @@ nodeGetCellsFreeMemory(virConnectPtr conn,
|
||||
int maxCell;
|
||||
|
||||
if (numa_available() < 0)
|
||||
return nodeGetCellsFreeMemoryFake(conn, freeMems,
|
||||
return nodeGetCellsFreeMemoryFake(freeMems,
|
||||
startCell, maxCells);
|
||||
|
||||
maxCell = numa_max_node();
|
||||
@ -1741,13 +1734,13 @@ cleanup:
|
||||
}
|
||||
|
||||
unsigned long long
|
||||
nodeGetFreeMemory(virConnectPtr conn)
|
||||
nodeGetFreeMemory(void)
|
||||
{
|
||||
unsigned long long freeMem = 0;
|
||||
int n;
|
||||
|
||||
if (numa_available() < 0)
|
||||
return nodeGetFreeMemoryFake(conn);
|
||||
return nodeGetFreeMemoryFake();
|
||||
|
||||
|
||||
for (n = 0 ; n <= numa_max_node() ; n++) {
|
||||
@ -1811,17 +1804,16 @@ int nodeCapsInitNUMA(virCapsPtr caps) {
|
||||
return nodeCapsInitNUMAFake(caps);
|
||||
}
|
||||
|
||||
int nodeGetCellsFreeMemory(virConnectPtr conn,
|
||||
unsigned long long *freeMems,
|
||||
int nodeGetCellsFreeMemory(unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
return nodeGetCellsFreeMemoryFake(conn, freeMems,
|
||||
return nodeGetCellsFreeMemoryFake(freeMems,
|
||||
startCell, maxCells);
|
||||
}
|
||||
|
||||
unsigned long long nodeGetFreeMemory(virConnectPtr conn)
|
||||
unsigned long long nodeGetFreeMemory(void)
|
||||
{
|
||||
return nodeGetFreeMemoryFake(conn);
|
||||
return nodeGetFreeMemoryFake();
|
||||
}
|
||||
#endif
|
||||
|
@ -26,40 +26,34 @@
|
||||
|
||||
# include "capabilities.h"
|
||||
|
||||
int nodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo);
|
||||
int nodeGetInfo(virNodeInfoPtr nodeinfo);
|
||||
int nodeCapsInitNUMA(virCapsPtr caps);
|
||||
|
||||
int nodeGetCPUStats(virConnectPtr conn,
|
||||
int cpuNum,
|
||||
int nodeGetCPUStats(int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
int nodeGetMemoryStats(virConnectPtr conn,
|
||||
int cellNum,
|
||||
int nodeGetMemoryStats(int cellNum,
|
||||
virNodeMemoryStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
int nodeGetCellsFreeMemory(virConnectPtr conn,
|
||||
unsigned long long *freeMems,
|
||||
int nodeGetCellsFreeMemory(unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells);
|
||||
unsigned long long nodeGetFreeMemory(virConnectPtr conn);
|
||||
unsigned long long nodeGetFreeMemory(void);
|
||||
|
||||
virBitmapPtr nodeGetCPUBitmap(int *max_id);
|
||||
int nodeGetCPUCount(void);
|
||||
|
||||
int nodeGetMemoryParameters(virConnectPtr conn,
|
||||
virTypedParameterPtr params,
|
||||
int nodeGetMemoryParameters(virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
|
||||
int nodeSetMemoryParameters(virConnectPtr conn,
|
||||
virTypedParameterPtr params,
|
||||
int nodeSetMemoryParameters(virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
int nodeGetCPUMap(virConnectPtr conn,
|
||||
unsigned char **cpumap,
|
||||
int nodeGetCPUMap(unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags);
|
||||
|
||||
|
@ -684,7 +684,7 @@ openvzGetNodeCPUs(void)
|
||||
{
|
||||
virNodeInfo nodeinfo;
|
||||
|
||||
if (nodeGetInfo(NULL, &nodeinfo) < 0)
|
||||
if (nodeGetInfo(&nodeinfo) < 0)
|
||||
return 0;
|
||||
|
||||
return nodeinfo.cpus;
|
||||
|
@ -2182,6 +2182,64 @@ openvzConnectListAllDomains(virConnectPtr conn,
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
openvzNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
return nodeGetInfo(nodeinfo);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
openvzNodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUStats(cpuNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
openvzNodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cellNum,
|
||||
virNodeMemoryStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryStats(cellNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
openvzNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
return nodeGetCellsFreeMemory(freeMems, startCell, maxCells);
|
||||
}
|
||||
|
||||
|
||||
static unsigned long long
|
||||
openvzNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return nodeGetFreeMemory();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
openvzNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUMap(cpumap, online, flags);
|
||||
}
|
||||
|
||||
|
||||
static virDriver openvzDriver = {
|
||||
.no = VIR_DRV_OPENVZ,
|
||||
.name = "OPENVZ",
|
||||
@ -2191,12 +2249,12 @@ static virDriver openvzDriver = {
|
||||
.connectGetVersion = openvzConnectGetVersion, /* 0.5.0 */
|
||||
.connectGetHostname = openvzConnectGetHostname, /* 0.9.12 */
|
||||
.connectGetMaxVcpus = openvzConnectGetMaxVcpus, /* 0.4.6 */
|
||||
.nodeGetInfo = nodeGetInfo, /* 0.3.2 */
|
||||
.nodeGetCPUStats = nodeGetCPUStats, /* 0.9.12 */
|
||||
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.12 */
|
||||
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.9.12 */
|
||||
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.9.12 */
|
||||
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
|
||||
.nodeGetInfo = openvzNodeGetInfo, /* 0.3.2 */
|
||||
.nodeGetCPUStats = openvzNodeGetCPUStats, /* 0.9.12 */
|
||||
.nodeGetMemoryStats = openvzNodeGetMemoryStats, /* 0.9.12 */
|
||||
.nodeGetCellsFreeMemory = openvzNodeGetCellsFreeMemory, /* 0.9.12 */
|
||||
.nodeGetFreeMemory = openvzNodeGetFreeMemory, /* 0.9.12 */
|
||||
.nodeGetCPUMap = openvzNodeGetCPUMap, /* 1.0.0 */
|
||||
.connectGetCapabilities = openvzConnectGetCapabilities, /* 0.4.6 */
|
||||
.connectListDomains = openvzConnectListDomains, /* 0.3.1 */
|
||||
.connectNumOfDomains = openvzConnectNumOfDomains, /* 0.3.1 */
|
||||
|
@ -724,7 +724,7 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
|
||||
if (STREQ(tmp, "unlimited")) {
|
||||
virNodeInfo nodeinfo;
|
||||
|
||||
if (nodeGetInfo(NULL, &nodeinfo) < 0) {
|
||||
if (nodeGetInfo(&nodeinfo) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Can't get node info"));
|
||||
goto cleanup;
|
||||
@ -2394,6 +2394,14 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
parallelsNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
return nodeGetInfo(nodeinfo);
|
||||
}
|
||||
|
||||
|
||||
static virDriver parallelsDriver = {
|
||||
.no = VIR_DRV_PARALLELS,
|
||||
.name = "Parallels",
|
||||
@ -2401,7 +2409,7 @@ static virDriver parallelsDriver = {
|
||||
.connectClose = parallelsConnectClose, /* 0.10.0 */
|
||||
.connectGetVersion = parallelsConnectGetVersion, /* 0.10.0 */
|
||||
.connectGetHostname = parallelsConnectGetHostname, /* 0.10.0 */
|
||||
.nodeGetInfo = nodeGetInfo, /* 0.10.0 */
|
||||
.nodeGetInfo = parallelsNodeGetInfo, /* 0.10.0 */
|
||||
.connectGetCapabilities = parallelsConnectGetCapabilities, /* 0.10.0 */
|
||||
.connectListDomains = parallelsConnectListDomains, /* 0.10.0 */
|
||||
.connectNumOfDomains = parallelsConnectNumOfDomains, /* 0.10.0 */
|
||||
|
@ -838,7 +838,7 @@ virQEMUCapsInitCPU(virCapsPtr caps,
|
||||
|
||||
cpu->arch = arch;
|
||||
|
||||
if (nodeGetInfo(NULL, &nodeinfo))
|
||||
if (nodeGetInfo(&nodeinfo))
|
||||
goto error;
|
||||
|
||||
cpu->type = VIR_CPU_TYPE_HOST;
|
||||
|
@ -14702,6 +14702,83 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
return nodeGetInfo(nodeinfo);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUStats(cpuNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cellNum,
|
||||
virNodeMemoryStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryStats(cellNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
return nodeGetCellsFreeMemory(freeMems, startCell, maxCells);
|
||||
}
|
||||
|
||||
|
||||
static unsigned long long
|
||||
qemuNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return nodeGetFreeMemory();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeSetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUMap(cpumap, online, flags);
|
||||
}
|
||||
|
||||
static virDriver qemuDriver = {
|
||||
.no = VIR_DRV_QEMU,
|
||||
.name = QEMU_DRIVER_NAME,
|
||||
@ -14713,7 +14790,7 @@ static virDriver qemuDriver = {
|
||||
.connectGetHostname = qemuConnectGetHostname, /* 0.3.3 */
|
||||
.connectGetSysinfo = qemuConnectGetSysinfo, /* 0.8.8 */
|
||||
.connectGetMaxVcpus = qemuConnectGetMaxVcpus, /* 0.2.1 */
|
||||
.nodeGetInfo = nodeGetInfo, /* 0.2.0 */
|
||||
.nodeGetInfo = qemuNodeGetInfo, /* 0.2.0 */
|
||||
.connectGetCapabilities = qemuConnectGetCapabilities, /* 0.2.1 */
|
||||
.connectListDomains = qemuConnectListDomains, /* 0.2.0 */
|
||||
.connectNumOfDomains = qemuConnectNumOfDomains, /* 0.2.0 */
|
||||
@ -14794,10 +14871,10 @@ static virDriver qemuDriver = {
|
||||
.domainBlockPeek = qemuDomainBlockPeek, /* 0.4.4 */
|
||||
.domainMemoryPeek = qemuDomainMemoryPeek, /* 0.4.4 */
|
||||
.domainGetBlockInfo = qemuDomainGetBlockInfo, /* 0.8.1 */
|
||||
.nodeGetCPUStats = nodeGetCPUStats, /* 0.9.3 */
|
||||
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
|
||||
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.4.4 */
|
||||
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.4.4 */
|
||||
.nodeGetCPUStats = qemuNodeGetCPUStats, /* 0.9.3 */
|
||||
.nodeGetMemoryStats = qemuNodeGetMemoryStats, /* 0.9.3 */
|
||||
.nodeGetCellsFreeMemory = qemuNodeGetCellsFreeMemory, /* 0.4.4 */
|
||||
.nodeGetFreeMemory = qemuNodeGetFreeMemory, /* 0.4.4 */
|
||||
.connectDomainEventRegister = qemuConnectDomainEventRegister, /* 0.5.0 */
|
||||
.connectDomainEventDeregister = qemuConnectDomainEventDeregister, /* 0.5.0 */
|
||||
.domainMigratePrepare2 = qemuDomainMigratePrepare2, /* 0.5.0 */
|
||||
@ -14876,9 +14953,9 @@ static virDriver qemuDriver = {
|
||||
.domainPMSuspendForDuration = qemuDomainPMSuspendForDuration, /* 0.9.11 */
|
||||
.domainPMWakeup = qemuDomainPMWakeup, /* 0.9.11 */
|
||||
.domainGetCPUStats = qemuDomainGetCPUStats, /* 0.9.11 */
|
||||
.nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
|
||||
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
|
||||
.nodeGetMemoryParameters = qemuNodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = qemuNodeSetMemoryParameters, /* 0.10.2 */
|
||||
.nodeGetCPUMap = qemuNodeGetCPUMap, /* 1.0.0 */
|
||||
.domainFSTrim = qemuDomainFSTrim, /* 1.0.1 */
|
||||
.domainOpenChannel = qemuDomainOpenChannel, /* 1.0.2 */
|
||||
};
|
||||
|
@ -2596,6 +2596,82 @@ static int umlConnectListAllDomains(virConnectPtr conn,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
return nodeGetInfo(nodeinfo);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUStats(cpuNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
int cellNum,
|
||||
virNodeMemoryStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryStats(cellNum, params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
return nodeGetCellsFreeMemory(freeMems, startCell, maxCells);
|
||||
}
|
||||
|
||||
|
||||
static unsigned long long
|
||||
umlNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return nodeGetFreeMemory();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeSetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
umlNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetCPUMap(cpumap, online, flags);
|
||||
}
|
||||
|
||||
|
||||
static virDriver umlDriver = {
|
||||
.no = VIR_DRV_UML,
|
||||
@ -2605,7 +2681,7 @@ static virDriver umlDriver = {
|
||||
.connectGetType = umlConnectGetType, /* 0.5.0 */
|
||||
.connectGetVersion = umlConnectGetVersion, /* 0.5.0 */
|
||||
.connectGetHostname = umlConnectGetHostname, /* 0.5.0 */
|
||||
.nodeGetInfo = nodeGetInfo, /* 0.5.0 */
|
||||
.nodeGetInfo = umlNodeGetInfo, /* 0.5.0 */
|
||||
.connectGetCapabilities = umlConnectGetCapabilities, /* 0.5.0 */
|
||||
.connectListDomains = umlConnectListDomains, /* 0.5.0 */
|
||||
.connectNumOfDomains = umlConnectNumOfDomains, /* 0.5.0 */
|
||||
@ -2639,11 +2715,11 @@ static virDriver umlDriver = {
|
||||
.domainGetAutostart = umlDomainGetAutostart, /* 0.5.0 */
|
||||
.domainSetAutostart = umlDomainSetAutostart, /* 0.5.0 */
|
||||
.domainBlockPeek = umlDomainBlockPeek, /* 0.5.0 */
|
||||
.nodeGetCPUStats = nodeGetCPUStats, /* 0.9.3 */
|
||||
.nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.3 */
|
||||
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.5.0 */
|
||||
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.5.0 */
|
||||
.nodeGetCPUMap = nodeGetCPUMap, /* 1.0.0 */
|
||||
.nodeGetCPUStats = umlNodeGetCPUStats, /* 0.9.3 */
|
||||
.nodeGetMemoryStats = umlNodeGetMemoryStats, /* 0.9.3 */
|
||||
.nodeGetCellsFreeMemory = umlNodeGetCellsFreeMemory, /* 0.5.0 */
|
||||
.nodeGetFreeMemory = umlNodeGetFreeMemory, /* 0.5.0 */
|
||||
.nodeGetCPUMap = umlNodeGetCPUMap, /* 1.0.0 */
|
||||
.connectDomainEventRegister = umlConnectDomainEventRegister, /* 0.9.4 */
|
||||
.connectDomainEventDeregister = umlConnectDomainEventDeregister, /* 0.9.4 */
|
||||
.connectIsEncrypted = umlConnectIsEncrypted, /* 0.7.3 */
|
||||
@ -2656,8 +2732,8 @@ static virDriver umlDriver = {
|
||||
.domainOpenConsole = umlDomainOpenConsole, /* 0.8.6 */
|
||||
.connectIsAlive = umlConnectIsAlive, /* 0.9.8 */
|
||||
.nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
|
||||
.nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
|
||||
.nodeGetMemoryParameters = umlNodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = umlNodeSetMemoryParameters, /* 0.10.2 */
|
||||
};
|
||||
|
||||
static virStateDriver umlStateDriver = {
|
||||
|
@ -9405,6 +9405,30 @@ no_memory:
|
||||
#undef MATCH
|
||||
|
||||
|
||||
static int
|
||||
vboxNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virNodeInfoPtr nodeinfo)
|
||||
{
|
||||
return nodeGetInfo(nodeinfo);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
vboxNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
unsigned long long *freeMems,
|
||||
int startCell,
|
||||
int maxCells)
|
||||
{
|
||||
return nodeGetCellsFreeMemory(freeMems, startCell, maxCells);
|
||||
}
|
||||
|
||||
|
||||
static unsigned long long
|
||||
vboxNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return nodeGetFreeMemory();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Tables
|
||||
@ -9418,7 +9442,7 @@ virDriver NAME(Driver) = {
|
||||
.connectGetVersion = vboxConnectGetVersion, /* 0.6.3 */
|
||||
.connectGetHostname = vboxConnectGetHostname, /* 0.6.3 */
|
||||
.connectGetMaxVcpus = vboxConnectGetMaxVcpus, /* 0.6.3 */
|
||||
.nodeGetInfo = nodeGetInfo, /* 0.6.3 */
|
||||
.nodeGetInfo = vboxNodeGetInfo, /* 0.6.3 */
|
||||
.connectGetCapabilities = vboxConnectGetCapabilities, /* 0.6.3 */
|
||||
.connectListDomains = vboxConnectListDomains, /* 0.6.3 */
|
||||
.connectNumOfDomains = vboxConnectNumOfDomains, /* 0.6.3 */
|
||||
@ -9456,8 +9480,8 @@ virDriver NAME(Driver) = {
|
||||
.domainDetachDevice = vboxDomainDetachDevice, /* 0.6.3 */
|
||||
.domainDetachDeviceFlags = vboxDomainDetachDeviceFlags, /* 0.7.7 */
|
||||
.domainUpdateDeviceFlags = vboxDomainUpdateDeviceFlags, /* 0.8.0 */
|
||||
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.6.5 */
|
||||
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.6.5 */
|
||||
.nodeGetCellsFreeMemory = vboxNodeGetCellsFreeMemory, /* 0.6.5 */
|
||||
.nodeGetFreeMemory = vboxNodeGetFreeMemory, /* 0.6.5 */
|
||||
#if VBOX_API_VERSION >= 4000
|
||||
.domainScreenshot = vboxDomainScreenshot, /* 0.9.2 */
|
||||
#endif
|
||||
|
@ -2349,6 +2349,26 @@ cleanup:
|
||||
virDomainDefFree(def);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
xenUnifiedNodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeGetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
xenUnifiedNodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
return nodeSetMemoryParameters(params, nparams, flags);
|
||||
}
|
||||
|
||||
/*----- Register with libvirt.c, and initialize Xen drivers. -----*/
|
||||
|
||||
/* The interface which we export upwards to libvirt.c. */
|
||||
@ -2443,8 +2463,8 @@ static virDriver xenUnifiedDriver = {
|
||||
.domainOpenConsole = xenUnifiedDomainOpenConsole, /* 0.8.6 */
|
||||
.connectIsAlive = xenUnifiedConnectIsAlive, /* 0.9.8 */
|
||||
.nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
|
||||
.nodeGetMemoryParameters = nodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = nodeSetMemoryParameters, /* 0.10.2 */
|
||||
.nodeGetMemoryParameters = xenUnifiedNodeGetMemoryParameters, /* 0.10.2 */
|
||||
.nodeSetMemoryParameters = xenUnifiedNodeSetMemoryParameters, /* 0.10.2 */
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user