mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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 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 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);
|
||||||
static char *xenProxyDomainGetOSType(virDomainPtr domain);
|
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
|
* Returns the number of domain found or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xenProxyNumOfDomains(virConnectPtr conn)
|
xenProxyNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virProxyPacket req;
|
virProxyPacket req;
|
||||||
|
@ -96,4 +96,5 @@ extern char * xenProxyDomainDumpXML(virDomainPtr domain,
|
|||||||
int flags);
|
int flags);
|
||||||
extern int xenProxyListDomains(virConnectPtr conn, int *ids,
|
extern int xenProxyListDomains(virConnectPtr conn, int *ids,
|
||||||
int maxids);
|
int maxids);
|
||||||
|
extern int xenProxyNumOfDomains(virConnectPtr conn);
|
||||||
#endif /* __LIBVIR_PROXY_H__ */
|
#endif /* __LIBVIR_PROXY_H__ */
|
||||||
|
@ -589,13 +589,31 @@ static int
|
|||||||
xenUnifiedNumOfDomains (virConnectPtr conn)
|
xenUnifiedNumOfDomains (virConnectPtr conn)
|
||||||
{
|
{
|
||||||
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]->numOfDomains) {
|
if (priv->opened[XEN_UNIFIED_XS_OFFSET]) {
|
||||||
ret = drivers[i]->numOfDomains (conn);
|
ret = xenStoreNumOfDomains (conn);
|
||||||
if (ret >= 0) return ret;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -3696,7 +3696,7 @@ error:
|
|||||||
*
|
*
|
||||||
* 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
|
||||||
xenDaemonNumOfDomains(virConnectPtr conn)
|
xenDaemonNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
struct sexpr *root = NULL;
|
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 xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, unsigned long long offset, size_t size, void *buffer);
|
||||||
int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
|
int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
|
||||||
|
int xenDaemonNumOfDomains(virConnectPtr conn);
|
||||||
|
|
||||||
#endif /* __XEND_INTERNAL_H_ */
|
#endif /* __XEND_INTERNAL_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user