source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_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.2 KB
Line 
1#!/usr/bin/python
2
3# Copyright (C) International Business Machines Corp., 2005
4# Author: Murillo F. Bernardes <mfb@br.ibm.com>
5
6import re
7
8from XmTestLib import *
9from XmTestLib.block_utils import *
10
11if ENABLE_HVM_SUPPORT:
12    SKIP("Block-attach not supported for HVM domains")
13
14# Create a domain (default XmTestDomain, with our ramdisk)
15domain = XmTestDomain()
16
17try:
18    console = domain.start()
19except DomainError, e:
20    if verbose:
21        print "Failed to create test domain because:"
22        print e.extra
23    FAIL(str(e))
24
25try:
26    console.setHistorySaveCmds(value=True)
27    # Run 'ls'
28    run = console.runCmd("ls")
29except ConsoleError, e:
30    saveLog(console.getHistory())
31    FAIL(str(e))
32   
33
34for i in range(10):
35    block_attach(domain, "phy:ram1", "xvda1")
36    run = console.runCmd("cat /proc/partitions")
37    if not re.search("xvda1", run["output"]):
38        FAIL("Failed to attach block device: /proc/partitions does not show that!")
39
40    block_detach(domain, "xvda1")
41    run = console.runCmd("cat /proc/partitions")
42    if re.search("xvda1", run["output"]):
43        FAIL("Failed to dettach block device: /proc/partitions still showing that!")
44
45# Close the console
46domain.closeConsole()
47
48# Stop the domain (nice shutdown)
49domain.stop()
Note: See TracBrowser for help on using the repository browser.