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

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/block-list/02_block-list_attachbd_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, attach block device, verify list
 
7
 
 
8
 
 
9
from XmTestLib import *
 
10
from XmTestLib.block_utils import block_attach
 
11
 
 
12
if ENABLE_HVM_SUPPORT:
 
13
    SKIP("Block-list not supported for HVM domains")
 
14
 
 
15
domain = XmTestDomain()
 
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
#Attach one virtual block device to domainU
 
25
block_attach(domain, "phy:/dev/ram0", "xvda1")
 
26
 
 
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")
 
35
 
 
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))
 
42
 
 
43
domain.stop()
 
44
 
 
45
if run["return"] != 0:
 
46
    FAIL("Failed to verify that block dev is attached on DomainU")