~ressu/+junk/xen-ubuntu

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py

  • Committer: sami at haahtinen
  • Author(s): Bastian Blank
  • Date: 2010-09-03 15:14:28 UTC
  • Revision ID: sami@haahtinen.name-20100903151428-f88eg54n2fdnak41
Tags: upstream-4.0.1
ImportĀ upstreamĀ versionĀ 4.0.1

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: Dan Smith <danms@us.ibm.com>
 
5
 
 
6
from XmTestLib import *
 
7
from XmTestLib.block_utils import *
 
8
 
 
9
if ENABLE_HVM_SUPPORT:
 
10
    SKIP("Block-detach not supported for HVM domains")
 
11
 
 
12
domain = XmTestDomain()
 
13
 
 
14
try:
 
15
    console = domain.start()
 
16
except DomainError, e:
 
17
    if verbose:
 
18
        print e.extra
 
19
    FAIL("Unable to create domain")
 
20
 
 
21
block_attach(domain, "phy:/dev/ram0", "xvda1")
 
22
try:
 
23
    run = console.runCmd("cat /proc/partitions | grep xvda1")
 
24
except ConsoleError, e:
 
25
    saveLog(console.getHistory())
 
26
    FAIL(str(e))
 
27
 
 
28
if run["return"] != 0:
 
29
    FAIL("Failed to verify that block dev is attached")
 
30
 
 
31
block_detach(domain, "xvda1")
 
32
try:
 
33
    run = console.runCmd("cat /proc/partitions | grep xvda1")
 
34
except ConsoleError, e:
 
35
    saveLog(console.getHistory())
 
36
    FAIL(str(e))
 
37
 
 
38
domain.stop()
 
39
 
 
40
if run["return"] == 0:
 
41
    FAIL("block-detach failed to detach block device")