Remove unused/no-op Xen driver code

This commit is contained in:
Daniel P. Berrange 2008-07-25 09:51:23 +00:00
parent 0b4f277845
commit d9383fe158
6 changed files with 62 additions and 304 deletions

View File

@ -1,3 +1,13 @@
Fri Jul 25 10:44:27 BST 2008 Daniel P. Berrange <berrange@redhat.com>
Remove unused/no-op code from xen drivers
* src/proxy_internal.c: Remove no-op xenProxyInit()
* src/xen_unified.c: Remove calls to no-op init functions
in sub-drivers.
* src/xend_internal.c, src/xend_internal.h: Remove misc
unused methods
* src/xs_internal.c: Remove no-op xenStoreInit()
Fri Jul 25 10:41:27 BST 2008 Daniel P. Berrange <berrange@redhat.com>
* autobuild.sh: Force enable OpenVZ, LXC and Xen proxy for

View File

@ -87,16 +87,6 @@ struct xenUnifiedDriver xenProxyDriver = {
NULL, /* domainSetSchedulerParameters */
};
/**
* xenProxyInit:
*
* Initialise the xen proxy driver.
*/
int
xenProxyInit (void)
{
return 0;
}
/************************************************************************
* *

View File

@ -1372,9 +1372,6 @@ xenUnifiedRegister (void)
{
/* Ignore failures here. */
(void) xenHypervisorInit ();
(void) xenProxyInit ();
(void) xenDaemonInit ();
(void) xenStoreInit ();
(void) xenXMInit ();
return virRegisterDriver (&xenUnifiedDriver);

View File

@ -54,23 +54,6 @@
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
#ifndef PROXY
static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
static int xenDaemonNumOfDomains(virConnectPtr conn);
static int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames);
static int xenDaemonNumOfDefinedDomains(virConnectPtr conn);
static virDomainPtr xenDaemonCreateLinux(virConnectPtr conn,
const char *xmlDesc,
unsigned int flags);
static char *xenDaemonDomainGetOSType(virDomainPtr domain);
static int xenDaemonAttachDevice(virDomainPtr domain, const char *xml);
static int xenDaemonDetachDevice(virDomainPtr domain, const char *xml);
static int xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
int flags);
static char *xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams);
static int xenDaemonGetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params, int *nparams);
static int xenDaemonSetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params, int nparams);
/*
* The number of Xen scheduler parameters
@ -80,61 +63,6 @@ static int xenDaemonSetSchedulerParameters(virDomainPtr domain,
#endif /* PROXY */
#ifndef PROXY
struct xenUnifiedDriver xenDaemonDriver = {
xenDaemonOpen, /* open */
xenDaemonClose, /* close */
xenDaemonGetVersion, /* version */
NULL, /* hostname */
NULL, /* URI */
xenDaemonNodeGetInfo, /* nodeGetInfo */
NULL, /* getCapabilities */
xenDaemonListDomains, /* listDomains */
xenDaemonNumOfDomains, /* numOfDomains */
xenDaemonCreateLinux, /* domainCreateLinux */
xenDaemonDomainSuspend, /* domainSuspend */
xenDaemonDomainResume, /* domainResume */
xenDaemonDomainShutdown, /* domainShutdown */
xenDaemonDomainReboot, /* domainReboot */
xenDaemonDomainDestroy, /* domainDestroy */
xenDaemonDomainGetOSType, /* domainGetOSType */
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
xenDaemonDomainSetMemory, /* domainMaxMemory */
xenDaemonDomainGetInfo, /* domainGetInfo */
xenDaemonDomainSave, /* domainSave */
xenDaemonDomainRestore, /* domainRestore */
xenDaemonDomainCoreDump, /* domainCoreDump */
xenDaemonDomainSetVcpus, /* domainSetVcpus */
xenDaemonDomainPinVcpu, /* domainPinVcpu */
xenDaemonDomainGetVcpus, /* domainGetVcpus */
NULL, /* domainGetMaxVcpus */
xenDaemonListDefinedDomains, /* listDefinedDomains */
xenDaemonNumOfDefinedDomains, /* numOfDefinedDomains */
xenDaemonDomainCreate, /* domainCreate */
xenDaemonDomainDefineXML, /* domainDefineXML */
xenDaemonDomainUndefine, /* domainUndefine */
xenDaemonAttachDevice, /* domainAttachDevice */
xenDaemonDetachDevice, /* domainDetachDevice */
xenDaemonDomainGetAutostart, /* domainGetAutostart */
xenDaemonDomainSetAutostart, /* domainSetAutostart */
xenDaemonGetSchedulerType, /* domainGetSchedulerType */
xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
};
/**
* xenDaemonInit:
*
* Initialise the xenDaemon driver.
*/
int
xenDaemonInit (void)
{
return 0;
}
#endif /* !PROXY */
/**
* xend_connection_type:
*
@ -214,16 +142,6 @@ virXendErrorInt(virConnectPtr conn, virErrorNumber error, int val)
errmsg, NULL, NULL, val, 0, errmsg, val);
}
#define foreach(iterator, start) \
for (_for_i = (start), *iterator = (start)->u.s.car; \
_for_i->kind == SEXPR_CONS; \
_for_i = _for_i->u.s.cdr, iterator = _for_i->u.s.car)
#define foreach_node(iterator, start, path) \
foreach(iterator, start) \
if (sexpr_lookup(iterator, path))
/**
* do_connect:
* @xend: pointer to the Xen Daemon structure
@ -608,7 +526,7 @@ http2unix(virConnectPtr xend, int ret)
#ifndef PROXY
/**
* xend_op_ext2:
* xend_op_ext:
* @xend: pointer to the Xen Daemon structure
* @path: path for the object
* @error: buffer for the error output
@ -621,8 +539,8 @@ http2unix(virConnectPtr xend, int ret)
* Returns 0 in case of success, -1 in case of failure.
*/
static int
xend_op_ext2(virConnectPtr xend, const char *path, char *error,
size_t n_error, const char *key, va_list ap)
xend_op_ext(virConnectPtr xend, const char *path, char *error,
size_t n_error, const char *key, va_list ap)
{
const char *k = key, *v;
virBuffer buf = VIR_BUFFER_INITIALIZER;
@ -655,33 +573,7 @@ xend_op_ext2(virConnectPtr xend, const char *path, char *error,
/**
* xend_node_op:
* @xend: pointer to the Xen Daemon structure
* @path: path for the object
* @key: the key for the operation
* @...: input values to pass to the operation
*
* internal routine to run a POST RPC operation to the Xen Daemon
*
* Returns 0 in case of success, -1 in case of failure.
*/
static int
xend_node_op(virConnectPtr xend, const char *path, const char *key, ...)
{
va_list ap;
int ret;
char error[1024];
va_start(ap, key);
ret = xend_op_ext2(xend, path, error, sizeof(error), key, ap);
va_end(ap);
return ret;
}
/**
* xend_op_ext:
* xend_op:
* @xend: pointer to the Xen Daemon structure
* @name: the domain name target of this operation
* @error: buffer for the error output
@ -706,7 +598,7 @@ xend_op(virConnectPtr xend, const char *name, const char *key, ...)
snprintf(buffer, sizeof(buffer), "/xend/domain/%s", name);
va_start(ap, key);
ret = xend_op_ext2(xend, buffer, error, sizeof(error), key, ap);
ret = xend_op_ext(xend, buffer, error, sizeof(error), key, ap);
va_end(ap);
return ret;
@ -1027,7 +919,7 @@ xenDaemonOpen_unix(virConnectPtr conn, const char *path)
*
* Returns 0 in case of success, -1 in case of error.
*/
int
static int
xenDaemonOpen_tcp(virConnectPtr conn, const char *host, int port)
{
struct in_addr ip;
@ -1309,83 +1201,6 @@ xend_detect_config_version(virConnectPtr conn) {
return (0);
}
/**
* xend_node_shutdown:
* @xend: A xend instance
*
* This method shuts down the physical machine running Xen.
*
* Returns 0 on success; -1 (with errno) on error
*/
int
xend_node_shutdown(virConnectPtr xend)
{
return xend_node_op(xend, "/xend/node/", "op", "halt", NULL);
}
/**
* xend_node_restart:
* @xend: A xend instance
*
* This method restarts the physical machine running Xen.
*
* Returns 0 on success; -1 (with errno) on error
*/
int
xend_node_restart(virConnectPtr xend)
{
return xend_node_op(xend, "/xend/node/", "op", "restart", NULL);
}
/**
* xend_dmesg:
* @xend: A xend instance
* @buffer: A buffer to hold the messages
* @n_buffer: Size of buffer (including null terminator)
*
* This function will place the debugging messages from the
* hypervisor into a buffer with a null terminator.
*
* Returns 0 on success; -1 (with errno) on error
*/
int
xend_dmesg(virConnectPtr xend, char *buffer, size_t n_buffer)
{
return http2unix(xend, xend_get(xend, "/xend/node/dmesg", buffer, n_buffer));
}
/**
* xend_dmesg_clear:
* @xend: A xend instance
*
* This function will clear the debugging message ring queue
* in the hypervisor.
*
* Returns 0 on success; -1 (with errno) on error
*/
int
xend_dmesg_clear(virConnectPtr xend)
{
return xend_node_op(xend, "/xend/node/dmesg", "op", "clear", NULL);
}
/**
* xend_log:
* @xend: A xend instance
* @buffer: The buffer to hold the messages
* @n_buffer: Size of buffer (including null terminator)
*
* This function will place the Xend debugging messages into
* a buffer with a null terminator.
*
* Returns 0 on success; -1 (with errno) on error
*/
int
xend_log(virConnectPtr xend, char *buffer, size_t n_buffer)
{
return http2unix(xend, xend_get(xend, "/xend/node/log", buffer, n_buffer));
}
#endif /* PROXY */
/*****************************************************************
@ -4213,7 +4028,8 @@ error:
return(ret);
}
int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
static int
xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
struct sexpr *root = NULL;
int ret = -1;
struct sexpr *_for_i, *node;
@ -4631,5 +4447,47 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
return ret;
}
struct xenUnifiedDriver xenDaemonDriver = {
xenDaemonOpen, /* open */
xenDaemonClose, /* close */
xenDaemonGetVersion, /* version */
NULL, /* hostname */
NULL, /* URI */
xenDaemonNodeGetInfo, /* nodeGetInfo */
NULL, /* getCapabilities */
xenDaemonListDomains, /* listDomains */
xenDaemonNumOfDomains, /* numOfDomains */
xenDaemonCreateLinux, /* domainCreateLinux */
xenDaemonDomainSuspend, /* domainSuspend */
xenDaemonDomainResume, /* domainResume */
xenDaemonDomainShutdown, /* domainShutdown */
xenDaemonDomainReboot, /* domainReboot */
xenDaemonDomainDestroy, /* domainDestroy */
xenDaemonDomainGetOSType, /* domainGetOSType */
xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
xenDaemonDomainSetMemory, /* domainMaxMemory */
xenDaemonDomainGetInfo, /* domainGetInfo */
xenDaemonDomainSave, /* domainSave */
xenDaemonDomainRestore, /* domainRestore */
xenDaemonDomainCoreDump, /* domainCoreDump */
xenDaemonDomainSetVcpus, /* domainSetVcpus */
xenDaemonDomainPinVcpu, /* domainPinVcpu */
xenDaemonDomainGetVcpus, /* domainGetVcpus */
NULL, /* domainGetMaxVcpus */
xenDaemonListDefinedDomains, /* listDefinedDomains */
xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
xenDaemonDomainCreate, /* domainCreate */
xenDaemonDomainDefineXML, /* domainDefineXML */
xenDaemonDomainUndefine, /* domainUndefine */
xenDaemonAttachDevice, /* domainAttachDevice */
xenDaemonDetachDevice, /* domainDetachDevice */
xenDaemonDomainGetAutostart, /* domainGetAutostart */
xenDaemonDomainSetAutostart, /* domainSetAutostart */
xenDaemonGetSchedulerType, /* domainGetSchedulerType */
xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
};
#endif /* ! PROXY */
#endif /* WITH_XEN */

View File

@ -26,33 +26,8 @@
extern "C" {
#endif
/**
* \brief Setup the connection to a xend instance via TCP
* \param host The host name to connect to
* \param port The port number to connect to
* \return 0 in case of success, -1 in case of error
*
* This method creates a new Xend instance via TCP.
*
* This function may not fail if Xend is not running.
*
* Make sure to call xenDaemonClose().
*/
int xenDaemonOpen_tcp(virConnectPtr xend, const char *host, int port);
/**
* \brief Setup the connection to xend instance via a Unix domain socket
* \param path The path to the domain socket
* \return 0 in case of success, -1 in case of error
*
* This method creates a new xend instance via a Unix domain socket.
*
* This function may not fail if Xend is not running.
*
* Make sure to call xenDaemonClose().
*/
int xenDaemonOpen_unix(virConnectPtr xend, const char *path);
int
xenDaemonOpen_unix(virConnectPtr conn, const char *path);
/**
* \brief Blocks until a domain's devices are initialized
@ -118,68 +93,6 @@ char *xenDaemonDomainDumpXMLByName(virConnectPtr xend,
int flags,
const char *cpus);
/**
* \brief Lookup information about the host machine
* \param xend A xend instance
* \return node info on success; NULL (with errno) on error
*
* This method returns information about the physical host
* machine running Xen.
*/
struct xend_node *xend_get_node(virConnectPtr xend);
/**
* \brief Shutdown physical host machine
* \param xend A xend instance
* \return 0 on success; -1 (with errno) on error
*
* This method shuts down the physical machine running Xen.
*/
int xend_node_shutdown(virConnectPtr xend);
/**
* \brief Restarts physical host machine
* \param xend A xend instance
* \return 0 on success; -1 (with errno) on error
*
* This method restarts the physical machine running Xen.
*/
int xend_node_restart(virConnectPtr xend);
/**
* \brief Return hypervisor debugging messages
* \param xend A xend instance
* \param buffer A buffer to hold the messages
* \param n_buffer Size of buffer (including null terminator)
* \return 0 on success; -1 (with errno) on error
*
* This function will place the debugging messages from the
* hypervisor into a buffer with a null terminator.
*/
int xend_dmesg(virConnectPtr xend, char *buffer, size_t n_buffer);
/**
* \brief Clear the hypervisor debugging messages
* \param xend A xend instance
* \return 0 on success; -1 (with errno) on error
*
* This function will clear the debugging message ring queue
* in the hypervisor.
*/
int xend_dmesg_clear(virConnectPtr xend);
/**
* \brief Obtain the Xend log messages
* \param xend A xend instance
* \param buffer The buffer to hold the messages
* \param n_buffer Size of buffer (including null terminator)
* \return 0 on success; -1 (with errno) on error
*
* This function will place the Xend debugging messages into
* a buffer with a null terminator.
*/
int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
int xend_parse_sexp_desc_char(virConnectPtr conn,
virBufferPtr buf,
const char *devtype,

View File

@ -86,16 +86,6 @@ struct xenUnifiedDriver xenStoreDriver = {
NULL, /* domainSetSchedulerParameters */
};
/**
* xenStoreInit:
*
* Initialisation.
*/
int
xenStoreInit ()
{
return 0;
}
#endif /* ! PROXY */
/**