debuggers.hg

view tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: Dan Smith <danms@us.ibm.com>
6 from XmTestLib import *
7 from XmTestLib.block_utils import *
9 import re, time
11 def checkXmLongList(domain):
12 s, o = traceCommand("xm list --long %s" % domain.getName())
13 if s != 0:
14 FAIL("xm list --long <dom> failed")
15 if re.search("xvda1", o):
16 return True
17 else:
18 return False
20 if ENABLE_HVM_SUPPORT:
21 SKIP("Block-detach not supported for HVM domains")
23 domain = XmTestDomain()
25 try:
26 domain.start()
27 except DomainError,e:
28 FAIL(str(e))
30 block_attach(domain, "phy:/dev/ram0", "xvda1")
32 if not checkXmLongList(domain):
33 FAIL("xm long list does not show that xvda1 was attached")
35 block_detach(domain, "xvda1")
37 if checkXmLongList(domain):
38 # device info is removed by hotplug scripts - give them a chance
39 # to fire (they run asynchronously with us).
40 time.sleep(1)
41 if checkXmLongList(domain):
42 FAIL("xm long list does not show that xvda1 was removed")