source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

  • Property svn:mime-type set to text/script
File size: 1.0 KB
Line 
1#!/usr/bin/python
2
3# Copyright (C) International Business Machines Corp., 2005
4# Author: Dan Smith <danms@us.ibm.com>
5
6from XmTestLib import *
7from XmTestLib.block_utils import *
8
9import re, time
10
11def checkXmLongList(domain):
12    s, o = traceCommand("xm list --long %s" % domain.getName())
13    if s != 0:
14        FAIL("xm list --long <dom> failed")
15    if re.search("xvda1", o):
16        return True
17    else:
18        return False
19
20if ENABLE_HVM_SUPPORT:
21    SKIP("Block-detach not supported for HVM domains")
22
23domain = XmTestDomain()
24
25try:
26    domain.start()
27except DomainError,e:
28    FAIL(str(e))
29
30block_attach(domain, "phy:/dev/ram0", "xvda1")
31
32if not checkXmLongList(domain):
33    FAIL("xm long list does not show that xvda1 was attached")
34
35block_detach(domain, "xvda1")
36
37if checkXmLongList(domain):
38    # device info is removed by hotplug scripts - give them a chance
39    # to fire (they run asynchronously with us).
40    time.sleep(1)
41    if checkXmLongList(domain):
42        FAIL("xm long list does not show that xvda1 was removed")
Note: See TracBrowser for help on using the repository browser.