diff options
author | Ewan Mellor <ewan@xensource.com> | 2007-03-20 16:52:33 +0000 |
---|---|---|
committer | Ewan Mellor <ewan@xensource.com> | 2007-03-20 16:52:33 +0000 |
commit | 06979e1dc429e57bf1e46c88dc8603efb26c06d2 (patch) | |
tree | 4b7e5bb79468d5771e9837a4c82949203e8e6a07 /tools/xm-test | |
parent | f6c7de277c0629f4d28637b5ee7492bd3f3db638 (diff) | |
download | xen-06979e1dc429e57bf1e46c88dc8603efb26c06d2.tar.gz xen-06979e1dc429e57bf1e46c88dc8603efb26c06d2.tar.bz2 xen-06979e1dc429e57bf1e46c88dc8603efb26c06d2.zip |
Have xm-test wait for the network device to detach. This is an asynchronous
process, so xm-test needs to poll.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Diffstat (limited to 'tools/xm-test')
-rw-r--r-- | tools/xm-test/tests/network-attach/network_utils.py | 19 |
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" |