mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Refresh /etc/xen if inotify wasn't
* src/xm_internal.c: in case of multiple connections to the xen driver and some clients were not using domain events, the whole /etc/xen monitoring would break leading to disapearing domains.
This commit is contained in:
parent
8ddfb40e2d
commit
a11010c07d
@ -122,6 +122,19 @@ struct xenUnifiedDriver xenXMDriver = {
|
|||||||
virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \
|
virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, fmt)
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
|
||||||
|
static int xenInotifyActive(virConnectPtr conn)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
#ifndef WITH_XEN_INOTIFY
|
||||||
|
ret = 0;
|
||||||
|
#else
|
||||||
|
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
||||||
|
ret = (priv->inotifyWatch > 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convenience method to grab a int from the config file object */
|
/* Convenience method to grab a int from the config file object */
|
||||||
static int xenXMConfigGetBool(virConnectPtr conn,
|
static int xenXMConfigGetBool(virConnectPtr conn,
|
||||||
virConfPtr conf,
|
virConfPtr conf,
|
||||||
@ -1737,10 +1750,8 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||||
if (xenXMConfigCacheRefresh (conn) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(filename = virHashLookup(priv->nameConfigMap, domname)))
|
if (!(filename = virHashLookup(priv->nameConfigMap, domname)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1795,10 +1806,8 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||||
if (xenXMConfigCacheRefresh (conn) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(entry = virHashSearch(priv->configCache, xenXMDomainSearchForUUID, (const void *)uuid)))
|
if (!(entry = virHashSearch(priv->configCache, xenXMDomainSearchForUUID, (const void *)uuid)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2551,12 +2560,10 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
|
|||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0) {
|
||||||
if (xenXMConfigCacheRefresh (conn) < 0) {
|
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(def = virDomainDefParseString(conn, priv->caps, xml,
|
if (!(def = virDomainDefParseString(conn, priv->caps, xml,
|
||||||
VIR_DOMAIN_XML_INACTIVE))) {
|
VIR_DOMAIN_XML_INACTIVE))) {
|
||||||
@ -2739,10 +2746,8 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||||
if (xenXMConfigCacheRefresh (conn) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (maxnames > virHashSize(priv->configCache))
|
if (maxnames > virHashSize(priv->configCache))
|
||||||
maxnames = virHashSize(priv->configCache);
|
maxnames = virHashSize(priv->configCache);
|
||||||
@ -2755,9 +2760,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
|
|||||||
virHashForEach(priv->nameConfigMap, xenXMListIterator, &ctx);
|
virHashForEach(priv->nameConfigMap, xenXMListIterator, &ctx);
|
||||||
ret = ctx.count;
|
ret = ctx.count;
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
|
||||||
cleanup:
|
cleanup:
|
||||||
#endif
|
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -2778,16 +2781,12 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||||
if (xenXMConfigCacheRefresh (conn) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = virHashSize(priv->nameConfigMap);
|
ret = virHashSize(priv->nameConfigMap);
|
||||||
|
|
||||||
#ifndef WITH_XEN_INOTIFY
|
|
||||||
cleanup:
|
cleanup:
|
||||||
#endif
|
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user