[PATCH 06/11] Separate internal node suspend 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 virnodesuspend.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 virnodesuspend.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/lxc/lxc_driver.c      | 13 ++++++++++++-
 src/qemu/qemu_driver.c    | 13 ++++++++++++-
 src/uml/uml_driver.c      | 12 +++++++++++-
 src/util/virnodesuspend.c |  3 +--
 src/util/virnodesuspend.h |  3 +--
 src/xen/xen_driver.c      | 13 ++++++++++++-
 6 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 04de015..aafbbec 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4478,6 +4478,17 @@ lxcNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
     return nodeGetCPUMap(cpumap, online, flags);
 }
 
+
+static int
+lxcNodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
+                          unsigned int target,
+                          unsigned long long duration,
+                          unsigned int flags)
+{
+    return nodeSuspendForDuration(target, duration, flags);
+}
+
+
 /* Function Tables */
 static virDriver lxcDriver = {
     .no = VIR_DRV_LXC,
@@ -4549,7 +4560,7 @@ static virDriver lxcDriver = {
     .connectDomainEventDeregisterAny = lxcConnectDomainEventDeregisterAny, /* 0.8.0 */
     .domainOpenConsole = lxcDomainOpenConsole, /* 0.8.6 */
     .connectIsAlive = lxcConnectIsAlive, /* 0.9.8 */
-    .nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
+    .nodeSuspendForDuration = lxcNodeSuspendForDuration, /* 0.9.8 */
     .nodeGetMemoryParameters = lxcNodeGetMemoryParameters, /* 0.10.2 */
     .nodeSetMemoryParameters = lxcNodeSetMemoryParameters, /* 0.10.2 */
     .domainSendProcessSignal = lxcDomainSendProcessSignal, /* 1.0.1 */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8631666..a23bc6c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14727,6 +14727,17 @@ qemuNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
     return nodeGetCPUMap(cpumap, online, flags);
 }
 
+
+static int
+qemuNodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
+                           unsigned int target,
+                           unsigned long long duration,
+                           unsigned int flags)
+{
+    return nodeSuspendForDuration(target, duration, flags);
+}
+
+
 static virDriver qemuDriver = {
     .no = VIR_DRV_QEMU,
     .name = QEMU_DRIVER_NAME,
@@ -14888,7 +14899,7 @@ static virDriver qemuDriver = {
     .domainBlockRebase = qemuDomainBlockRebase, /* 0.9.10 */
     .domainBlockCommit = qemuDomainBlockCommit, /* 1.0.0 */
     .connectIsAlive = qemuConnectIsAlive, /* 0.9.8 */
-    .nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
+    .nodeSuspendForDuration = qemuNodeSuspendForDuration, /* 0.9.8 */
     .domainSetBlockIoTune = qemuDomainSetBlockIoTune, /* 0.9.8 */
     .domainGetBlockIoTune = qemuDomainGetBlockIoTune, /* 0.9.8 */
     .domainSetNumaParameters = qemuDomainSetNumaParameters, /* 0.9.9 */
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 3658cf7..88de681 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2673,6 +2673,16 @@ umlNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
 }
 
 
+static int
+umlNodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
+                          unsigned int target,
+                          unsigned long long duration,
+                          unsigned int flags)
+{
+    return nodeSuspendForDuration(target, duration, flags);
+}
+
+
 static virDriver umlDriver = {
     .no = VIR_DRV_UML,
     .name = "UML",
@@ -2731,7 +2741,7 @@ static virDriver umlDriver = {
     .connectDomainEventDeregisterAny = umlConnectDomainEventDeregisterAny, /* 0.9.4 */
     .domainOpenConsole = umlDomainOpenConsole, /* 0.8.6 */
     .connectIsAlive = umlConnectIsAlive, /* 0.9.8 */
-    .nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
+    .nodeSuspendForDuration = umlNodeSuspendForDuration, /* 0.9.8 */
     .nodeGetMemoryParameters = umlNodeGetMemoryParameters, /* 0.10.2 */
     .nodeSetMemoryParameters = umlNodeSetMemoryParameters, /* 0.10.2 */
 };
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index df40ccd..72a17cd 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -165,8 +165,7 @@ static void virNodeSuspend(void *cmdString)
  * -1 if suspending the node is not supported, or if a previous suspend
  * operation is still in progress.
  */
-int nodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
-                           unsigned int target,
+int nodeSuspendForDuration(unsigned int target,
                            unsigned long long duration,
                            unsigned int flags)
 {
diff --git a/src/util/virnodesuspend.h b/src/util/virnodesuspend.h
index ac54015..b5f67dd 100644
--- a/src/util/virnodesuspend.h
+++ b/src/util/virnodesuspend.h
@@ -25,8 +25,7 @@
 
 # include "internal.h"
 
-int nodeSuspendForDuration(virConnectPtr conn,
-                           unsigned int target,
+int nodeSuspendForDuration(unsigned int target,
                            unsigned long long duration,
                            unsigned int flags);
 
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index d4676c9..0342523 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2369,6 +2369,17 @@ xenUnifiedNodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
     return nodeSetMemoryParameters(params, nparams, flags);
 }
 
+
+static int
+xenUnifiedNodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                 unsigned int target,
+                                 unsigned long long duration,
+                                 unsigned int flags)
+{
+    return nodeSuspendForDuration(target, duration, flags);
+}
+
+
 /*----- Register with libvirt.c, and initialize Xen drivers. -----*/
 
 /* The interface which we export upwards to libvirt.c. */
@@ -2462,7 +2473,7 @@ static virDriver xenUnifiedDriver = {
     .connectDomainEventDeregisterAny = xenUnifiedConnectDomainEventDeregisterAny, /* 0.8.0 */
     .domainOpenConsole = xenUnifiedDomainOpenConsole, /* 0.8.6 */
     .connectIsAlive = xenUnifiedConnectIsAlive, /* 0.9.8 */
-    .nodeSuspendForDuration = nodeSuspendForDuration, /* 0.9.8 */
+    .nodeSuspendForDuration = xenUnifiedNodeSuspendForDuration, /* 0.9.8 */
     .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]