I'm not quite sure what the problem is (although the problem is in xm_internal), but when you use xm_internal over remote, it sometimes doesn't initialize its internal cache correctly, so it thinks that there are no inactive domains. The fix is a one-liner which I hit upon by accident -- I don't really understand why it works: @@ -489,7 +487,7 @@ xenXMOpen (virConnectPtr conn ATTRIBUTE_UNUSED,const char *name ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED)
{ - if (nconnections == 0) { + if (configCache == NULL) { configCache = virHashCreate(50); if (!configCache) return (-1); But the attached patch also adds proper error messages to xenXMConfigCacheRefresh too. 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
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-domain-lookup-1/src/xm_internal.c libvirt-domain-lookup-2/src/xm_internal.c --- libvirt-domain-lookup-1/src/xm_internal.c 2007-07-03 11:21:59.000000000 +0100 +++ libvirt-domain-lookup-2/src/xm_internal.c 2007-07-03 15:09:32.000000000 +0100 @@ -27,6 +27,8 @@ #include <time.h> #include <sys/stat.h> #include <limits.h> +#include <string.h> +#include <errno.h> #include <unistd.h> #include <stdint.h> @@ -326,13 +319,14 @@ environment variable) and process any domain configs. It has rate-limited so never rescans more frequently than once every X seconds */ -static int xenXMConfigCacheRefresh(void) { +static int xenXMConfigCacheRefresh (virConnectPtr conn) { DIR *dh; struct dirent *ent; time_t now = time(NULL); int ret = -1; if (now == ((time_t)-1)) { + xenXMError (conn, VIR_ERR_SYSTEM_ERROR, strerror (errno)); return (-1); } @@ -344,6 +338,7 @@ /* Process the files in the config dir */ if (!(dh = opendir(configDir))) { + xenXMError (conn, VIR_ERR_SYSTEM_ERROR, strerror (errno)); return (-1); } @@ -418,6 +413,7 @@ } else { /* Completely new entry */ newborn = 1; if (!(entry = malloc(sizeof(xenXMConfCache)))) { + xenXMError (conn, VIR_ERR_NO_MEMORY, strerror (errno)); goto cleanup; } memcpy(entry->filename, path, PATH_MAX); @@ -439,6 +435,7 @@ virHashRemoveEntry(configCache, path, NULL); } free(entry); + xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: name"); goto cleanup; } @@ -448,6 +445,7 @@ if (virHashAddEntry(configCache, entry->filename, entry) < 0) { virConfFree(entry->conf); free(entry); + xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: virHashAddEntry"); goto cleanup; } } @@ -489,7 +487,7 @@ xenXMOpen (virConnectPtr conn ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED) { - if (nconnections == 0) { + if (configCache == NULL) { configCache = virHashCreate(50); if (!configCache) return (-1); @@ -1211,7 +1209,7 @@ return (NULL); } - if (xenXMConfigCacheRefresh() < 0) + if (xenXMConfigCacheRefresh (conn) < 0) return (NULL); if (!(filename = virHashLookup(nameConfigMap, domname))) @@ -1274,7 +1272,7 @@ return (NULL); } - if (xenXMConfigCacheRefresh() < 0) + if (xenXMConfigCacheRefresh (conn) < 0) return (NULL); if (!(entry = virHashSearch(configCache, xenXMDomainSearchForUUID, (const void *)uuid))) { @@ -2115,7 +2113,7 @@ if (conn->flags & VIR_CONNECT_RO) return (NULL); - if (xenXMConfigCacheRefresh() < 0) + if (xenXMConfigCacheRefresh (conn) < 0) return (NULL); if (!(conf = xenXMParseXMLToConfig(conn, xml))) @@ -2274,7 +2272,7 @@ if (ctx->count == ctx->max) return; - dom = xenDaemonDomainLookupByName(ctx->conn, name); + dom = xenDaemonLookupByName(ctx->conn, name); if (!dom) { ctx->names[ctx->count] = strdup(name); ctx->count++; @@ -2296,7 +2294,7 @@ return (-1); } - if (xenXMConfigCacheRefresh() < 0) + if (xenXMConfigCacheRefresh (conn) < 0) return (-1); if (maxnames > virHashSize(configCache)) @@ -2321,7 +2319,7 @@ return (-1); } - if (xenXMConfigCacheRefresh() < 0) + if (xenXMConfigCacheRefresh (conn) < 0) return (-1); return virHashSize(nameConfigMap);
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list