aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py
blob: 292db063d60c09b537fc2c40245ae037b11dd35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python

# Copyright (C) International Business Machines Corp., 2005
# Author: Dan Smith <danms@us.ibm.com>

from XmTestLib import *
from XmTestLib.block_utils import *

import re

def checkXmLongList(domain):
    s, o = traceCommand("xm list --long %s" % domain.getName())
    if s != 0:
        FAIL("xm list --long <dom> failed")
    if re.search("xvda1", o):
        return True
    else:
        return False

if ENABLE_HVM_SUPPORT:
    SKIP("Block-detach not supported for HVM domains")

domain = XmTestDomain()

try:
    domain.start()
except DomainError,e:
    FAIL(str(e))

block_attach(domain, "phy:/dev/ram0", "xvda1")

if not checkXmLongList(domain):
    FAIL("xm long list does not show that xvda1 was attached")

block_detach(domain, "xvda1")

if checkXmLongList(domain):
    FAIL("xm long list does not show that xvda1 was removed")