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

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/block-destroy/05_block-destroy_byname_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: Dan Smith <danms@us.ibm.com>
 
5
 
 
6
from XmTestLib import *
 
7
from XmTestLib.block_utils import block_detach
 
8
 
 
9
if ENABLE_HVM_SUPPORT:
 
10
    SKIP("Block-detach not supported for HVM domains")
 
11
 
 
12
config = {"disk":"phy:/dev/ram0,xvda1,w"}
 
13
domain = XmTestDomain(extraConfig=config)
 
14
 
 
15
try:
 
16
    console = domain.start()
 
17
except DomainError, e:
 
18
    if verbose:
 
19
        print e.extra
 
20
    FAIL("Unable to create domain")
 
21
 
 
22
try:
 
23
    run = console.runCmd("cat /proc/partitions | grep xvda1")
 
24
    run2 = console.runCmd("cat /proc/partitions")
 
25
except ConsoleError, e:
 
26
    FAIL(str(e))
 
27
 
 
28
if run["return"] != 0:
 
29
    FAIL("block device isn't attached; can't detach!")
 
30
 
 
31
block_detach(domain, "xvda1")
 
32
try:
 
33
 
 
34
    run = console.runCmd("cat /proc/partitions | grep xvda1")
 
35
except ConsoleError, e:
 
36
    saveLog(console.getHistory())
 
37
    FAIL(str(e))
 
38
 
 
39
domain.closeConsole()
 
40
domain.stop()
 
41
 
 
42
if run["return"] == 0:
 
43
    FAIL("domU reported block device still connected!" % run["return"])