3
# Copyright (C) International Business Machines Corp., 2005
4
# Author: Li Ge <lge@us.ibm.com>
6
# Positive Test: create domain with block attach, attach another, verify both in list
9
from XmTestLib import *
11
if ENABLE_HVM_SUPPORT:
12
SKIP("Block-list not supported for HVM domains")
14
config = {"disk":"phy:/dev/ram0,xvda1,w"}
15
domain = XmTestDomain(extraConfig=config)
18
console = domain.start()
19
except DomainError, e:
22
FAIL("Unable to create domain")
24
status, output = traceCommand("xm block-list %s" % domain.getId())
26
FAIL("Fail to list block device")
28
#Add another virtual block device to the domain
29
status, output = traceCommand("xm block-attach %s phy:/dev/ram1 xvda2 w" % domain.getId())
31
FAIL("Fail to attach block device")
33
#Verify block-list on Domain0
34
status, output = traceCommand("xm block-list %s" % domain.getId())
37
where1 = output.find(eyecatcher1)
38
where2 = output.find(eyecatcher2)
40
FAIL("xm block-list returned bad status, expected 0, status is %i" % status)
41
elif (where1 < 0) and (where2 < 0):
42
FAIL("Fail to list all block devices after attaching another block device")
44
#Verify attached block device on DomainU
46
run = console.runCmd("cat /proc/partitions | grep xvda1;cat /proc/partitions | grep xvda2")
47
except ConsoleError, e:
48
saveLog(console.getHistory())
53
if run["return"] != 0:
54
FAIL("Failed to verify that block dev is attached on DomainU")