[PATCH 05/11] Separate internal node device APIs from public API

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 src/check-driverimpls.pl         |  3 --
 src/lxc/lxc_driver.c             | 92 +++++++++++++++++++++++++++++++++++----
 src/nodeinfo.c                   | 42 ++++++++----------
 src/nodeinfo.h                   | 22 ++++------
 src/openvz/openvz_conf.c         |  2 +-
 src/openvz/openvz_driver.c       | 70 +++++++++++++++++++++++++++---
 src/parallels/parallels_driver.c | 12 +++++-
 src/qemu/qemu_capabilities.c     |  2 +-
 src/qemu/qemu_driver.c           | 93 ++++++++++++++++++++++++++++++++++++----
 src/uml/uml_driver.c             | 92 +++++++++++++++++++++++++++++++++++----
 src/vbox/vbox_tmpl.c             | 30 +++++++++++--
 src/xen/xen_driver.c             | 24 ++++++++++-
 12 files changed, 403 insertions(+), 81 deletions(-)

diff --git a/src/check-driverimpls.pl b/src/check-driverimpls.pl
index 52b14e4..e385de0 100755
--- a/src/check-driverimpls.pl
+++ b/src/check-driverimpls.pl
@@ -42,9 +42,6 @@ while (<>) {
             my $prefix = $impl;
             $prefix =~ s/^([a-z]+(?:Unified)?)(.*?)$/$1/;
 
-            # External impls
-            next if $prefix eq "node";
-
             if (defined $mainprefix) {
                 if ($mainprefix ne $prefix) {
                     print "$ARGV:$. Bad prefix '$prefix' for API '$api', expecting '$mainprefix'\n";
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 1475d04..04de015 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -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 */
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index a5b5608..f568a74 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -867,7 +867,7 @@ error:
 }
 #endif
 
-int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo)
+int nodeGetInfo(virNodeInfoPtr nodeinfo)
 {
     virArch hostarch = virArchFromHost();
 
@@ -941,8 +941,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)
@@ -970,8 +969,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)
@@ -1192,8 +1190,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)
 {
@@ -1288,8 +1285,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)
 {
@@ -1436,8 +1432,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)
 {
@@ -1476,7 +1471,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);
@@ -1518,8 +1513,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)
 {
@@ -1544,7 +1538,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;
@@ -1701,8 +1695,7 @@ cleanup:
 
 
 int
-nodeGetCellsFreeMemory(virConnectPtr conn,
-                       unsigned long long *freeMems,
+nodeGetCellsFreeMemory(unsigned long long *freeMems,
                        int startCell,
                        int maxCells)
 {
@@ -1711,7 +1704,7 @@ nodeGetCellsFreeMemory(virConnectPtr conn,
     int maxCell;
 
     if (numa_available() < 0)
-        return nodeGetCellsFreeMemoryFake(conn, freeMems,
+        return nodeGetCellsFreeMemoryFake(freeMems,
                                           startCell, maxCells);
 
     maxCell = numa_max_node();
@@ -1742,13 +1735,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++) {
@@ -1812,17 +1805,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
diff --git a/src/nodeinfo.h b/src/nodeinfo.h
index b0e5fbc..413fddd 100644
--- a/src/nodeinfo.h
+++ b/src/nodeinfo.h
@@ -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);
 
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index a6f96c7..f176c2d 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -684,7 +684,7 @@ openvzGetNodeCPUs(void)
 {
     virNodeInfo nodeinfo;
 
-    if (nodeGetInfo(NULL, &nodeinfo) < 0)
+    if (nodeGetInfo(&nodeinfo) < 0)
         return 0;
 
     return nodeinfo.cpus;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 9de36f4..a721472 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -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 */
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index f7e953a..7a71e17 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -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 */
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2acf535..4d99147 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -839,7 +839,7 @@ virQEMUCapsInitCPU(virCapsPtr caps,
 
     cpu->arch = arch;
 
-    if (nodeGetInfo(NULL, &nodeinfo))
+    if (nodeGetInfo(&nodeinfo))
         goto error;
 
     cpu->type = VIR_CPU_TYPE_HOST;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c42e7b7..8631666 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14650,6 +14650,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,
@@ -14661,7 +14738,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 */
@@ -14742,10 +14819,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 */
@@ -14824,9 +14901,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 */
 };
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 55cf204..3658cf7 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -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 = {
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 6112dd9..fef81b4 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -9404,6 +9404,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
@@ -9417,7 +9441,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 */
@@ -9455,8 +9479,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
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index c6164b6..d4676c9 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -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 */
 };
 
 /**
-- 
1.8.1.4

--
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]