source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.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.3 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 *
9
10if ENABLE_HVM_SUPPORT:
11    SKIP("Block-attach not supported for HVM domains")
12
13# Create a domain (default XmTestDomain, with our ramdisk)
14domain = XmTestDomain()
15
16try:
17    console = domain.start()
18except DomainError, e:
19    if verbose:
20        print "Failed to create test domain because:"
21        print e.extra
22    FAIL(str(e))
23
24try:
25    console.setHistorySaveCmds(value=True)
26    # Run 'ls'
27    run = console.runCmd("ls")
28except ConsoleError, e:
29    saveLog(console.getHistory())
30    FAIL(str(e))
31   
32
33status, output = traceCommand("xm block-attach %s phy:NOT-EXIST xvda1 w" % domain.getName())
34eyecatcher = "Error"
35where = re.compile(eyecatcher, re.IGNORECASE).search(output)
36if status == 0:
37    FAIL("xm block-attach returned bad status, expected non 0, status is: %i" % status )
38elif where is None:
39    FAIL("xm block-attach returned bad output, expected Error, output is: %s" % output )
40
41try:
42    run = console.runCmd("cat /proc/partitions")
43except ConsoleError, e:
44    FAIL(str(e))
45
46# Close the console
47domain.closeConsole()
48
49# Stop the domain (nice shutdown)
50domain.stop()
51
52if re.search("xvda1",run["output"]):
53    FAIL("Non existent Device was connected to the domU")
Note: See TracBrowser for help on using the repository browser.