direct-io.hg

changeset 7980:092ac41ec8bd

Add tests for bug #331
author dan@guaranine.beaverton.ibm.com
date Wed Nov 23 12:31:55 2005 +0100 (2005-11-23)
parents 4b8599f53bb4
children 1d754a4ad350
files tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py tools/xm-test/tests/block-create/12_block_attach_shared_domU.py tools/xm-test/tests/block-create/Makefile.am
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py	Wed Nov 23 12:31:55 2005 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +#!/usr/bin/python
     1.5 +
     1.6 +# Copyright (C) International Business Machines Corp., 2005
     1.7 +# Author: Dan Smith <danms@us.ibm.com>
     1.8 +
     1.9 +from XmTestLib import *
    1.10 +
    1.11 +# Mount /dev/ram0
    1.12 +
    1.13 +s, o = traceCommand("mkfs /dev/ram0")
    1.14 +if s != 0:
    1.15 +    FAIL("Unable to mkfs /dev/ram0")
    1.16 +
    1.17 +s, o = traceCommand("mkdir -p mnt");
    1.18 +if s != 0:
    1.19 +    FAIL("Unable to create ./mnt")
    1.20 +
    1.21 +s, o = traceCommand("mount /dev/ram0 mnt -o rw")
    1.22 +if s != 0:
    1.23 +    FAIL("Unable to mount /dev/ram0 on ./mnt")
    1.24 +
    1.25 +# Now try to start a DomU with write access to /dev/ram0
    1.26 +
    1.27 +domain = XmTestDomain();
    1.28 +domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
    1.29 +
    1.30 +try:
    1.31 +    domain.start()
    1.32 +    s, o = traceCommand("umount mnt")
    1.33 +    FAIL("Bug #331: Started a DomU with write access to a rw mounted block device")
    1.34 +except DomainError, e:
    1.35 +    s, o = traceCommand("umount mnt")
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/xm-test/tests/block-create/12_block_attach_shared_domU.py	Wed Nov 23 12:31:55 2005 +0100
     2.3 @@ -0,0 +1,24 @@
     2.4 +#!/usr/bin/python
     2.5 +
     2.6 +# Copyright (C) International Business Machines Corp., 2005
     2.7 +# Author: Dan Smith <danms@us.ibm.com>
     2.8 +
     2.9 +from XmTestLib import *
    2.10 +
    2.11 +dom1 = XmTestDomain()
    2.12 +dom2 = XmTestDomain(dom1.getName() + "-2")
    2.13 +
    2.14 +dom1.configAddDisk("phy:/dev/ram0", "hda1", "w")
    2.15 +dom2.configAddDisk("phy:/dev/ram0", "hda1", "w")
    2.16 +
    2.17 +try:
    2.18 +    dom1.start()
    2.19 +except DomainError, e:
    2.20 +    FAIL("Unable to start domain")
    2.21 +
    2.22 +try:
    2.23 +    dom2.start()
    2.24 +    FAIL("Bug #331: Started a DomU with write access to an in-use block device")
    2.25 +except DomainError, e:
    2.26 +    pass
    2.27 +    
     3.1 --- a/tools/xm-test/tests/block-create/Makefile.am	Wed Nov 23 12:31:30 2005 +0100
     3.2 +++ b/tools/xm-test/tests/block-create/Makefile.am	Wed Nov 23 12:31:55 2005 +0100
     3.3 @@ -8,7 +8,9 @@ TESTS = 01_block_attach_device_pos.test 
     3.4  	06_block_attach_baddomain_neg.test \
     3.5  	07_block_attach_baddevice_neg.test \
     3.6  	08_block_attach_bad_filedevice_neg.test \
     3.7 -	09_block_attach_and_dettach_device_check_data_pos.test
     3.8 +	09_block_attach_and_dettach_device_check_data_pos.test \
     3.9 +	11_block_attach_shared_dom0.test \
    3.10 +	12_block_attach_shared_domU.test
    3.11  
    3.12  DISABLED = 
    3.13