[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Have xm-test wait for the network device to detach. This is an asynchronous



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174409553 0
# Node ID bea7ff5ebd608160d8258bc7b1cd911aac0d7f62
# Parent  fc918d15c981bb310c524674e2cd1f18320475d5
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@xxxxxxxxx>
---
 tools/xm-test/tests/network-attach/network_utils.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+)

diff -r fc918d15c981 -r bea7ff5ebd60 
tools/xm-test/tests/network-attach/network_utils.py
--- a/tools/xm-test/tests/network-attach/network_utils.py       Tue Mar 20 
15:15:37 2007 +0000
+++ b/tools/xm-test/tests/network-attach/network_utils.py       Tue Mar 20 
16:52:33 2007 +0000
@@ -11,6 +11,18 @@ def count_eth(console):
     except ConsoleError, e:
         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)
@@ -30,6 +42,13 @@ def network_detach(domain_name, console,
     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"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.