qemu-iotests: Honour cache mode in iotests.py
authorFam Zheng <famz@redhat.com>
Wed, 4 Dec 2013 01:06:59 +0000 (09:06 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 4 Dec 2013 10:55:13 +0000 (11:55 +0100)
This will allow overriding cache mode from the "-c mode" option.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
tests/qemu-iotests/iotests.py

index 10c9a99e3a56f5bb88c81313433d54ef294966ad..e4fa9af714609837d0c4b0b559064d76104bf65b 100644 (file)
@@ -37,6 +37,7 @@ qemu_args = os.environ.get('QEMU', 'qemu').strip().split(' ')
 imgfmt = os.environ.get('IMGFMT', 'raw')
 imgproto = os.environ.get('IMGPROTO', 'file')
 test_dir = os.environ.get('TEST_DIR', '/var/tmp')
+cachemode = os.environ.get('CACHEMODE')
 
 socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
 
@@ -96,7 +97,7 @@ class VM(object):
         '''Add a virtio-blk drive to the VM'''
         options = ['if=virtio',
                    'format=%s' % imgfmt,
-                   'cache=none',
+                   'cache=%s' % cachemode,
                    'file=%s' % path,
                    'id=drive%d' % self._num_drives]
         if opts: