Separate internal node suspend APIs from public API

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@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-04-29 10:16:56 +01:00
parent 1c6d4ca557
commit 4a044d0256
6 changed files with 49 additions and 8 deletions

View File

@ -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 */

View File

@ -14779,6 +14779,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,
@ -14940,7 +14951,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 */

View File

@ -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 */
};

View File

@ -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)
{

View File

@ -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);

View File

@ -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 */
};