From: Keir Fraser Date: Fri, 11 Jul 2008 11:47:50 +0000 (+0100) Subject: xend: Ignore errors from dying domains in RPC server X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14188^2~43 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b7e17149f3579bf5e99d51e1f9f6524631bfd2ee;p=xen.git xend: Ignore errors from dying domains in RPC server When a domain is in the process of shutting down there is a small window when the domain is known to XenD, but it will be unable to form an SXPR for it due it being in the middle of device hot-unplug. This causes the 'xm list' command to totally fail with an error like # xm list Error: Device 0 not connected Usage: xm list [options] [Domain, ...] The 'xm list' command calls into the 'domains' method of XMLRPCServer.py in XenD. This method just iterates over the list of domains, fetching the sxpr for each in turn, but with no exception handling. So if a single domain fails to generate an sxpr, no data is returned even for other domains which are still functional. This patch simply makes XenD ignore and skip over domains which throw an exception, logging the problematic domain. NB, this problem only hits 'xm list' if it is configured to use the legay XMLRPC server instead of XenAPI. Signed-off-by: Daniel P. Berrange --- diff --git a/tools/python/xen/xend/server/XMLRPCServer.py b/tools/python/xen/xend/server/XMLRPCServer.py index 6aad3df9bd..96c0ac24aa 100644 --- a/tools/python/xen/xend/server/XMLRPCServer.py +++ b/tools/python/xen/xend/server/XMLRPCServer.py @@ -64,7 +64,14 @@ def domains(detail = True, full = False): def domains_with_state(detail, state, full): if detail: domains = XendDomain.instance().list_sorted(state) - return map(lambda dom: fixup_sxpr(dom.sxpr(not full)), domains) + ret = [] + for dom in domains: + try: + ret.append(fixup_sxpr(dom.sxpr(not full))) + except: + log.warn("Failed to query SXPR for domain %s" % str(dom)) + pass + return ret else: return XendDomain.instance().list_names(state)