ia64/xen-unstable

changeset 8082:86a2e2645e40

Remove looping from handling of xm domid. This command should now work first
time after creation of a domain. Have the getRunningDomains method detect
failure of the xm list command, as indicated by the error code.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Sun Nov 27 01:01:42 2005 +0000 (2005-11-27)
parents 4f12ed3342dc
children 4195392fba06
files tools/xm-test/lib/XmTestLib/Xm.py
line diff
     1.1 --- a/tools/xm-test/lib/XmTestLib/Xm.py	Sun Nov 27 00:59:37 2005 +0000
     1.2 +++ b/tools/xm-test/lib/XmTestLib/Xm.py	Sun Nov 27 01:01:42 2005 +0000
     1.3 @@ -47,20 +47,13 @@ class XmError(Exception):
     1.4  def domid(name):
     1.5      status, output = traceCommand("xm domid " + name);
     1.6  
     1.7 -    if re.search("Traceback", output):
     1.8 -        print "*** xm domid failed with:"
     1.9 -        print output
    1.10 -        for i in range(0,10):
    1.11 -            status, output = traceCommand("xm list")
    1.12 -            status, output = traceCommand("xm domid " + name);
    1.13 -            if not re.search("Traceback", output):
    1.14 -                break
    1.15 -        
    1.16 +    if status != 0 or "Traceback" in output:
    1.17 +        return -1
    1.18      try:
    1.19 -        id = int(output);
    1.20 +        return int(output)
    1.21      except:
    1.22 -        id = -1;
    1.23 -    return id;
    1.24 +        raise XmError("xm domid failed", trace=output, status=status)
    1.25 +
    1.26  
    1.27  def domname(id):
    1.28      status, output = traceCommand("xm domname " + str(id));
    1.29 @@ -75,7 +68,7 @@ def isDomainRunning(domain):
    1.30  
    1.31  def getRunningDomains():
    1.32      status, output = traceCommand("xm list");
    1.33 -    if "Traceback" in output:
    1.34 +    if status != 0 or "Traceback" in output:
    1.35          raise XmError("xm failed", trace=output, status=status)
    1.36      
    1.37      lines = output.splitlines();