mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
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>
This commit is contained in:
1 parent
90094c1bd4
commit
cbdece93b2
1 file changed
+6
-13
@@ -47,20 +47,13 @@ class XmError(Exception):
|
||||
def domid(name):
|
||||
status, output = traceCommand("xm domid " + name);
|
||||
|
||||
if re.search("Traceback", output):
|
||||
print "*** xm domid failed with:"
|
||||
print output
|
||||
for i in range(0,10):
|
||||
status, output = traceCommand("xm list")
|
||||
status, output = traceCommand("xm domid " + name);
|
||||
if not re.search("Traceback", output):
|
||||
break
|
||||
|
||||
if status != 0 or "Traceback" in output:
|
||||
return -1
|
||||
try:
|
||||
id = int(output);
|
||||
return int(output)
|
||||
except:
|
||||
id = -1;
|
||||
return id;
|
||||
raise XmError("xm domid failed", trace=output, status=status)
|
||||
|
||||
|
||||
def domname(id):
|
||||
status, output = traceCommand("xm domname " + str(id));
|
||||
@@ -75,7 +68,7 @@ def isDomainRunning(domain):
|
||||
|
||||
def getRunningDomains():
|
||||
status, output = traceCommand("xm list");
|
||||
if "Traceback" in output:
|
||||
if status != 0 or "Traceback" in output:
|
||||
raise XmError("xm failed", trace=output, status=status)
|
||||
|
||||
lines = output.splitlines();
|
||||
|
||||