qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
@ 2013-11-14  2:24 Fam Zheng
  2013-11-14  3:26 ` Wenchao Xia
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Fam Zheng @ 2013-11-14  2:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha

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

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/common     | 13 ++++++++++++-
 tests/qemu-iotests/iotests.py |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 2932e14..f870c52 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -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
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:
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-14  2:24 [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check Fam Zheng
@ 2013-11-14  3:26 ` Wenchao Xia
  2013-11-18 15:29 ` Stefan Hajnoczi
  2013-11-18 15:32 ` Stefan Hajnoczi
  2 siblings, 0 replies; 8+ messages in thread
From: Wenchao Xia @ 2013-11-14  3:26 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, stefanha

Tried on RH6.4 x86_64 on upstream, the value can be passed to the final
vm boot command.

Tested-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-14  2:24 [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check Fam Zheng
  2013-11-14  3:26 ` Wenchao Xia
@ 2013-11-18 15:29 ` Stefan Hajnoczi
  2013-11-18 15:38   ` Kevin Wolf
  2013-11-18 15:32 ` Stefan Hajnoczi
  2 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2013-11-18 15:29 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, qemu-devel, stefanha

On Thu, Nov 14, 2013 at 10:24:04AM +0800, Fam Zheng wrote:
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-14  2:24 [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check Fam Zheng
  2013-11-14  3:26 ` Wenchao Xia
  2013-11-18 15:29 ` Stefan Hajnoczi
@ 2013-11-18 15:32 ` Stefan Hajnoczi
  2013-11-18 15:40   ` Kevin Wolf
  2 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2013-11-18 15:32 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, qemu-devel, stefanha

On Thu, Nov 14, 2013 at 10:24:04AM +0800, Fam Zheng wrote:
> The default cache mode for drive options is changed to writethrough, and
> overridable with "./check -c <mode>".
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  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?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-18 15:29 ` Stefan Hajnoczi
@ 2013-11-18 15:38   ` Kevin Wolf
  2013-11-19  6:46     ` Fam Zheng
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Wolf @ 2013-11-18 15:38 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Fam Zheng, qemu-devel, stefanha

Am 18.11.2013 um 16:29 hat Stefan Hajnoczi geschrieben:
> On Thu, Nov 14, 2013 at 10:24:04AM +0800, Fam Zheng wrote:
> > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-18 15:32 ` Stefan Hajnoczi
@ 2013-11-18 15:40   ` Kevin Wolf
  2013-11-19  8:39     ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Wolf @ 2013-11-18 15:40 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Fam Zheng, qemu-devel, stefanha

Am 18.11.2013 um 16:32 hat Stefan Hajnoczi geschrieben:
> On Thu, Nov 14, 2013 at 10:24:04AM +0800, Fam Zheng wrote:
> > The default cache mode for drive options is changed to writethrough, and
> > overridable with "./check -c <mode>".
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  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?

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-18 15:38   ` Kevin Wolf
@ 2013-11-19  6:46     ` Fam Zheng
  0 siblings, 0 replies; 8+ messages in thread
From: Fam Zheng @ 2013-11-19  6:46 UTC (permalink / raw)
  To: Kevin Wolf, Stefan Hajnoczi; +Cc: qemu-devel, stefanha

On 2013年11月18日 23:38, Kevin Wolf wrote:
> Am 18.11.2013 um 16:29 hat Stefan Hajnoczi geschrieben:
>> On Thu, Nov 14, 2013 at 10:24:04AM +0800, Fam Zheng wrote:
>>> 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.
>

Right. Thanks for explaining.

Fam

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check
  2013-11-18 15:40   ` Kevin Wolf
@ 2013-11-19  8:39     ` Stefan Hajnoczi
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2013-11-19  8:39 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Stefan Hajnoczi, Fam Zheng, qemu-devel

On Mon, Nov 18, 2013 at 04:40:39PM +0100, Kevin Wolf wrote:
> Am 18.11.2013 um 16:32 hat Stefan Hajnoczi geschrieben:
> > On Thu, Nov 14, 2013 at 10:24:04AM +0800, Fam Zheng wrote:
> > > The default cache mode for drive options is changed to writethrough, and
> > > overridable with "./check -c <mode>".
> > > 
> > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > > ---
> > >  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?
> 
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-19  8:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14  2:24 [Qemu-devel] [PATCH] qemu-iotests: Add "-c <cache-mode>" to check Fam Zheng
2013-11-14  3:26 ` Wenchao Xia
2013-11-18 15:29 ` Stefan Hajnoczi
2013-11-18 15:38   ` Kevin Wolf
2013-11-19  6:46     ` Fam Zheng
2013-11-18 15:32 ` Stefan Hajnoczi
2013-11-18 15:40   ` Kevin Wolf
2013-11-19  8:39     ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).