ia64/xen-unstable

view tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py @ 7795:a06405d12a10

This test was failing for he wrong reason. Calls to block-attach after the
first *should* report failure, so the test should not fail because of this.
The test now fails because multiple calls to block-attach seem to detach the
block devicem, which is wrong.

Signed-off-by: Dan Smith <danms@us.ibm.com>
author dan@guaranine.beaverton.ibm.com
date Sat Nov 12 18:25:12 2005 +0100 (2005-11-12)
parents ecb5997f7b25
children 30f54abf9592
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: Murillo F. Bernardes <mfb@br.ibm.com>
6 import sys
7 import re
8 import time
10 from XmTestLib import *
13 # Create a domain (default XmTestDomain, with our ramdisk)
14 domain = XmTestDomain()
16 try:
17 domain.start()
18 except DomainError, e:
19 if verbose:
20 print "Failed to create test domain because:"
21 print e.extra
22 FAIL(str(e))
24 # Attach a console to it
25 try:
26 console = XmConsole(domain.getName(), historySaveCmds=True)
27 except ConsoleError, e:
28 FAIL(str(e))
30 try:
31 # Activate the console
32 console.sendInput("input")
33 # Run 'ls'
34 run = console.runCmd("ls")
35 except ConsoleError, e:
36 saveLog(console.getHistory())
37 FAIL(str(e))
39 for i in range(10):
40 status, output = traceCommand("xm block-attach %s phy:ram1 sdb1 w" % domain.getName())
41 if i == 0 and status != 0:
42 FAIL("xm block attach returned invalid %i != 0" % status)
43 if i > 0 and status == 0:
44 FAIL("xm block-attach (repeat) returned invalid %i > 0" % status)
45 run = console.runCmd("cat /proc/partitions")
46 if not re.search("sdb1", run['output']):
47 FAIL("Device is not actually attached to domU")
49 # Close the console
50 console.closeConsole()
52 # Stop the domain (nice shutdown)
53 domain.stop()