diff mbox

[v5,2/6] qemu-iotests: Honour cache mode in iotests.py

Message ID 1386059127-30962-3-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng Dec. 3, 2013, 8:25 a.m. UTC
This will allow overriding cache mode from the "-c mode" option.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/iotests.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Benoît Canet Dec. 3, 2013, 2:27 p.m. UTC | #1
Le Tuesday 03 Dec 2013 à 16:25:23 (+0800), Fam Zheng a écrit :
> This will allow overriding cache mode from the "-c mode" option.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index fb10ff4..c84a1a5 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -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')
+cachemode = os.environ.get('CACHEMODE', "none")

This way the default would be preserved.

>  
>  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:
> -- 
> 1.8.4.2
> 
>
Kevin Wolf Dec. 3, 2013, 3:19 p.m. UTC | #2
Am 03.12.2013 um 15:27 hat Benoît Canet geschrieben:
> Le Tuesday 03 Dec 2013 à 16:25:23 (+0800), Fam Zheng a écrit :
> > This will allow overriding cache mode from the "-c mode" option.
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  tests/qemu-iotests/iotests.py | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> > index fb10ff4..c84a1a5 100644
> > --- a/tests/qemu-iotests/iotests.py
> > +++ b/tests/qemu-iotests/iotests.py
> > @@ -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')
> +cachemode = os.environ.get('CACHEMODE', "none")
> 
> This way the default would be preserved.

CACHEMODE is always set, so you'd never get the default anyway. If
anything, it would have to use that other environment variable that
tells us if we're running the default. It's probably not necessary,
though.

Kevin
diff mbox

Patch

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index fb10ff4..c84a1a5 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -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: