Simplify opening of Xen drivers
Since the Xen driver was changed to only execute inside libvirtd, there is no scenario in which it will be opened from a non-privileged context. Thus all the code dealing with opening the sub-drivers can be simplified to assume that they are always privileged. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
71d7b20b3b
commit
61b7a872cc
@ -86,14 +86,9 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
|
|||||||
[XEN_UNIFIED_XEND_OFFSET] = &xenDaemonDriver,
|
[XEN_UNIFIED_XEND_OFFSET] = &xenDaemonDriver,
|
||||||
[XEN_UNIFIED_XS_OFFSET] = &xenStoreDriver,
|
[XEN_UNIFIED_XS_OFFSET] = &xenStoreDriver,
|
||||||
[XEN_UNIFIED_XM_OFFSET] = &xenXMDriver,
|
[XEN_UNIFIED_XM_OFFSET] = &xenXMDriver,
|
||||||
#if WITH_XEN_INOTIFY
|
|
||||||
[XEN_UNIFIED_INOTIFY_OFFSET] = &xenInotifyDriver,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined WITH_LIBVIRTD || defined __sun
|
static bool is_privileged = false;
|
||||||
static bool inside_daemon = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenNumaInit:
|
* xenNumaInit:
|
||||||
@ -200,14 +195,14 @@ done:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_LIBVIRTD
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedStateInitialize(bool privileged ATTRIBUTE_UNUSED,
|
xenUnifiedStateInitialize(bool privileged,
|
||||||
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
||||||
void *opaque ATTRIBUTE_UNUSED)
|
void *opaque ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
inside_daemon = true;
|
/* Don't allow driver to work in non-root libvirtd */
|
||||||
|
if (privileged)
|
||||||
|
is_privileged = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,8 +211,6 @@ static virStateDriver state_driver = {
|
|||||||
.stateInitialize = xenUnifiedStateInitialize,
|
.stateInitialize = xenUnifiedStateInitialize,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*----- Dispatch functions. -----*/
|
/*----- Dispatch functions. -----*/
|
||||||
|
|
||||||
/* These dispatch functions follow the model used historically
|
/* These dispatch functions follow the model used historically
|
||||||
@ -298,18 +291,15 @@ xenDomainXMLConfInit(void)
|
|||||||
static virDrvOpenStatus
|
static virDrvOpenStatus
|
||||||
xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
|
xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
|
||||||
{
|
{
|
||||||
int i, ret = VIR_DRV_OPEN_DECLINED;
|
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
char ebuf[1024];
|
char ebuf[1024];
|
||||||
|
|
||||||
#ifdef __sun
|
|
||||||
/*
|
/*
|
||||||
* Only the libvirtd instance can open this driver.
|
* Only the libvirtd instance can open this driver.
|
||||||
* Everything else falls back to the remote driver.
|
* Everything else falls back to the remote driver.
|
||||||
*/
|
*/
|
||||||
if (!inside_daemon)
|
if (!is_privileged)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
if (!xenUnifiedProbe())
|
if (!xenUnifiedProbe())
|
||||||
@ -379,110 +369,108 @@ xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int f
|
|||||||
priv->xshandle = NULL;
|
priv->xshandle = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Hypervisor is only run with privilege & required to succeed */
|
/* Hypervisor required to succeed */
|
||||||
if (xenHavePrivilege()) {
|
VIR_DEBUG("Trying hypervisor sub-driver");
|
||||||
VIR_DEBUG("Trying hypervisor sub-driver");
|
if (xenHypervisorOpen(conn, auth, flags) < 0)
|
||||||
if (xenHypervisorOpen(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) {
|
goto error;
|
||||||
VIR_DEBUG("Activated hypervisor sub-driver");
|
VIR_DEBUG("Activated hypervisor sub-driver");
|
||||||
priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] = 1;
|
priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] = 1;
|
||||||
} else {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XenD is required to succeed if privileged */
|
/* XenD is required to succeed */
|
||||||
VIR_DEBUG("Trying XenD sub-driver");
|
VIR_DEBUG("Trying XenD sub-driver");
|
||||||
if (xenDaemonOpen(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) {
|
if (xenDaemonOpen(conn, auth, flags) < 0)
|
||||||
VIR_DEBUG("Activated XenD sub-driver");
|
goto error;
|
||||||
priv->opened[XEN_UNIFIED_XEND_OFFSET] = 1;
|
VIR_DEBUG("Activated XenD sub-driver");
|
||||||
|
priv->opened[XEN_UNIFIED_XEND_OFFSET] = 1;
|
||||||
|
|
||||||
/* XenD is active, so try the xm & xs drivers too, both requird to
|
/* For old XenD, the XM driver is required to succeed */
|
||||||
* succeed if root, optional otherwise */
|
if (priv->xendConfigVersion <= XEND_CONFIG_VERSION_3_0_3) {
|
||||||
if (priv->xendConfigVersion <= XEND_CONFIG_VERSION_3_0_3) {
|
VIR_DEBUG("Trying XM sub-driver");
|
||||||
VIR_DEBUG("Trying XM sub-driver");
|
if (xenXMOpen(conn, auth, flags) < 0)
|
||||||
if (xenXMOpen(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) {
|
goto error;
|
||||||
VIR_DEBUG("Activated XM sub-driver");
|
VIR_DEBUG("Activated XM sub-driver");
|
||||||
priv->opened[XEN_UNIFIED_XM_OFFSET] = 1;
|
priv->opened[XEN_UNIFIED_XM_OFFSET] = 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
VIR_DEBUG("Trying XS sub-driver");
|
|
||||||
if (xenStoreOpen(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) {
|
|
||||||
VIR_DEBUG("Activated XS sub-driver");
|
|
||||||
priv->opened[XEN_UNIFIED_XS_OFFSET] = 1;
|
|
||||||
} else {
|
|
||||||
if (xenHavePrivilege())
|
|
||||||
goto fail; /* XS is mandatory when privileged */
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (xenHavePrivilege()) {
|
|
||||||
goto fail; /* XenD is mandatory when privileged */
|
|
||||||
} else {
|
|
||||||
VIR_DEBUG("Handing off for remote driver");
|
|
||||||
ret = VIR_DRV_OPEN_DECLINED; /* Let remote_driver try instead */
|
|
||||||
goto clean;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("Trying XS sub-driver");
|
||||||
|
if (xenStoreOpen(conn, auth, flags) < 0)
|
||||||
|
goto error;
|
||||||
|
VIR_DEBUG("Activated XS sub-driver");
|
||||||
|
priv->opened[XEN_UNIFIED_XS_OFFSET] = 1;
|
||||||
|
|
||||||
xenNumaInit(conn);
|
xenNumaInit(conn);
|
||||||
|
|
||||||
if (!(priv->caps = xenHypervisorMakeCapabilities(conn))) {
|
if (!(priv->caps = xenHypervisorMakeCapabilities(conn))) {
|
||||||
VIR_DEBUG("Failed to make capabilities");
|
VIR_DEBUG("Failed to make capabilities");
|
||||||
goto fail;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(priv->xmlopt = xenDomainXMLConfInit()))
|
if (!(priv->xmlopt = xenDomainXMLConfInit()))
|
||||||
goto fail;
|
goto error;
|
||||||
|
|
||||||
#if WITH_XEN_INOTIFY
|
#if WITH_XEN_INOTIFY
|
||||||
if (xenHavePrivilege()) {
|
VIR_DEBUG("Trying Xen inotify sub-driver");
|
||||||
VIR_DEBUG("Trying Xen inotify sub-driver");
|
if (xenInotifyOpen(conn, auth, flags) < 0)
|
||||||
if (xenInotifyOpen(conn, auth, flags) == VIR_DRV_OPEN_SUCCESS) {
|
goto error;
|
||||||
VIR_DEBUG("Activated Xen inotify sub-driver");
|
VIR_DEBUG("Activated Xen inotify sub-driver");
|
||||||
priv->opened[XEN_UNIFIED_INOTIFY_OFFSET] = 1;
|
priv->opened[XEN_UNIFIED_INOTIFY_OFFSET] = 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(priv->saveDir = strdup(XEN_SAVE_DIR))) {
|
if (!(priv->saveDir = strdup(XEN_SAVE_DIR))) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto fail;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virFileMakePath(priv->saveDir) < 0) {
|
if (virFileMakePath(priv->saveDir) < 0) {
|
||||||
VIR_ERROR(_("Failed to create save dir '%s': %s"), priv->saveDir,
|
VIR_ERROR(_("Errored to create save dir '%s': %s"), priv->saveDir,
|
||||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||||
goto fail;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
|
|
||||||
fail:
|
error:
|
||||||
ret = VIR_DRV_OPEN_ERROR;
|
|
||||||
clean:
|
|
||||||
VIR_DEBUG("Failed to activate a mandatory sub-driver");
|
VIR_DEBUG("Failed to activate a mandatory sub-driver");
|
||||||
for (i = 0 ; i < XEN_UNIFIED_NR_DRIVERS ; i++)
|
#if WITH_XEN_INOTIFY
|
||||||
if (priv->opened[i])
|
if (priv->opened[XEN_UNIFIED_INOTIFY_OFFSET])
|
||||||
drivers[i]->xenClose(conn);
|
xenInotifyClose(conn);
|
||||||
|
#endif
|
||||||
|
if (priv->opened[XEN_UNIFIED_XM_OFFSET])
|
||||||
|
xenXMClose(conn);
|
||||||
|
if (priv->opened[XEN_UNIFIED_XS_OFFSET])
|
||||||
|
xenStoreClose(conn);
|
||||||
|
if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
|
||||||
|
xenDaemonClose(conn);
|
||||||
|
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
|
||||||
|
xenHypervisorClose(conn);
|
||||||
virMutexDestroy(&priv->lock);
|
virMutexDestroy(&priv->lock);
|
||||||
VIR_FREE(priv->saveDir);
|
VIR_FREE(priv->saveDir);
|
||||||
VIR_FREE(priv);
|
VIR_FREE(priv);
|
||||||
conn->privateData = NULL;
|
conn->privateData = NULL;
|
||||||
return ret;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedConnectClose(virConnectPtr conn)
|
xenUnifiedConnectClose(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
int i;
|
|
||||||
|
|
||||||
virObjectUnref(priv->caps);
|
virObjectUnref(priv->caps);
|
||||||
virObjectUnref(priv->xmlopt);
|
virObjectUnref(priv->xmlopt);
|
||||||
virDomainEventStateFree(priv->domainEvents);
|
virDomainEventStateFree(priv->domainEvents);
|
||||||
|
|
||||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
#if WITH_XEN_INOTIFY
|
||||||
if (priv->opened[i])
|
if (priv->opened[XEN_UNIFIED_INOTIFY_OFFSET])
|
||||||
drivers[i]->xenClose(conn);
|
xenInotifyClose(conn);
|
||||||
|
#endif
|
||||||
|
if (priv->opened[XEN_UNIFIED_XM_OFFSET])
|
||||||
|
xenXMClose(conn);
|
||||||
|
if (priv->opened[XEN_UNIFIED_XS_OFFSET])
|
||||||
|
xenStoreClose(conn);
|
||||||
|
if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
|
||||||
|
xenDaemonClose(conn);
|
||||||
|
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
|
||||||
|
xenHypervisorClose(conn);
|
||||||
|
|
||||||
VIR_FREE(priv->saveDir);
|
VIR_FREE(priv->saveDir);
|
||||||
virMutexDestroy(&priv->lock);
|
virMutexDestroy(&priv->lock);
|
||||||
@ -2485,9 +2473,7 @@ static virDriver xenUnifiedDriver = {
|
|||||||
int
|
int
|
||||||
xenRegister(void)
|
xenRegister(void)
|
||||||
{
|
{
|
||||||
#ifdef WITH_LIBVIRTD
|
|
||||||
if (virRegisterStateDriver(&state_driver) == -1) return -1;
|
if (virRegisterStateDriver(&state_driver) == -1) return -1;
|
||||||
#endif
|
|
||||||
|
|
||||||
return virRegisterDriver(&xenUnifiedDriver);
|
return virRegisterDriver(&xenUnifiedDriver);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ extern int xenRegister (void);
|
|||||||
* structure with direct calls in xen_unified.c.
|
* structure with direct calls in xen_unified.c.
|
||||||
*/
|
*/
|
||||||
struct xenUnifiedDriver {
|
struct xenUnifiedDriver {
|
||||||
virDrvConnectClose xenClose; /* Only mandatory callback; all others may be NULL */
|
|
||||||
virDrvConnectGetVersion xenVersion;
|
virDrvConnectGetVersion xenVersion;
|
||||||
virDrvConnectGetHostname xenGetHostname;
|
virDrvConnectGetHostname xenGetHostname;
|
||||||
virDrvDomainSuspend xenDomainSuspend;
|
virDrvDomainSuspend xenDomainSuspend;
|
||||||
|
@ -880,7 +880,6 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
|
|||||||
static unsigned long long xenHypervisorGetMaxMemory(virDomainPtr domain);
|
static unsigned long long xenHypervisorGetMaxMemory(virDomainPtr domain);
|
||||||
|
|
||||||
struct xenUnifiedDriver xenHypervisorDriver = {
|
struct xenUnifiedDriver xenHypervisorDriver = {
|
||||||
.xenClose = xenHypervisorClose,
|
|
||||||
.xenVersion = xenHypervisorGetVersion,
|
.xenVersion = xenHypervisorGetVersion,
|
||||||
.xenDomainSuspend = xenHypervisorPauseDomain,
|
.xenDomainSuspend = xenHypervisorPauseDomain,
|
||||||
.xenDomainResume = xenHypervisorResumeDomain,
|
.xenDomainResume = xenHypervisorResumeDomain,
|
||||||
@ -2184,7 +2183,7 @@ VIR_ONCE_GLOBAL_INIT(xenHypervisor)
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error.
|
* Returns 0 or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
virDrvOpenStatus
|
int
|
||||||
xenHypervisorOpen(virConnectPtr conn,
|
xenHypervisorOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -2192,10 +2191,10 @@ xenHypervisorOpen(virConnectPtr conn,
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, -1);
|
||||||
|
|
||||||
if (xenHypervisorInitialize() < 0)
|
if (xenHypervisorInitialize() < 0)
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return -1;
|
||||||
|
|
||||||
priv->handle = -1;
|
priv->handle = -1;
|
||||||
|
|
||||||
@ -2207,7 +2206,7 @@ xenHypervisorOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
priv->handle = ret;
|
priv->handle = ret;
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ virDomainPtr
|
|||||||
char *
|
char *
|
||||||
xenHypervisorDomainGetOSType (virDomainPtr dom);
|
xenHypervisorDomainGetOSType (virDomainPtr dom);
|
||||||
|
|
||||||
virDrvOpenStatus
|
int
|
||||||
xenHypervisorOpen (virConnectPtr conn,
|
xenHypervisorOpen (virConnectPtr conn,
|
||||||
virConnectAuthPtr auth,
|
virConnectAuthPtr auth,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
@ -44,10 +44,6 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY
|
#define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY
|
||||||
|
|
||||||
struct xenUnifiedDriver xenInotifyDriver = {
|
|
||||||
.xenClose = xenInotifyClose,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenInotifyXenCacheLookup(virConnectPtr conn,
|
xenInotifyXenCacheLookup(virConnectPtr conn,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
@ -349,7 +345,7 @@ cleanup:
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error.
|
* Returns 0 or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
virDrvOpenStatus
|
int
|
||||||
xenInotifyOpen(virConnectPtr conn,
|
xenInotifyOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -359,7 +355,7 @@ xenInotifyOpen(virConnectPtr conn,
|
|||||||
char *path;
|
char *path;
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, -1);
|
||||||
|
|
||||||
if (priv->configDir) {
|
if (priv->configDir) {
|
||||||
priv->useXenConfigCache = 1;
|
priv->useXenConfigCache = 1;
|
||||||
|
@ -24,13 +24,10 @@
|
|||||||
# define __VIR_XEN_INOTIFY_H__
|
# define __VIR_XEN_INOTIFY_H__
|
||||||
|
|
||||||
# include "internal.h"
|
# include "internal.h"
|
||||||
# include "driver.h"
|
|
||||||
|
|
||||||
extern struct xenUnifiedDriver xenInotifyDriver;
|
int xenInotifyOpen(virConnectPtr conn,
|
||||||
|
virConnectAuthPtr auth,
|
||||||
virDrvOpenStatus xenInotifyOpen (virConnectPtr conn,
|
unsigned int flags);
|
||||||
virConnectAuthPtr auth,
|
int xenInotifyClose(virConnectPtr conn);
|
||||||
unsigned int flags);
|
|
||||||
int xenInotifyClose (virConnectPtr conn);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1231,15 +1231,15 @@ error:
|
|||||||
*
|
*
|
||||||
* Returns 0 in case of success, -1 in case of error.
|
* Returns 0 in case of success, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
virDrvOpenStatus
|
int
|
||||||
xenDaemonOpen(virConnectPtr conn,
|
xenDaemonOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
char *port = NULL;
|
char *port = NULL;
|
||||||
int ret = VIR_DRV_OPEN_ERROR;
|
int ret = -1;
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, -1);
|
||||||
|
|
||||||
/* Switch on the scheme, which we expect to be NULL (file),
|
/* Switch on the scheme, which we expect to be NULL (file),
|
||||||
* "http" or "xen".
|
* "http" or "xen".
|
||||||
@ -1286,7 +1286,7 @@ xenDaemonOpen(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
ret = VIR_DRV_OPEN_SUCCESS;
|
ret = 0;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
VIR_FREE(port);
|
VIR_FREE(port);
|
||||||
@ -3652,7 +3652,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct xenUnifiedDriver xenDaemonDriver = {
|
struct xenUnifiedDriver xenDaemonDriver = {
|
||||||
.xenClose = xenDaemonClose,
|
|
||||||
.xenVersion = xenDaemonGetVersion,
|
.xenVersion = xenDaemonGetVersion,
|
||||||
.xenDomainSuspend = xenDaemonDomainSuspend,
|
.xenDomainSuspend = xenDaemonDomainSuspend,
|
||||||
.xenDomainResume = xenDaemonDomainResume,
|
.xenDomainResume = xenDaemonDomainResume,
|
||||||
|
@ -95,8 +95,8 @@ xenDaemonDomainFetch(virConnectPtr xend,
|
|||||||
|
|
||||||
|
|
||||||
/* refactored ones */
|
/* refactored ones */
|
||||||
virDrvOpenStatus xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
int xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int xenDaemonClose(virConnectPtr conn);
|
int xenDaemonClose(virConnectPtr conn);
|
||||||
int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer);
|
int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer);
|
||||||
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
||||||
|
@ -81,7 +81,6 @@ static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
#define XM_XML_ERROR "Invalid xml"
|
#define XM_XML_ERROR "Invalid xml"
|
||||||
|
|
||||||
struct xenUnifiedDriver xenXMDriver = {
|
struct xenUnifiedDriver xenXMDriver = {
|
||||||
.xenClose = xenXMClose,
|
|
||||||
.xenDomainGetMaxMemory = xenXMDomainGetMaxMemory,
|
.xenDomainGetMaxMemory = xenXMDomainGetMaxMemory,
|
||||||
.xenDomainSetMaxMemory = xenXMDomainSetMaxMemory,
|
.xenDomainSetMaxMemory = xenXMDomainSetMaxMemory,
|
||||||
.xenDomainSetMemory = xenXMDomainSetMemory,
|
.xenDomainSetMemory = xenXMDomainSetMemory,
|
||||||
@ -419,14 +418,14 @@ xenXMConfigCacheRefresh(virConnectPtr conn)
|
|||||||
* us watch for changes (see separate driver), otherwise we poll
|
* us watch for changes (see separate driver), otherwise we poll
|
||||||
* every few seconds
|
* every few seconds
|
||||||
*/
|
*/
|
||||||
virDrvOpenStatus
|
int
|
||||||
xenXMOpen(virConnectPtr conn,
|
xenXMOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, -1);
|
||||||
|
|
||||||
priv->configDir = XM_CONFIG_DIR;
|
priv->configDir = XM_CONFIG_DIR;
|
||||||
|
|
||||||
|
@ -36,8 +36,7 @@ int xenXMConfigCacheRefresh (virConnectPtr conn);
|
|||||||
int xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename);
|
int xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename);
|
||||||
int xenXMConfigCacheRemoveFile(virConnectPtr conn, const char *filename);
|
int xenXMConfigCacheRemoveFile(virConnectPtr conn, const char *filename);
|
||||||
|
|
||||||
virDrvOpenStatus xenXMOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
int xenXMOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags);
|
||||||
unsigned int flags);
|
|
||||||
int xenXMClose(virConnectPtr conn);
|
int xenXMClose(virConnectPtr conn);
|
||||||
const char *xenXMGetType(virConnectPtr conn);
|
const char *xenXMGetType(virConnectPtr conn);
|
||||||
int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
|
int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
|
||||||
|
@ -58,7 +58,6 @@ static void xenStoreWatchEvent(int watch, int fd, int events, void *data);
|
|||||||
static void xenStoreWatchListFree(xenStoreWatchListPtr list);
|
static void xenStoreWatchListFree(xenStoreWatchListPtr list);
|
||||||
|
|
||||||
struct xenUnifiedDriver xenStoreDriver = {
|
struct xenUnifiedDriver xenStoreDriver = {
|
||||||
.xenClose = xenStoreClose,
|
|
||||||
.xenDomainShutdown = xenStoreDomainShutdown,
|
.xenDomainShutdown = xenStoreDomainShutdown,
|
||||||
.xenDomainReboot = xenStoreDomainReboot,
|
.xenDomainReboot = xenStoreDomainReboot,
|
||||||
.xenDomainGetOSType = xenStoreDomainGetOSType,
|
.xenDomainGetOSType = xenStoreDomainGetOSType,
|
||||||
@ -218,14 +217,14 @@ virDomainGetVMInfo(virDomainPtr domain, const char *vm, const char *name)
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error.
|
* Returns 0 or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
virDrvOpenStatus
|
int
|
||||||
xenStoreOpen(virConnectPtr conn,
|
xenStoreOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, -1);
|
||||||
|
|
||||||
if (flags & VIR_CONNECT_RO)
|
if (flags & VIR_CONNECT_RO)
|
||||||
priv->xshandle = xs_daemon_open_readonly();
|
priv->xshandle = xs_daemon_open_readonly();
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
extern struct xenUnifiedDriver xenStoreDriver;
|
extern struct xenUnifiedDriver xenStoreDriver;
|
||||||
int xenStoreInit (void);
|
int xenStoreInit (void);
|
||||||
|
|
||||||
virDrvOpenStatus xenStoreOpen (virConnectPtr conn,
|
int xenStoreOpen (virConnectPtr conn,
|
||||||
virConnectAuthPtr auth,
|
virConnectAuthPtr auth,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int xenStoreClose (virConnectPtr conn);
|
int xenStoreClose (virConnectPtr conn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user