aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/network-attach/network_utils.py
diff options
context:
space:
mode:
authorHollis Blanchard <hollisb@us.ibm.com>2007-03-21 18:08:31 -0500
committerHollis Blanchard <hollisb@us.ibm.com>2007-03-21 18:08:31 -0500
commit001e8c5cd8f60e7cafbfed9869862db46b5ed473 (patch)
tree7ac30f8387c3f66c1860ea9421e0a681bb4b4b7f /tools/xm-test/tests/network-attach/network_utils.py
parenta7706a8de0119f07b6f7e014a78fd07947af3787 (diff)
parent5b3327347f83a473755b00a76ff1176dc6cda301 (diff)
downloadxen-001e8c5cd8f60e7cafbfed9869862db46b5ed473.tar.gz
xen-001e8c5cd8f60e7cafbfed9869862db46b5ed473.tar.bz2
xen-001e8c5cd8f60e7cafbfed9869862db46b5ed473.zip
Merge with xen-unstable.hg.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Diffstat (limited to 'tools/xm-test/tests/network-attach/network_utils.py')
-rw-r--r--tools/xm-test/tests/network-attach/network_utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/xm-test/tests/network-attach/network_utils.py b/tools/xm-test/tests/network-attach/network_utils.py
index 084b5ebd90..93fe72a811 100644
--- a/tools/xm-test/tests/network-attach/network_utils.py
+++ b/tools/xm-test/tests/network-attach/network_utils.py
@@ -12,6 +12,18 @@ def count_eth(console):
FAIL(str(e))
return len(run['output'].splitlines())
+def get_state(domain_name, number):
+ s, o = traceCommand("xm network-list %s | awk '/^%d/ {print $5}'" %
+ (domain_name, number))
+ print o
+
+ if s != 0:
+ FAIL("network-list failed")
+ if o == "":
+ return 0
+ else:
+ return int(o)
+
def network_attach(domain_name, console):
eths_before = count_eth(console)
status, output = traceCommand("xm network-attach %s" % domain_name)
@@ -30,6 +42,13 @@ def network_detach(domain_name, console, num=0):
if status != 0:
return -1, "xm network-detach returned invalid %i != 0" % status
+ for i in range(10):
+ if get_state(domain_name, num) == 0:
+ break
+ time.sleep(1)
+ else:
+ FAIL("network-detach failed: device did not disappear")
+
eths_after = count_eth(console)
if eths_after != (eths_before-1):
return -2, "Network device was not actually disconnected from domU"