3 files changed, 41 insertions(+), 10 deletions(-)
tools/xm-test/lib/XmTestLib/Xm.py | 31 ++++++++--
tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py | 16 ++++-
tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py | 4 -
# HG changeset patch
# User Ryan Harper <ryanh@xxxxxxxxxx>
# Date 1155579355 18000
# Node ID 889b941effc8d050057a7edf3575067014e36d18
# Parent ec03b24a2d83273ec62db8596506b80577a0e41e
Change getVcpuInfo to return more information
diff -r ec03b24a2d83 -r 889b941effc8 tools/xm-test/lib/XmTestLib/Xm.py
--- a/tools/xm-test/lib/XmTestLib/Xm.py Tue Aug 15 19:53:55 2006 +0100
+++ b/tools/xm-test/lib/XmTestLib/Xm.py Mon Aug 14 13:15:55 2006 -0500
@@ -170,16 +170,35 @@ def getVcpuInfo(domain):
lines = output.split("\n")
- vcpus = {}
-
+ vcpus = []
for line in lines[1:]:
cols = re.split(" +", line)
+ info = {}
+ info['domain'] = cols[0]
+ info['id'] = cols[1]
+ info['vcpu'] = cols[2]
if cols[3] == '-':
- vcpus[int(cols[2])] = None
+ info['cpu'] = None
else:
- vcpus[int(cols[2])] = int(cols[3])
+ info['cpu'] = cols[3]
+ info['state'] = cols[4]
+ info['time'] = cols[5]
+ # make sure we join 'any' 'cpu' into single value
+ info['affinity'] = " ".join(cols[6:])
+ vcpus.append(info)
return vcpus
+
+def vcpu_to_cpu(domain):
+
+ vcpuinfo = getVcpuInfo(domain)
+ vcpus = {}
+
+ for info in vcpuinfo:
+ vcpus[int(info['vcpu'])] = info['cpu']
+
+ return vcpus
+
def getInfo(key):
@@ -240,6 +259,6 @@ if __name__ == "__main__":
print "Domain-0 CPU: " + cpu
print "Domain-0 state: " + state
- v = getVcpuInfo("Domain-0")
+ v = vcpu_to_cpu("Domain-0")
for key in v.keys():
- print "VCPU%i is on CPU %i" % (key, v[key])
+ print "VCPU%i is on CPU %s" % (key, v[key])
diff -r ec03b24a2d83 -r 889b941effc8
tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py
--- a/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py Tue Aug
15 19:53:55 2006 +0100
+++ b/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py Mon Aug
14 13:15:55 2006 -0500
@@ -49,6 +49,18 @@ except DomainError, e:
print e.extra
FAIL(str(e))
+# wait for both vcpus to come up
+vcpus_up = 0
+start = int(time.time())
+print "waiting for all VCPUS to come up"
+while vcpus_up != 2:
+ vcpus_up = len(filter(lambda x: x is not None,
vcpu_to_cpu(domain.getName())))
+ # 20 second timeout
+ if int(time.time()) >= start+20:
+ FAIL("Failed to bring all VCPUS online for test");
+ time.sleep(1)
+
+
# Disable VCPU 1
cmd = "xm vcpu-set %s 1" % domain.getName()
status, output = safecmd(cmd)
@@ -57,7 +69,7 @@ if check_status and status != 0:
# Wait for the change to become active
for i in [1,2,3,4,5,6,7,8,9,10]:
- domUvcpu1 = getVcpuInfo(domain.getName())[1]
+ domUvcpu1 = vcpu_to_cpu(domain.getName())[1]
status, output = traceCommand("xm vcpu-list")
if domUvcpu1 is None:
break
@@ -74,7 +86,7 @@ if check_status and status != 0:
FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
for i in [1,2,3,4,5,6,7,8,9,10]:
- domUvcpu1 = getVcpuInfo(domain.getName())[1]
+ domUvcpu1 = vcpu_to_cpu(domain.getName())[1]
if domUvcpu1 is not None:
break
time.sleep(1)
diff -r ec03b24a2d83 -r 889b941effc8
tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py
--- a/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py Tue Aug 15
19:53:55 2006 +0100
+++ b/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py Mon Aug 14
13:15:55 2006 -0500
@@ -32,7 +32,7 @@ if status != 0:
if status != 0:
FAIL("xm vcpu-pin returned invalid %i != 0" % status)
-cpu = getVcpuInfo(domain.getName())[0]
+cpu = int(vcpu_to_cpu(domain.getName())[0])
if cpu != 0:
FAIL("failed to switch VCPU 0 to CPU 0")
@@ -42,7 +42,7 @@ if status != 0:
if status != 0:
FAIL("xm vcpu-pin returned invalid %i != 0" % status)
-cpu = getVcpuInfo(domain.getName())[0]
+cpu = int(vcpu_to_cpu(domain.getName())[0])
if cpu != 1:
FAIL("failed to switch VCPU 0 to CPU 1")
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|