ia64/xen-unstable

changeset 9795:dbf7032f1fc6

Continue to diagnose the device state, even if Xend has crashed.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Thu Apr 20 17:16:27 2006 +0100 (2006-04-20)
parents 482c3d3cbc92
children daa8047710d0
files tools/python/xen/util/diagnose.py
line diff
     1.1 --- a/tools/python/xen/util/diagnose.py	Thu Apr 20 17:09:53 2006 +0100
     1.2 +++ b/tools/python/xen/util/diagnose.py	Thu Apr 20 17:16:27 2006 +0100
     1.3 @@ -11,10 +11,11 @@
     1.4  # License along with this library; if not, write to the Free Software
     1.5  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     1.6  #
     1.7 -# Copyright (c) 2005 XenSource Ltd
     1.8 +# Copyright (c) 2005-2006 XenSource Inc
     1.9  
    1.10  
    1.11  import re
    1.12 +import socket
    1.13  import sys
    1.14  
    1.15  from xen.xend import sxp
    1.16 @@ -45,7 +46,6 @@ def diagnose(dom):
    1.17          state = sxp.child_value(domain, 'state')
    1.18          domid = int(sxp.child_value(domain, 'domid'))
    1.19          name = sxp.child_value(domain, 'name')
    1.20 -        dompath = '/local/domain/%d' % domid
    1.21  
    1.22          print "Domain ID is %d." % domid
    1.23          print "Domain name is %s." % name
    1.24 @@ -55,12 +55,23 @@ def diagnose(dom):
    1.25  
    1.26          if state.find('c') != -1:
    1.27              print "Domain has crashed."
    1.28 +    except socket.error, exn:
    1.29 +        print "Cannot contact Xend."
    1.30  
    1.31 -        diagnose_console()
    1.32 -
    1.33 -        diagnose_devices()
    1.34 +        try:
    1.35 +            domid = int(dom)
    1.36 +            name = dom
    1.37 +        except ValueError:
    1.38 +            print \
    1.39 +"Without Xend, you will have to specify the domain ID, not the domain name."
    1.40 +            sys.exit(1)
    1.41      except xen.xend.XendProtocol.XendError, exn:
    1.42          print exn
    1.43 +        sys.exit(1)
    1.44 +
    1.45 +    dompath = '/local/domain/%d' % domid
    1.46 +    diagnose_console()
    1.47 +    diagnose_devices()
    1.48  
    1.49  
    1.50  def diagnose_console():