- if (!uri->scheme && name[0] != '/') { - xmlFreeURI(uri); + if (!uri->scheme || !uri->path || uri->path[0] != '/') return VIR_DRV_OPEN_DECLINED; - } Attached is an updated patch which just fixes that test. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Index: src/driver.h =================================================================== RCS file: /data/cvs/libvirt/src/driver.h,v retrieving revision 1.38 diff -u -p -r1.38 driver.h --- src/driver.h 15 Oct 2007 21:38:56 -0000 1.38 +++ src/driver.h 16 Oct 2007 10:24:37 -0000 @@ -9,6 +9,8 @@ #include "libvirt/libvirt.h" #include "libvirt/virterror.h" +#include <libxml/uri.h> + #ifdef __cplusplus extern "C" { #endif @@ -74,7 +76,7 @@ typedef enum { typedef virDrvOpenStatus (*virDrvOpen) (virConnectPtr conn, - const char *name, + xmlURIPtr uri, int flags); typedef int (*virDrvClose) (virConnectPtr conn); Index: src/internal.h =================================================================== RCS file: /data/cvs/libvirt/src/internal.h,v retrieving revision 1.50 diff -u -p -r1.50 internal.h --- src/internal.h 29 Sep 2007 18:16:26 -0000 1.50 +++ src/internal.h 16 Oct 2007 10:24:37 -0000 @@ -148,6 +148,7 @@ struct _virConnect { virHashTablePtr domains;/* hash table for known domains */ virHashTablePtr networks;/* hash table for known domains */ int flags; /* a set of connection flags */ + char *name; /* connection URI */ }; /** Index: src/libvirt.c =================================================================== RCS file: /data/cvs/libvirt/src/libvirt.c,v retrieving revision 1.103 diff -u -p -r1.103 libvirt.c --- src/libvirt.c 15 Oct 2007 21:38:56 -0000 1.103 +++ src/libvirt.c 16 Oct 2007 10:24:39 -0000 @@ -22,6 +22,7 @@ #include <libxml/parser.h> #include <libxml/xpath.h> +#include <libxml/uri.h> #include "internal.h" #include "driver.h" @@ -394,6 +395,7 @@ do_open (const char *name, int flags) { int i, res; virConnectPtr ret = NULL; + xmlURIPtr uri; /* Convert NULL or "" to xen:/// for back compat */ if (!name || name[0] == '\0') @@ -410,19 +412,28 @@ do_open (const char *name, int flags) ret = virGetConnect(); if (ret == NULL) { virLibConnError(NULL, VIR_ERR_NO_MEMORY, _("allocating connection")); + return NULL; + } + + uri = xmlParseURI (name); + if (!uri) { + virLibConnError (ret, VIR_ERR_INVALID_ARG, + _("could not parse connection URI")); goto failed; } -#ifdef ENABLE_DEBUG - fprintf (stderr, "libvirt: do_open: proceeding with name=%s\n", name); -#endif + ret->name = strdup (name); + if (!ret->name) { + virLibConnError (ret, VIR_ERR_NO_MEMORY, "allocating conn->name"); + goto failed; + } for (i = 0; i < virDriverTabCount; i++) { #ifdef ENABLE_DEBUG fprintf (stderr, "libvirt: do_open: trying driver %d (%s) ...\n", i, virDriverTab[i]->name); #endif - res = virDriverTab[i]->open (ret, name, flags); + res = virDriverTab[i]->open (ret, uri, flags); #ifdef ENABLE_DEBUG fprintf (stderr, "libvirt: do_open: driver %d %s returned %s\n", i, virDriverTab[i]->name, @@ -444,7 +455,7 @@ do_open (const char *name, int flags) } for (i = 0; i < virNetworkDriverTabCount; i++) { - res = virNetworkDriverTab[i]->open (ret, name, flags); + res = virNetworkDriverTab[i]->open (ret, uri, flags); #ifdef ENABLE_DEBUG fprintf (stderr, "libvirt: do_open: network driver %d %s returned %s\n", i, virNetworkDriverTab[i]->name, @@ -468,12 +479,16 @@ do_open (const char *name, int flags) ret->flags = VIR_CONNECT_RO; } + xmlFreeURI (uri); + return ret; failed: + if (ret->name) free (ret->name); if (ret->driver) ret->driver->close (ret); + if (uri) xmlFreeURI(uri); virFreeConnect(ret); - return (NULL); + return NULL; } /** @@ -536,6 +551,8 @@ virConnectClose(virConnectPtr conn) conn->networkDriver->close (conn); conn->driver->close (conn); + if (conn->name) free (conn->name); + if (virFreeConnect(conn) < 0) return (-1); return (0); @@ -666,6 +683,8 @@ virConnectGetHostname (virConnectPtr con char * virConnectGetURI (virConnectPtr conn) { + char *name; + DEBUG("conn=%p", conn); if (!VIR_IS_CONNECT(conn)) { @@ -673,11 +692,18 @@ virConnectGetURI (virConnectPtr conn) return NULL; } + /* Drivers may override getURI, but if they don't then + * we provide a default implementation. + */ if (conn->driver->getURI) return conn->driver->getURI (conn); - virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); - return NULL; + name = strdup (conn->name); + if (!name) { + virLibConnError (conn, VIR_ERR_NO_MEMORY, __FUNCTION__); + return NULL; + } + return name; } /** Index: src/proxy_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/proxy_internal.c,v retrieving revision 1.34 diff -u -p -r1.34 proxy_internal.c --- src/proxy_internal.c 14 Aug 2007 12:29:41 -0000 1.34 +++ src/proxy_internal.c 16 Oct 2007 10:24:40 -0000 @@ -29,7 +29,7 @@ static int debug = 0; static int xenProxyClose(virConnectPtr conn); -static int xenProxyOpen(virConnectPtr conn, const char *name, int flags); +static int xenProxyOpen(virConnectPtr conn, xmlURIPtr uri, int flags); static int xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer); static int xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); static char *xenProxyGetCapabilities(virConnectPtr conn); @@ -523,7 +523,7 @@ retry: * Returns 0 in case of success, and -1 in case of failure */ int -xenProxyOpen(virConnectPtr conn, const char *name ATTRIBUTE_UNUSED, int flags) +xenProxyOpen(virConnectPtr conn, xmlURIPtr uri ATTRIBUTE_UNUSED, int flags) { virProxyPacket req; int ret; Index: src/qemu_driver.c =================================================================== RCS file: /data/cvs/libvirt/src/qemu_driver.c,v retrieving revision 1.30 diff -u -p -r1.30 qemu_driver.c --- src/qemu_driver.c 12 Oct 2007 16:05:44 -0000 1.30 +++ src/qemu_driver.c 16 Oct 2007 10:24:41 -0000 @@ -1376,15 +1376,13 @@ static int qemudMonitorCommand(struct qe static virDrvOpenStatus qemudOpen(virConnectPtr conn, - const char *name, + xmlURIPtr uri, int flags ATTRIBUTE_UNUSED) { - xmlURIPtr uri = NULL; uid_t uid = getuid(); if (qemu_driver == NULL) - return VIR_DRV_OPEN_DECLINED; + goto decline; - uri = xmlParseURI(name); if (uri == NULL || uri->scheme == NULL || uri->path == NULL) goto decline; @@ -1402,12 +1400,9 @@ static virDrvOpenStatus qemudOpen(virCon conn->privateData = qemu_driver; - xmlFreeURI(uri); return VIR_DRV_OPEN_SUCCESS; decline: - if (uri != NULL) - xmlFreeURI(uri); return VIR_DRV_OPEN_DECLINED; } @@ -2403,7 +2398,7 @@ static virNetworkPtr qemudNetworkLookupB } static virDrvOpenStatus qemudOpenNetwork(virConnectPtr conn, - const char *name ATTRIBUTE_UNUSED, + xmlURIPtr uri ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) { if (!qemu_driver) return VIR_DRV_OPEN_DECLINED; @@ -2672,7 +2667,7 @@ static virDriver qemuDriver = { qemudGetType, /* type */ qemudGetVersion, /* version */ qemudGetHostname, /* hostname */ - NULL, /* URI - never called because remote_internal.c answers this */ + NULL, /* URI */ qemudGetMaxVCPUs, /* getMaxVcpus */ qemudGetNodeInfo, /* nodeGetInfo */ qemudGetCapabilities, /* getCapabilities */ Index: src/remote_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/remote_internal.c,v retrieving revision 1.29 diff -u -p -r1.29 remote_internal.c --- src/remote_internal.c 15 Oct 2007 21:38:56 -0000 1.29 +++ src/remote_internal.c 16 Oct 2007 10:24:43 -0000 @@ -67,7 +67,6 @@ struct private_data { gnutls_session_t session; /* GnuTLS session (if uses_tls != 0). */ char *type; /* Cached return from remoteType. */ int counter; /* Generates serial numbers for RPC. */ - char *uri; /* Original (remote) URI. */ int networkOnly; /* Only used for network API */ }; @@ -239,15 +238,9 @@ enum virDrvOpenRemoteFlags { }; static int -doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str, int flags) +doRemoteOpen (virConnectPtr conn, struct private_data *priv, + xmlURIPtr uri, int flags) { - if (!uri_str) return VIR_DRV_OPEN_DECLINED; - - /* We have to parse the URL every time to discover whether - * it contains a transport or remote server name. There's no - * way to get around this. - */ - xmlURIPtr uri = xmlParseURI (uri_str); if (!uri || !uri->scheme) return VIR_DRV_OPEN_DECLINED; /* Decline - not a URL. */ @@ -644,13 +637,6 @@ doRemoteOpen (virConnectPtr conn, struct (xdrproc_t) xdr_void, (char *) NULL) == -1) goto failed; - /* Duplicate and save the uri_str. */ - priv->uri = strdup (uri_str); - if (!priv->uri) { - error (NULL, VIR_ERR_NO_MEMORY, "allocating priv->uri"); - goto failed; - } - /* Successful. */ retcode = VIR_DRV_OPEN_SUCCESS; @@ -672,7 +658,6 @@ doRemoteOpen (virConnectPtr conn, struct } /* Free up the URL and strings. */ - xmlFreeURI (uri); if (name) free (name); if (command) free (command); if (sockname) free (sockname); @@ -693,7 +678,7 @@ doRemoteOpen (virConnectPtr conn, struct } static int -remoteOpen (virConnectPtr conn, const char *uri_str, int flags) +remoteOpen (virConnectPtr conn, xmlURIPtr uri, int flags) { struct private_data *priv = malloc (sizeof(struct private_data)); int ret, rflags = 0; @@ -706,10 +691,13 @@ remoteOpen (virConnectPtr conn, const ch if (flags & VIR_DRV_OPEN_RO) rflags |= VIR_DRV_OPEN_REMOTE_RO; - if (uri_str) { - if (STREQ (uri_str, "qemu:///system")) { + if (uri && + uri->scheme && STREQ (uri->scheme, "qemu") && + (!uri->server || STREQ (uri->server, "")) && + uri->path) { + if (STREQ (uri->path, "/system")) { rflags |= VIR_DRV_OPEN_REMOTE_UNIX; - } else if (STREQ (uri_str, "qemu:///session")) { + } else if (STREQ (uri->path, "/session")) { rflags |= VIR_DRV_OPEN_REMOTE_UNIX; if (getuid() > 0) { rflags |= VIR_DRV_OPEN_REMOTE_USER; @@ -721,7 +709,7 @@ remoteOpen (virConnectPtr conn, const ch memset(priv, 0, sizeof(struct private_data)); priv->magic = DEAD; priv->sock = -1; - ret = doRemoteOpen(conn, priv, uri_str, rflags); + ret = doRemoteOpen(conn, priv, uri, rflags); if (ret != VIR_DRV_OPEN_SUCCESS) { conn->privateData = NULL; free(priv); @@ -1206,9 +1194,6 @@ doRemoteClose (virConnectPtr conn, struc /* See comment for remoteType. */ if (priv->type) free (priv->type); - /* Free URI copy. */ - if (priv->uri) free (priv->uri); - /* Free private data. */ priv->magic = DEAD; @@ -1308,23 +1293,6 @@ remoteGetHostname (virConnectPtr conn) return ret.hostname; } -/* This call is unusual because it doesn't go over RPC. The - * full URI is known (only) at the client end of the connection. - */ -static char * -remoteGetURI (virConnectPtr conn) -{ - GET_PRIVATE (conn, NULL); - char *str; - - str = strdup (priv->uri); - if (str == NULL) { - error (conn, VIR_ERR_SYSTEM_ERROR, strerror (errno)); - return NULL; - } - return str; -} - static int remoteGetMaxVcpus (virConnectPtr conn, const char *type) { @@ -2358,7 +2326,7 @@ remoteDomainInterfaceStats (virDomainPtr static int remoteNetworkOpen (virConnectPtr conn, - const char *uri_str, + xmlURIPtr uri, int flags) { if (conn && @@ -2389,7 +2357,7 @@ remoteNetworkOpen (virConnectPtr conn, memset(priv, 0, sizeof(struct private_data)); priv->magic = DEAD; priv->sock = -1; - ret = doRemoteOpen(conn, priv, uri_str, rflags); + ret = doRemoteOpen(conn, priv, uri, rflags); if (ret != VIR_DRV_OPEN_SUCCESS) { conn->networkPrivateData = NULL; free(priv); @@ -3105,7 +3073,6 @@ static virDriver driver = { .type = remoteType, .version = remoteVersion, .getHostname = remoteGetHostname, - .getURI = remoteGetURI, .getMaxVcpus = remoteGetMaxVcpus, .nodeGetInfo = remoteNodeGetInfo, .getCapabilities = remoteGetCapabilities, Index: src/test.c =================================================================== RCS file: /data/cvs/libvirt/src/test.c,v retrieving revision 1.50 diff -u -p -r1.50 test.c --- src/test.c 15 Oct 2007 14:32:35 -0000 1.50 +++ src/test.c 16 Oct 2007 10:24:45 -0000 @@ -879,35 +879,23 @@ static int getNetworkIndex(virNetworkPtr } static int testOpen(virConnectPtr conn, - const char *name, + xmlURIPtr uri, int flags ATTRIBUTE_UNUSED) { - xmlURIPtr uri; int ret; - if (!name) + if (!uri) return VIR_DRV_OPEN_DECLINED; - uri = xmlParseURI(name); - if (uri == NULL) { + if (!uri->scheme || strcmp(uri->scheme, "test") != 0) return VIR_DRV_OPEN_DECLINED; - } - - if (!uri->scheme || strcmp(uri->scheme, "test") != 0) { - xmlFreeURI(uri); - return VIR_DRV_OPEN_DECLINED; - } /* Remote driver should handle these. */ - if (uri->server) { - xmlFreeURI(uri); + if (uri->server) return VIR_DRV_OPEN_DECLINED; - } - if (uri->server) { - xmlFreeURI(uri); + if (uri->server) return VIR_DRV_OPEN_DECLINED; - } /* From this point on, the connection is for us. */ if (!uri->path @@ -924,8 +912,6 @@ static int testOpen(virConnectPtr conn, ret = testOpenFromFile(conn, uri->path); - xmlFreeURI(uri); - return (ret); } @@ -1655,7 +1641,7 @@ static int testDomainSetSchedulerParams( } static virDrvOpenStatus testOpenNetwork(virConnectPtr conn, - const char *name ATTRIBUTE_UNUSED, + xmlURIPtr uri ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) { if (STRNEQ(conn->driver->name, "Test")) return VIR_DRV_OPEN_DECLINED; Index: src/xen_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xen_internal.c,v retrieving revision 1.96 diff -u -p -r1.96 xen_internal.c --- src/xen_internal.c 29 Sep 2007 18:37:47 -0000 1.96 +++ src/xen_internal.c 16 Oct 2007 10:24:47 -0000 @@ -2151,7 +2151,7 @@ xenHypervisorInit(void) */ int xenHypervisorOpen(virConnectPtr conn, - const char *name ATTRIBUTE_UNUSED, + xmlURIPtr uri ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) { int ret; Index: src/xen_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xen_internal.h,v retrieving revision 1.24 diff -u -p -r1.24 xen_internal.h --- src/xen_internal.h 28 Sep 2007 14:28:13 -0000 1.24 +++ src/xen_internal.h 16 Oct 2007 10:24:47 -0000 @@ -30,7 +30,7 @@ char * xenHypervisorDomainGetOSType (virDomainPtr dom); int xenHypervisorOpen (virConnectPtr conn, - const char *name, + xmlURIPtr uri, int flags); int xenHypervisorClose (virConnectPtr conn); int xenHypervisorGetVersion (virConnectPtr conn, Index: src/xen_unified.c =================================================================== RCS file: /data/cvs/libvirt/src/xen_unified.c,v retrieving revision 1.24 diff -u -p -r1.24 xen_unified.c --- src/xen_unified.c 15 Oct 2007 21:38:56 -0000 1.24 +++ src/xen_unified.c 16 Oct 2007 10:24:48 -0000 @@ -76,42 +76,28 @@ xenUnifiedError (virConnectPtr conn, vir */ static int -xenUnifiedOpen (virConnectPtr conn, const char *name, int flags) +xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, int flags) { int i, j; xenUnifiedPrivatePtr priv; - xmlURIPtr uri; - - uri = xmlParseURI(name); - if (uri == NULL) { - return VIR_DRV_OPEN_DECLINED; - } /* Refuse any scheme which isn't "xen://" or "http://". */ if (uri->scheme && strcasecmp(uri->scheme, "xen") != 0 && - strcasecmp(uri->scheme, "http") != 0) { - xmlFreeURI(uri); + strcasecmp(uri->scheme, "http") != 0) return VIR_DRV_OPEN_DECLINED; - } /* xmlParseURI will parse a naked string like "foo" as a URI with * a NULL scheme. That's not useful for us because we want to only * allow full pathnames (eg. ///var/lib/xen/xend-socket). Decline * anything else. */ - if (!uri->scheme && name[0] != '/') { - xmlFreeURI(uri); + if (!uri->scheme && (!uri->path || uri->path[0] != '/')) return VIR_DRV_OPEN_DECLINED; - } /* Refuse any xen:// URI with a server specified - allow remote to do it */ - if (uri->scheme && strcasecmp(uri->scheme, "xen") == 0 && uri->server) { - xmlFreeURI(uri); + if (uri->scheme && strcasecmp(uri->scheme, "xen") == 0 && uri->server) return VIR_DRV_OPEN_DECLINED; - } - - xmlFreeURI(uri); /* Allocate per-connection private data. */ priv = calloc (1, sizeof *priv); @@ -121,13 +107,6 @@ xenUnifiedOpen (virConnectPtr conn, cons } conn->privateData = priv; - priv->name = strdup (name); - if (!priv->name) { - xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, "allocating priv->name"); - free (priv); - return VIR_DRV_OPEN_ERROR; - } - priv->handle = -1; priv->xendConfigVersion = -1; priv->type = -1; @@ -152,7 +131,7 @@ xenUnifiedOpen (virConnectPtr conn, cons #ifdef ENABLE_DEBUG fprintf (stderr, "libvirt: xenUnifiedOpen: trying Xen sub-driver %d\n", i); #endif - if (drivers[i]->open (conn, name, flags) == VIR_DRV_OPEN_SUCCESS) + if (drivers[i]->open (conn, uri, flags) == VIR_DRV_OPEN_SUCCESS) priv->opened[i] = 1; #ifdef ENABLE_DEBUG fprintf (stderr, "libvirt: xenUnifiedOpen: Xen sub-driver %d open %s\n", @@ -166,7 +145,6 @@ xenUnifiedOpen (virConnectPtr conn, cons (getuid() == 0 || i == XEN_UNIFIED_PROXY_OFFSET)) { for (j = 0; j < i; ++j) if (priv->opened[j]) drivers[j]->close (conn); - free (priv->name); free (priv); /* The assumption is that one of the underlying drivers * has set virterror already. @@ -191,7 +169,6 @@ xenUnifiedClose (virConnectPtr conn) if (priv->opened[i] && drivers[i]->close) (void) drivers[i]->close (conn); - free (priv->name); free (conn->privateData); conn->privateData = NULL; @@ -261,21 +238,6 @@ xenUnifiedGetHostname (virConnectPtr con return str; } -/* The name is recorded (canonicalised) in xenUnifiedOpen. */ -static char * -xenUnifiedGetURI (virConnectPtr conn) -{ - GET_PRIVATE(conn); - char *str; - - str = strdup (priv->name); - if (str == NULL) { - xenUnifiedError (conn, VIR_ERR_SYSTEM_ERROR, strerror (errno)); - return NULL; - } - return str; -} - static int xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type) { @@ -1103,7 +1065,6 @@ static virDriver xenUnifiedDriver = { .type = xenUnifiedType, .version = xenUnifiedVersion, .getHostname = xenUnifiedGetHostname, - .getURI = xenUnifiedGetURI, .getMaxVcpus = xenUnifiedGetMaxVcpus, .nodeGetInfo = xenUnifiedNodeGetInfo, .getCapabilities = xenUnifiedGetCapabilities, Index: src/xen_unified.h =================================================================== RCS file: /data/cvs/libvirt/src/xen_unified.h,v retrieving revision 1.5 diff -u -p -r1.5 xen_unified.h --- src/xen_unified.h 6 Jul 2007 15:11:22 -0000 1.5 +++ src/xen_unified.h 16 Oct 2007 10:24:48 -0000 @@ -109,9 +109,6 @@ struct _xenUnifiedPrivate { * xen_unified.c. */ int opened[XEN_UNIFIED_NR_DRIVERS]; - - /* Canonical URI. */ - char *name; }; typedef struct _xenUnifiedPrivate *xenUnifiedPrivatePtr; Index: src/xend_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.c,v retrieving revision 1.148 diff -u -p -r1.148 xend_internal.c --- src/xend_internal.c 15 Oct 2007 21:38:56 -0000 1.148 +++ src/xend_internal.c 16 Oct 2007 10:24:50 -0000 @@ -2172,18 +2172,29 @@ error: * Returns 0 in case of success, -1 in case of error. */ int -xenDaemonOpen(virConnectPtr conn, const char *name, +xenDaemonOpen(virConnectPtr conn, xmlURIPtr uri, int flags ATTRIBUTE_UNUSED) { - xmlURIPtr uri = NULL; int ret; - - /* If the name is just "xen" (it might originally have been NULL, - * see xenUnifiedOpen) or any URI beginning with "xen:///" then - * try default paths and methods to get to the xend socket. + + /* Switch on the scheme, which we expect to be NULL (file), + * "http" or "xen". */ - if (strcasecmp (name, "xen") == 0 || - strncasecmp (name, "xen:///", 7) == 0) { + if (uri->scheme == NULL) { + /* It should be a file access */ + if (uri->path == NULL) { + virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__); + goto failed; + } + ret = xenDaemonOpen_unix(conn, uri->path); + if (ret < 0) + goto failed; + + ret = xend_detect_config_version(conn); + if (ret == -1) + goto failed; + } + else if (STRCASEEQ (uri->scheme, "xen")) { /* * try first to open the unix socket */ @@ -2204,50 +2215,22 @@ xenDaemonOpen(virConnectPtr conn, const ret = xend_detect_config_version(conn); if (ret == -1) goto failed; - } else { - /* - * We were given a connection name, expected to be an URL - */ - uri = xmlParseURI(name); - if (uri == NULL) { - virXendError(NULL, VIR_ERR_NO_CONNECT, name); + } else if (STRCASEEQ (uri->scheme, "http")) { + ret = xenDaemonOpen_tcp(conn, uri->server, uri->port); + if (ret < 0) goto failed; - } - - if (uri->scheme == NULL) { - /* It should be a file access */ - if (uri->path == NULL) { - virXendError(NULL, VIR_ERR_NO_CONNECT, name); - goto failed; - } - ret = xenDaemonOpen_unix(conn, uri->path); - if (ret < 0) - goto failed; - - ret = xend_detect_config_version(conn); - if (ret == -1) - goto failed; - } else if (!strcasecmp(uri->scheme, "http")) { - ret = xenDaemonOpen_tcp(conn, uri->server, uri->port); - if (ret < 0) - goto failed; - ret = xend_detect_config_version(conn); - if (ret == -1) - goto failed; - } else { - virXendError(NULL, VIR_ERR_NO_CONNECT, name); + ret = xend_detect_config_version(conn); + if (ret == -1) goto failed; - } + } else { + virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__); + goto failed; } done: - if (uri != NULL) - xmlFreeURI(uri); return(ret); failed: - if (uri != NULL) - xmlFreeURI(uri); return(-1); } Index: src/xend_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xend_internal.h,v retrieving revision 1.34 diff -u -p -r1.34 xend_internal.h --- src/xend_internal.h 30 Sep 2007 13:09:07 -0000 1.34 +++ src/xend_internal.h 16 Oct 2007 10:24:50 -0000 @@ -181,7 +181,7 @@ char *xenDaemonDomainDumpXMLByName(virCo char *xend_parse_domain_sexp(virConnectPtr conn, char *root, int xendConfigVersion); /* refactored ones */ -int xenDaemonOpen(virConnectPtr conn, const char *name, int flags); +int xenDaemonOpen(virConnectPtr conn, xmlURIPtr uri, int flags); int xenDaemonClose(virConnectPtr conn); int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer); int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); Index: src/xm_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xm_internal.c,v retrieving revision 1.41 diff -u -p -r1.41 xm_internal.c --- src/xm_internal.c 10 Oct 2007 17:55:38 -0000 1.41 +++ src/xm_internal.c 16 Oct 2007 10:24:52 -0000 @@ -471,7 +471,7 @@ static int xenXMConfigCacheRefresh (virC */ int xenXMOpen (virConnectPtr conn ATTRIBUTE_UNUSED, - const char *name ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) + xmlURIPtr uri ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) { if (configCache == NULL) { configCache = virHashCreate(50); Index: src/xm_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xm_internal.h,v retrieving revision 1.5 diff -u -p -r1.5 xm_internal.h --- src/xm_internal.h 6 Jul 2007 15:11:22 -0000 1.5 +++ src/xm_internal.h 16 Oct 2007 10:24:52 -0000 @@ -36,7 +36,7 @@ extern "C" { extern struct xenUnifiedDriver xenXMDriver; int xenXMInit (void); -int xenXMOpen(virConnectPtr conn, const char *name, int flags); +int xenXMOpen(virConnectPtr conn, xmlURIPtr uri, int flags); int xenXMClose(virConnectPtr conn); const char *xenXMGetType(virConnectPtr conn); int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info); Index: src/xs_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xs_internal.c,v retrieving revision 1.49 diff -u -p -r1.49 xs_internal.c --- src/xs_internal.c 29 Sep 2007 18:37:47 -0000 1.49 +++ src/xs_internal.c 16 Oct 2007 10:24:52 -0000 @@ -327,7 +327,7 @@ virConnectCheckStoreID(virConnectPtr con */ int xenStoreOpen(virConnectPtr conn, - const char *name ATTRIBUTE_UNUSED, + xmlURIPtr uri ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) { xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData; Index: src/xs_internal.h =================================================================== RCS file: /data/cvs/libvirt/src/xs_internal.h,v retrieving revision 1.11 diff -u -p -r1.11 xs_internal.h --- src/xs_internal.h 10 Aug 2007 18:25:15 -0000 1.11 +++ src/xs_internal.h 16 Oct 2007 10:24:52 -0000 @@ -21,7 +21,7 @@ extern struct xenUnifiedDriver xenStoreD int xenStoreInit (void); int xenStoreOpen (virConnectPtr conn, - const char *name, + xmlURIPtr uri, int flags); int xenStoreClose (virConnectPtr conn); int xenStoreGetDomainInfo (virDomainPtr domain,
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list