[PULL 4/4] tests: Use iothreads during iotest 223

Eric Blake posted 4 patches 6 years, 4 months ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>, Max Reitz <mreitz@redhat.com>
There is a newer version of this series
[PULL 4/4] tests: Use iothreads during iotest 223
Posted by Eric Blake 6 years, 4 months ago
Doing so catches the bugs we just fixed with NBD not properly using
correct contexts.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190920220729.31801-1-eblake@redhat.com>
---
 tests/qemu-iotests/223     | 6 ++++--
 tests/qemu-iotests/223.out | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index cc48e78ea7dc..2ba3d8124b4f 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -2,7 +2,7 @@
 #
 # Test reading dirty bitmap over NBD
 #
-# Copyright (C) 2018 Red Hat, Inc.
+# Copyright (C) 2018-2019 Red Hat, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -109,7 +109,7 @@ echo
 echo "=== End dirty bitmaps, and start serving image over NBD ==="
 echo

-_launch_qemu 2> >(_filter_nbd)
+_launch_qemu -object iothread,id=io0 2> >(_filter_nbd)

 # Intentionally provoke some errors as well, to check error handling
 silent=
@@ -117,6 +117,8 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"qmp_capabilities"}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
   "arguments":{"driver":"qcow2", "node-name":"n",
     "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-blockdev-set-iothread",
+  "arguments":{"node-name":"n", "iothread":"io0"}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"block-dirty-bitmap-disable",
   "arguments":{"node":"n", "name":"b"}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
index 5d00398c11cb..23b34fcd202e 100644
--- a/tests/qemu-iotests/223.out
+++ b/tests/qemu-iotests/223.out
@@ -27,6 +27,7 @@ wrote 2097152/2097152 bytes at offset 2097152
 {"return": {}}
 {"return": {}}
 {"return": {}}
+{"return": {}}
 {"error": {"class": "GenericError", "desc": "NBD server not running"}}
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "NBD server already running"}}
-- 
2.21.0


Re: [PULL 4/4] tests: Use iothreads during iotest 223
Posted by Nir Soffer 6 years, 4 months ago
On Tue, Sep 24, 2019 at 4:18 PM Eric Blake <eblake@redhat.com> wrote:

> Doing so catches the bugs we just fixed with NBD not properly using
> correct contexts.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> Message-Id: <20190920220729.31801-1-eblake@redhat.com>
> ---
>  tests/qemu-iotests/223     | 6 ++++--
>  tests/qemu-iotests/223.out | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
> index cc48e78ea7dc..2ba3d8124b4f 100755
> --- a/tests/qemu-iotests/223
> +++ b/tests/qemu-iotests/223
> @@ -2,7 +2,7 @@
>  #
>  # Test reading dirty bitmap over NBD
>  #
> -# Copyright (C) 2018 Red Hat, Inc.
> +# Copyright (C) 2018-2019 Red Hat, Inc.
>  #
>  # This program is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
> @@ -109,7 +109,7 @@ echo
>  echo "=== End dirty bitmaps, and start serving image over NBD ==="
>  echo
>
> -_launch_qemu 2> >(_filter_nbd)
> +_launch_qemu -object iothread,id=io0 2> >(_filter_nbd)
>

But now we will not catch bugs in flows that do not use iothreads.

I think it will be better to run this test twice, one with iothreads, one
without.

 # Intentionally provoke some errors as well, to check error handling
>  silent=
> @@ -117,6 +117,8 @@ _send_qemu_cmd $QEMU_HANDLE
> '{"execute":"qmp_capabilities"}' "return"
>  _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
>    "arguments":{"driver":"qcow2", "node-name":"n",
>      "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return"
> +_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-blockdev-set-iothread",
> +  "arguments":{"node-name":"n", "iothread":"io0"}}' "return"
>  _send_qemu_cmd $QEMU_HANDLE '{"execute":"block-dirty-bitmap-disable",
>    "arguments":{"node":"n", "name":"b"}}' "return"
>  _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
> diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
> index 5d00398c11cb..23b34fcd202e 100644
> --- a/tests/qemu-iotests/223.out
> +++ b/tests/qemu-iotests/223.out
> @@ -27,6 +27,7 @@ wrote 2097152/2097152 bytes at offset 2097152
>  {"return": {}}
>  {"return": {}}
>  {"return": {}}
> +{"return": {}}
>  {"error": {"class": "GenericError", "desc": "NBD server not running"}}
>  {"return": {}}
>  {"error": {"class": "GenericError", "desc": "NBD server already running"}}
> --
> 2.21.0
>
>
>
Re: [PULL 4/4] tests: Use iothreads during iotest 223
Posted by Eric Blake 6 years, 4 months ago
On 9/24/19 8:49 AM, Nir Soffer wrote:
> On Tue, Sep 24, 2019 at 4:18 PM Eric Blake <eblake@redhat.com> wrote:
> 
>> Doing so catches the bugs we just fixed with NBD not properly using
>> correct contexts.
>>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>> Message-Id: <20190920220729.31801-1-eblake@redhat.com>
>> ---
>>  tests/qemu-iotests/223     | 6 ++++--
>>  tests/qemu-iotests/223.out | 1 +
>>  2 files changed, 5 insertions(+), 2 deletions(-)

>> -_launch_qemu 2> >(_filter_nbd)
>> +_launch_qemu -object iothread,id=io0 2> >(_filter_nbd)
>>
> 
> But now we will not catch bugs in flows that do not use iothreads.
> 
> I think it will be better to run this test twice, one with iothreads, one
> without.

Too late for this pull request, but I will propose that as a followup patch.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org