~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
                                                                                              
 
3
# Copyright (C) International Business Machines Corp., 2005
 
4
# Author: Li Ge <lge@us.ibm.com>
 
5
 
 
6
# Positive Test: create domain with block attach, attach another, verify both in list
 
7
 
 
8
 
 
9
from XmTestLib import *
 
10
 
 
11
if ENABLE_HVM_SUPPORT:
 
12
    SKIP("Block-list not supported for HVM domains")
 
13
 
 
14
config = {"disk":"phy:/dev/ram0,xvda1,w"}
 
15
domain = XmTestDomain(extraConfig=config)
 
16
 
 
17
try:
 
18
    console = domain.start()
 
19
except DomainError, e:
 
20
    if verbose:
 
21
        print e.extra
 
22
    FAIL("Unable to create domain")
 
23
 
 
24
status, output = traceCommand("xm block-list %s" % domain.getId())
 
25
if status != 0:
 
26
    FAIL("Fail to list block device")
 
27
 
 
28
#Add another virtual block device to the domain
 
29
status, output = traceCommand("xm block-attach %s phy:/dev/ram1 xvda2 w" % domain.getId())
 
30
if status != 0:
 
31
    FAIL("Fail to attach block device")
 
32
 
 
33
#Verify block-list on Domain0
 
34
status, output = traceCommand("xm block-list %s" % domain.getId())
 
35
eyecatcher1 = "51713"
 
36
eyecatcher2 = "51714"
 
37
where1 = output.find(eyecatcher1)
 
38
where2 = output.find(eyecatcher2)
 
39
if status != 0:
 
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")
 
43
 
 
44
#Verify attached block device on DomainU
 
45
try:
 
46
    run = console.runCmd("cat /proc/partitions | grep xvda1;cat /proc/partitions | grep xvda2")
 
47
except ConsoleError, e:
 
48
    saveLog(console.getHistory())
 
49
    FAIL(str(e))
 
50
 
 
51
domain.stop()
 
52
 
 
53
if run["return"] != 0:
 
54
    FAIL("Failed to verify that block dev is attached on DomainU")