ia64/xen-unstable

changeset 18036:a762b4aed1a8

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 <berrange@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jul 11 12:47:50 2008 +0100 (2008-07-11)
parents e10b682f148d
children 1e24033fb775
files tools/python/xen/xend/server/XMLRPCServer.py
line diff
     1.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py	Fri Jul 11 12:46:33 2008 +0100
     1.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py	Fri Jul 11 12:47:50 2008 +0100
     1.3 @@ -64,7 +64,14 @@ def domains(detail = True, full = False)
     1.4  def domains_with_state(detail, state, full):
     1.5      if detail:
     1.6          domains = XendDomain.instance().list_sorted(state)
     1.7 -        return map(lambda dom: fixup_sxpr(dom.sxpr(not full)), domains)
     1.8 +        ret = []
     1.9 +        for dom in domains:
    1.10 +            try:
    1.11 +                ret.append(fixup_sxpr(dom.sxpr(not full)))
    1.12 +            except:
    1.13 +                log.warn("Failed to query SXPR for domain %s" % str(dom))
    1.14 +                pass
    1.15 +        return ret
    1.16      else:
    1.17          return XendDomain.instance().list_names(state)
    1.18