Prefer xenstore driver for listDomains, since xen HV reports ghost ids of

already shutdown domains in some xen versions
This commit is contained in:
Guido Günther 2008-11-28 15:25:04 +00:00
parent d88d459d7b
commit 5acdb5761d
6 changed files with 39 additions and 9 deletions

View File

@ -1,3 +1,14 @@
Fri Nov 28 16:16:54 CET 2008 Guido Günther <agx@sigxcpu.org>
Prefer xenstore driver for listDomains, since xen HV reports ghost ids
of already shutdown domains in some xen versions
* src/proxy_internal.c, src/proxy_internal.h: declare
xenProxyListDomains non static
* src/xend_internal.c, src/xend_internal.h: declare
xenDaemonListDomains non static
* src/xen_unified.c: prefer xenStoreListDomains over
xenHypervisorListDomains for xenUnifiedListDomains
Fri Nov 28 11:58:40 GMT 2008 Daniel P. Berrange <berrange@redhat.com> Fri Nov 28 11:58:40 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
Allow generic remote://hostname/ URI for automatic probe Allow generic remote://hostname/ URI for automatic probe

View File

@ -40,7 +40,6 @@ static int xenProxyOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags);
static int xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer); static int xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer);
static int xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); static int xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
static char *xenProxyGetCapabilities(virConnectPtr conn); static char *xenProxyGetCapabilities(virConnectPtr conn);
static int xenProxyListDomains(virConnectPtr conn, int *ids, int maxids);
static int xenProxyNumOfDomains(virConnectPtr conn); static int xenProxyNumOfDomains(virConnectPtr conn);
static unsigned long xenProxyDomainGetMaxMemory(virDomainPtr domain); static unsigned long xenProxyDomainGetMaxMemory(virDomainPtr domain);
static int xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info); static int xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
@ -566,7 +565,7 @@ xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer)
* *
* Returns the number of domain found or -1 in case of error * Returns the number of domain found or -1 in case of error
*/ */
static int int
xenProxyListDomains(virConnectPtr conn, int *ids, int maxids) xenProxyListDomains(virConnectPtr conn, int *ids, int maxids)
{ {
virProxyPacket req; virProxyPacket req;

View File

@ -94,4 +94,6 @@ extern virDomainPtr xenProxyLookupByName(virConnectPtr conn,
extern char * xenProxyDomainDumpXML(virDomainPtr domain, extern char * xenProxyDomainDumpXML(virDomainPtr domain,
int flags); int flags);
extern int xenProxyListDomains(virConnectPtr conn, int *ids,
int maxids);
#endif /* __LIBVIR_PROXY_H__ */ #endif /* __LIBVIR_PROXY_H__ */

View File

@ -516,14 +516,31 @@ static int
xenUnifiedListDomains (virConnectPtr conn, int *ids, int maxids) xenUnifiedListDomains (virConnectPtr conn, int *ids, int maxids)
{ {
GET_PRIVATE(conn); GET_PRIVATE(conn);
int i, ret; int ret;
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) /* Try xenstore. */
if (priv->opened[i] && drivers[i]->listDomains) { if (priv->opened[XEN_UNIFIED_XS_OFFSET]) {
ret = drivers[i]->listDomains (conn, ids, maxids); ret = xenStoreListDomains (conn, ids, maxids);
if (ret >= 0) return ret; if (ret >= 0) return ret;
} }
/* Try HV. */
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) {
ret = xenHypervisorListDomains (conn, ids, maxids);
if (ret >= 0) return ret;
}
/* Try xend. */
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
ret = xenDaemonListDomains (conn, ids, maxids);
if (ret >= 0) return ret;
}
/* Try proxy. */
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
ret = xenProxyListDomains (conn, ids, maxids);
if (ret >= 0) return ret;
}
return -1; return -1;
} }

View File

@ -3411,7 +3411,7 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
* *
* Returns the number of domain found or -1 in case of error * Returns the number of domain found or -1 in case of error
*/ */
static int int
xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids) xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids)
{ {
struct sexpr *root = NULL; struct sexpr *root = NULL;

View File

@ -179,5 +179,6 @@ int xenDaemonDomainMigratePrepare (virConnectPtr dconn, char **cookie, int *cook
int xenDaemonDomainMigratePerform (virDomainPtr domain, const char *cookie, int cookielen, const char *uri, unsigned long flags, const char *dname, unsigned long resource); int xenDaemonDomainMigratePerform (virDomainPtr domain, const char *cookie, int cookielen, const char *uri, unsigned long flags, const char *dname, unsigned long resource);
int xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, unsigned long long offset, size_t size, void *buffer); int xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, unsigned long long offset, size_t size, void *buffer);
int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
#endif /* __XEND_INTERNAL_H_ */ #endif /* __XEND_INTERNAL_H_ */