mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Fix logic in xenUnifiedNumOfDomains to match xenUnifiedListDomains
The xenUnifiedNumOfDomains and xenUnifiedListDomains methods work together as a pair, so it is critical they both apply the same logic. With the current mis-matched logic it is possible to sometimes get into a state when you miss certain active guests. * src/xen/xen_driver.c: Change xenUnifiedNumOfDomains ordering to match xenUnifiedListDomains.
This commit is contained in:
parent
730fd3b022
commit
2659b3f5aa
@ -40,7 +40,6 @@ static virDrvOpenStatus xenProxyOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
static int xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer);
|
||||
static int xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
||||
static char *xenProxyGetCapabilities(virConnectPtr conn);
|
||||
static int xenProxyNumOfDomains(virConnectPtr conn);
|
||||
static unsigned long xenProxyDomainGetMaxMemory(virDomainPtr domain);
|
||||
static int xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
|
||||
static char *xenProxyDomainGetOSType(virDomainPtr domain);
|
||||
@ -607,7 +606,7 @@ xenProxyListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||
*
|
||||
* Returns the number of domain found or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
int
|
||||
xenProxyNumOfDomains(virConnectPtr conn)
|
||||
{
|
||||
virProxyPacket req;
|
||||
|
@ -96,4 +96,5 @@ extern char * xenProxyDomainDumpXML(virDomainPtr domain,
|
||||
int flags);
|
||||
extern int xenProxyListDomains(virConnectPtr conn, int *ids,
|
||||
int maxids);
|
||||
extern int xenProxyNumOfDomains(virConnectPtr conn);
|
||||
#endif /* __LIBVIR_PROXY_H__ */
|
||||
|
@ -589,13 +589,31 @@ static int
|
||||
xenUnifiedNumOfDomains (virConnectPtr conn)
|
||||
{
|
||||
GET_PRIVATE(conn);
|
||||
int i, ret;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
||||
if (priv->opened[i] && drivers[i]->numOfDomains) {
|
||||
ret = drivers[i]->numOfDomains (conn);
|
||||
if (ret >= 0) return ret;
|
||||
}
|
||||
/* Try xenstore. */
|
||||
if (priv->opened[XEN_UNIFIED_XS_OFFSET]) {
|
||||
ret = xenStoreNumOfDomains (conn);
|
||||
if (ret >= 0) return ret;
|
||||
}
|
||||
|
||||
/* Try HV. */
|
||||
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) {
|
||||
ret = xenHypervisorNumOfDomains (conn);
|
||||
if (ret >= 0) return ret;
|
||||
}
|
||||
|
||||
/* Try xend. */
|
||||
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
||||
ret = xenDaemonNumOfDomains (conn);
|
||||
if (ret >= 0) return ret;
|
||||
}
|
||||
|
||||
/* Try proxy. */
|
||||
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
|
||||
ret = xenProxyNumOfDomains (conn);
|
||||
if (ret >= 0) return ret;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -3696,7 +3696,7 @@ error:
|
||||
*
|
||||
* Returns the number of domain found or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
int
|
||||
xenDaemonNumOfDomains(virConnectPtr conn)
|
||||
{
|
||||
struct sexpr *root = NULL;
|
||||
|
@ -187,5 +187,6 @@ int xenDaemonDomainMigratePerform (virDomainPtr domain, const char *cookie, int
|
||||
|
||||
int xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, unsigned long long offset, size_t size, void *buffer);
|
||||
int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
|
||||
int xenDaemonNumOfDomains(virConnectPtr conn);
|
||||
|
||||
#endif /* __XEND_INTERNAL_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user