debuggers.hg

view tools/xm-test/tests/block-list/02_block-list_attachbd_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: Li Ge <lge@us.ibm.com)
6 # Positive Test: create domain, attach block device, verify list
9 from XmTestLib import *
10 from XmTestLib.block_utils import block_attach
12 if ENABLE_HVM_SUPPORT:
13 SKIP("Block-list not supported for HVM domains")
15 domain = XmTestDomain()
17 try:
18 console = domain.start()
19 except DomainError, e:
20 if verbose:
21 print e.extra
22 FAIL("Unable to create domain")
24 #Attach one virtual block device to domainU
25 block_attach(domain, "phy:/dev/ram0", "xvda1")
27 #Verify block-list on Domain0
28 status, output = traceCommand("xm block-list %s" % domain.getId())
29 eyecatcher = "51713"
30 where = output.find(eyecatcher)
31 if status != 0:
32 FAIL("xm block-list returned bad status, expected 0, status is %i" % status)
33 elif where < 0 :
34 FAIL("Fail to list block device")
36 #Verify attached block device on DomainU
37 try:
38 run = console.runCmd("cat /proc/partitions | grep xvda1")
39 except ConsoleError, e:
40 saveLog(console.getHistory())
41 FAIL(str(e))
43 domain.stop()
45 if run["return"] != 0:
46 FAIL("Failed to verify that block dev is attached on DomainU")