Skip to contentSkip to conversation

qemu-iotests: Add "-c <cache-mode>" to check

PATCH Superseded Fam Zheng 5 participants 8 messages Nov 14, 2013 – Nov 19, 2013

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 qemu-iotests: Add "-c <cache-mode>" to check

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

---
 tests/qemu-iotests/common     | 13 ++++++++++++-
 tests/qemu-iotests/iotests.py |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)
tests/qemu-iotests/common +12 -1
index 2932e14..f870c52 100644
@@ -42,12 +42,14 @@ expunge=true
 have_test_arg=false
 randomize=false
 valgrind=false
+cachemode=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 export IMGFMT=raw
 export IMGFMT_GENERIC=true
 export IMGPROTO=file
 export IMGOPTS=""
+export CACHEMODE="writethrough"
 export QEMU_IO_OPTIONS=""
 
 for r
@@ -113,7 +115,11 @@ s/ .*//p
         IMGOPTS="$r"
         imgopts=false
         continue
-
+    elif $cachemode
+    then
+        CACHEMODE="$r"
+        cachemode=false
+        continue
     fi
 
     xpand=true
@@ -147,6 +153,7 @@ check options
     -o options          -o options to pass to qemu-img create/convert
     -T                        output timestamps
     -r                         randomize test order
+    -c                  cache mode
 
 testlist options
     -g group[,group...]        include tests from these groups
@@ -259,6 +266,10 @@ testlist options
             imgopts=true
             xpand=false
             ;;
+        -c)
+            cachemode=true
+            xpand=false
+            ;;
         -r)        # randomize test order
             randomize=true
             xpand=false
tests/qemu-iotests/iotests.py +2 -1
index fb10ff4..c84a1a5 100644
@@ -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:
Signature · 1 line
1.8.4.2
#2 lore raw
In reply to Fam Zheng
Quoted 2 lines · Fam Zheng

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

Please make the default "writeback" so that ./check completes more quickly.

Also, please also indicate in the commit description why the change was made (i.e. you want qemu-iotests to succeed on tmpfs by default).

Stefan

#3 lore raw

Am 18.11.2013 um 16:29 hat Stefan Hajnoczi geschrieben:

Quoted 6 lines · Fam Zheng
Quoted 2 lines

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

Please make the default "writeback" so that ./check completes more quickly.

Changing the cache mode should be a separate patch.

The current default for all shell script based tests is cache=writethrough (can be overridden with -nocache) and Python test cases should respect the same setting.

This is also the problem that I see with this patch: It doesn't make '-nocache' an alias of '-c none', but both control different aspects. What should happen is that '-c <mode>' sets

QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -t <mode>"

like -nocache does today, and the Python scripts should refer to the same cache settings as the bash scripts do.

Kevin

author
#4 lore raw
Quoted 14 lines · Kevin Wolf

Am 18.11.2013 um 16:29 hat Stefan Hajnoczi geschrieben:

Quoted 6 lines · Fam Zheng
Quoted 2 lines

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

Please make the default "writeback" so that ./check completes more quickly.

Changing the cache mode should be a separate patch.

The current default for all shell script based tests is cache=writethrough (can be overridden with -nocache) and Python test cases should respect the same setting.

Quoted 9 lines

This is also the problem that I see with this patch: It doesn't make '-nocache' an alias of '-c none', but both control different aspects. What should happen is that '-c <mode>' sets

QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -t <mode>"

like -nocache does today, and the Python scripts should refer to the same cache settings as the bash scripts do.

Right. Thanks for explaining.

Fam

#5 lore raw
In reply to Fam Zheng
Quoted 8 lines · Fam Zheng

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

---
 tests/qemu-iotests/common     | 13 ++++++++++++-
 tests/qemu-iotests/iotests.py |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)

BTW, I looked back at Kevin's reply to your earlier patch and saw he suggested making the default "writethrough".

Kevin: Any reason not to use "writeback" by default?

#6 lore raw

Am 18.11.2013 um 16:32 hat Stefan Hajnoczi geschrieben:

Quoted 10 lines · Fam Zheng
Quoted 8 lines

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

---
 tests/qemu-iotests/common     | 13 ++++++++++++-
 tests/qemu-iotests/iotests.py |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)
Quoted 4 lines

BTW, I looked back at Kevin's reply to your earlier patch and saw he suggested making the default "writethrough".

Kevin: Any reason not to use "writeback" by default?

I'm not opposed to changing the default in a second step. It's just that writethrough is the default today and tests not respecting this are buggy. So the incremental fix is to make them obey the global setting, and then that setting can be tweaked in a second step.

Kevin

#7 lore raw
Quoted 14 lines · Kevin Wolf

Am 18.11.2013 um 16:32 hat Stefan Hajnoczi geschrieben:

Quoted 13 lines · Fam Zheng
Quoted 8 lines

The default cache mode for drive options is changed to writethrough, and overridable with "./check -c <mode>".

---
 tests/qemu-iotests/common     | 13 ++++++++++++-
 tests/qemu-iotests/iotests.py |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)

BTW, I looked back at Kevin's reply to your earlier patch and saw he suggested making the default "writethrough".

Quoted 6 lines
Quoted 1 line

Kevin: Any reason not to use "writeback" by default?

I'm not opposed to changing the default in a second step. It's just that writethrough is the default today and tests not respecting this are buggy. So the incremental fix is to make them obey the global setting, and then that setting can be tweaked in a second step.

Makes sense.

Stefan