qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iotests/qsd-jobs: Use common.qemu for the QSD
@ 2021-04-01 13:28 Max Reitz
  2021-04-01 13:28 ` [PATCH 1/2] iotests/common.qemu: Allow using " Max Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Max Reitz @ 2021-04-01 13:28 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, qemu-devel,
	Stefan Hajnoczi, Max Reitz

(Alternative to: “iotests/qsd-jobs: Filter events in the first test”)

Hi,

The qsd-jobs test has kind of unreliable output, because sometimes the
job is ready before ‘quit’, and sometimes it is not.  This series
presents one approach to fix that, which is to extend common.qemu to
allow running the storage daemon instead of qemu, and then to use that
in qsd-jobs to wait for the BLOCK_JOB_READY event before issuing the
‘quit’ command.

I took patch 1 from my “qcow2: Improve refcount structure rebuilding”
series.
(https://lists.nongnu.org/archive/html/qemu-block/2021-03/msg00654.html)

As noted above, this series is an alternative to “iotests/qsd-jobs:
Filter events in the first test”.  I like this series here better
because I’d prefer it if tests that do QMP actually check the output so
they control what’s really happening.
On the other hand, this may be too complicated for 6.0, and we might
want to fix qsd-jobs in 6.0.


Max Reitz (2):
  iotests/common.qemu: Allow using the QSD
  iotests/qsd-jobs: Use common.qemu for the QSD

 tests/qemu-iotests/common.qemu        | 53 +++++++++++++++++++++-----
 tests/qemu-iotests/tests/qsd-jobs     | 55 ++++++++++++++++++++-------
 tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++-
 3 files changed, 92 insertions(+), 26 deletions(-)

-- 
2.29.2



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

* [PATCH 1/2] iotests/common.qemu: Allow using the QSD
  2021-04-01 13:28 [PATCH 0/2] iotests/qsd-jobs: Use common.qemu for the QSD Max Reitz
@ 2021-04-01 13:28 ` Max Reitz
  2021-04-01 13:28 ` [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for " Max Reitz
  2021-04-26 10:06 ` [PATCH 0/2] " Stefan Hajnoczi
  2 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2021-04-01 13:28 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, qemu-devel,
	Stefan Hajnoczi, Max Reitz

For block things, we often do not need to run all of qemu, so allow
using the qemu-storage-daemon instead.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/common.qemu | 53 +++++++++++++++++++++++++++-------
 1 file changed, 43 insertions(+), 10 deletions(-)

diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 0fc52d20d7..ca8bb43c63 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -291,6 +291,8 @@ _wait_event()
 # $qmp_pretty: Set this variable to 'y' to enable QMP pretty printing.
 # $keep_stderr: Set this variable to 'y' to keep QEMU's stderr output on stderr.
 #               If this variable is empty, stderr will be redirected to stdout.
+# $qsd: Set this variable to 'y' to use the QSD instead of QEMU.
+#       stdout and stderr are never redirected when using the QSD.
 # Returns:
 # $QEMU_HANDLE: set to a handle value to communicate with this QEMU instance.
 #
@@ -300,18 +302,31 @@ _launch_qemu()
     local fifo_out=
     local fifo_in=
 
+    if [[ $qsd = 'y' ]]; then
+        mon_arg='--monitor'
+    else
+        mon_arg='-mon'
+    fi
+
     if (shopt -s nocasematch; [[ "${qemu_comm_method}" == "monitor" ]])
     then
-        comm="-monitor stdio"
+        comm=(--chardev stdio,id=pipe
+              $mon_arg pipe,mode=readline)
     else
         local qemu_comm_method="qmp"
         if [ "$qmp_pretty" = "y" ]; then
-            comm="-monitor none -qmp-pretty stdio"
+            comm=(--chardev stdio,id=pipe
+                  $mon_arg pipe,mode=control,pretty=on)
         else
-            comm="-monitor none -qmp stdio"
+            comm=(--chardev stdio,id=pipe
+                  $mon_arg pipe,mode=control,pretty=off)
         fi
     fi
 
+    if [[ $qsd != 'y' ]]; then
+        comm=(-monitor none "${comm[@]}")
+    fi
+
     fifo_out=${QEMU_FIFO_OUT}_${_QEMU_HANDLE}
     fifo_in=${QEMU_FIFO_IN}_${_QEMU_HANDLE}
     mkfifo "${fifo_out}"
@@ -322,15 +337,23 @@ _launch_qemu()
         object_options="--object secret,id=keysec0,data=$IMGKEYSECRET"
     fi
 
+    if [[ $qsd = 'y' ]]; then
+        cmd=$QSD
+        args=()
+    else
+        cmd=$QEMU
+        args=(-nographic -serial none)
+    fi
+    args+=(${object_options} "${comm[@]}")
+    args+=("$@")
+
+    # Just set both QEMU_NEED_PID and QSD_NEED_PID, it can't hurt.
     if [ -z "$keep_stderr" ]; then
-        QEMU_NEED_PID='y'\
-        ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \
-                                                       2>&1 \
-                                                       <"${fifo_in}" &
+        QEMU_NEED_PID='y' QSD_NEED_PID='y' $cmd "${args[@]}" \
+            >"$fifo_out" 2>&1 <"$fifo_in" &
     elif [ "$keep_stderr" = "y" ]; then
-        QEMU_NEED_PID='y'\
-        ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \
-                                                       <"${fifo_in}" &
+        QEMU_NEED_PID='y' QSD_NEED_PID='y' $cmd "${args[@]}" \
+            >"$fifo_out" <"$fifo_in" &
     else
         exit 1
     fi
@@ -360,6 +383,16 @@ _launch_qemu()
             silent=yes _timed_wait_for ${_QEMU_HANDLE} "^}"
         fi
     fi
+
+    if [[ $qsd = 'y' ]]; then
+        # Wait for PID file, then move it to where qemu would put it
+        pidfile="$QEMU_TEST_DIR/qemu-storage-daemon.pid"
+        while [[ ! -f $pidfile ]]; do
+            sleep 0.5
+        done
+        mv "$pidfile" "$QEMU_TEST_DIR/qemu-${_QEMU_HANDLE}.pid"
+    fi
+
     QEMU_HANDLE=${_QEMU_HANDLE}
     let _QEMU_HANDLE++
 }
-- 
2.29.2



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

* [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for the QSD
  2021-04-01 13:28 [PATCH 0/2] iotests/qsd-jobs: Use common.qemu for the QSD Max Reitz
  2021-04-01 13:28 ` [PATCH 1/2] iotests/common.qemu: Allow using " Max Reitz
@ 2021-04-01 13:28 ` Max Reitz
  2021-04-01 14:44   ` Vladimir Sementsov-Ogievskiy
  2021-04-26 10:06 ` [PATCH 0/2] " Stefan Hajnoczi
  2 siblings, 1 reply; 6+ messages in thread
From: Max Reitz @ 2021-04-01 13:28 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, qemu-devel,
	Stefan Hajnoczi, Max Reitz

Using common.qemu allows us to wait for specific replies, so we can for
example wait for events.  This allows starting the active commit job and
then wait for it to be ready before quitting the QSD, so we the output
is always the same.

(Strictly speaking, this is only necessary for the first test in
qsd-jobs, but we might as well make the second one use common.qemu's
infrastructure, too.)

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/tests/qsd-jobs     | 55 ++++++++++++++++++++-------
 tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++-
 2 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/qsd-jobs
index 972b6b3898..af7f886f15 100755
--- a/tests/qemu-iotests/tests/qsd-jobs
+++ b/tests/qemu-iotests/tests/qsd-jobs
@@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 cd ..
 . ./common.rc
 . ./common.filter
+. ./common.qemu
 
 _supported_fmt qcow2
 _supported_proto generic
@@ -52,32 +53,58 @@ echo "=== Job still present at shutdown ==="
 echo
 
 # Just make sure that this doesn't crash
-$QSD --chardev stdio,id=stdio --monitor chardev=stdio \
+qsd=y _launch_qemu \
     --blockdev node-name=file0,driver=file,filename="$TEST_IMG" \
-    --blockdev node-name=fmt0,driver=qcow2,file=file0 <<EOF | _filter_qmp
-{"execute":"qmp_capabilities"}
-{"execute": "block-commit", "arguments": {"device": "fmt0", "job-id": "job0"}}
-{"execute": "quit"}
-EOF
+    --blockdev node-name=fmt0,driver=qcow2,file=file0
+
+_send_qemu_cmd \
+    $QEMU_HANDLE \
+    '{"execute":"qmp_capabilities"}' \
+    'return'
+
+_send_qemu_cmd \
+    $QEMU_HANDLE \
+    '{"execute": "block-commit",
+      "arguments": {"device": "fmt0", "job-id": "job0"}}' \
+    'BLOCK_JOB_READY'
+
+_send_qemu_cmd \
+    $QEMU_HANDLE \
+    '{"execute": "quit"}' \
+    'return'
+
+wait=y _cleanup_qemu
 
 echo
 echo "=== Streaming can't get permission on base node ==="
 echo
 
 # Just make sure that this doesn't crash
-$QSD --chardev stdio,id=stdio --monitor chardev=stdio \
+qsd=y _launch_qemu \
     --blockdev node-name=file_base,driver=file,filename="$TEST_IMG.base" \
     --blockdev node-name=fmt_base,driver=qcow2,file=file_base \
     --blockdev node-name=file_overlay,driver=file,filename="$TEST_IMG" \
     --blockdev node-name=fmt_overlay,driver=qcow2,file=file_overlay,backing=fmt_base \
     --nbd-server addr.type=unix,addr.path="$SOCK_DIR/nbd.sock" \
-    --export type=nbd,id=export1,node-name=fmt_base,writable=on,name=export1 \
-    <<EOF | _filter_qmp
-{"execute": "qmp_capabilities"}
-{"execute": "block-stream",
-  "arguments": {"device": "fmt_overlay", "job-id": "job0"}}
-{"execute": "quit"}
-EOF
+    --export type=nbd,id=export1,node-name=fmt_base,writable=on,name=export1
+
+_send_qemu_cmd \
+    $QEMU_HANDLE \
+    '{"execute": "qmp_capabilities"}' \
+    'return'
+
+_send_qemu_cmd \
+    $QEMU_HANDLE \
+    '{"execute": "block-stream",
+      "arguments": {"device": "fmt_overlay", "job-id": "job0"}}' \
+    'error'
+
+_send_qemu_cmd \
+    $QEMU_HANDLE \
+    '{"execute": "quit"}' \
+    'return'
+
+wait=y _cleanup_qemu
 
 # success, all done
 echo "*** done"
diff --git a/tests/qemu-iotests/tests/qsd-jobs.out b/tests/qemu-iotests/tests/qsd-jobs.out
index 05e1165e80..5a14668939 100644
--- a/tests/qemu-iotests/tests/qsd-jobs.out
+++ b/tests/qemu-iotests/tests/qsd-jobs.out
@@ -4,13 +4,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
 
 === Job still present at shutdown ===
 
-QMP_VERSION
+{"execute":"qmp_capabilities"}
 {"return": {}}
+{"execute": "block-commit",
+      "arguments": {"device": "fmt0", "job-id": "job0"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
+{"execute": "quit"}
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "standby", "id": "job0"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
@@ -22,11 +25,14 @@ QMP_VERSION
 
 === Streaming can't get permission on base node ===
 
-QMP_VERSION
+{"execute": "qmp_capabilities"}
 {"return": {}}
+{"execute": "block-stream",
+      "arguments": {"device": "fmt_overlay", "job-id": "job0"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}}
 {"error": {"class": "GenericError", "desc": "Conflicts with use by a block device as 'root', which uses 'write' on fmt_base"}}
+{"execute": "quit"}
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export1"}}
 *** done
-- 
2.29.2



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

* Re: [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for the QSD
  2021-04-01 13:28 ` [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for " Max Reitz
@ 2021-04-01 14:44   ` Vladimir Sementsov-Ogievskiy
  2021-04-01 15:33     ` Max Reitz
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2021-04-01 14:44 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: qemu-devel, Kevin Wolf, Stefan Hajnoczi

01.04.2021 16:28, Max Reitz wrote:
> Using common.qemu allows us to wait for specific replies, so we can for
> example wait for events.  This allows starting the active commit job and
> then wait for it to be ready before quitting the QSD, so we the output
> is always the same.
> 
> (Strictly speaking, this is only necessary for the first test in
> qsd-jobs, but we might as well make the second one use common.qemu's
> infrastructure, too.)
> 

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/tests/qsd-jobs     | 55 ++++++++++++++++++++-------
>   tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++-
>   2 files changed, 49 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/qsd-jobs
> index 972b6b3898..af7f886f15 100755
> --- a/tests/qemu-iotests/tests/qsd-jobs
> +++ b/tests/qemu-iotests/tests/qsd-jobs
> @@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>   cd ..
>   . ./common.rc
>   . ./common.filter
> +. ./common.qemu
>   
>   _supported_fmt qcow2
>   _supported_proto generic
> @@ -52,32 +53,58 @@ echo "=== Job still present at shutdown ==="
>   echo
>   
>   # Just make sure that this doesn't crash
> -$QSD --chardev stdio,id=stdio --monitor chardev=stdio \
> +qsd=y _launch_qemu \

sounds a bit strange.. Like we are starting qemu.

>       --blockdev node-name=file0,driver=file,filename="$TEST_IMG" \
> -    --blockdev node-name=fmt0,driver=qcow2,file=file0 <<EOF | _filter_qmp
> -{"execute":"qmp_capabilities"}
> -{"execute": "block-commit", "arguments": {"device": "fmt0", "job-id": "job0"}}
> -{"execute": "quit"}
> -EOF
> +    --blockdev node-name=fmt0,driver=qcow2,file=file0
> +
> +_send_qemu_cmd \
> +    $QEMU_HANDLE \
> +    '{"execute":"qmp_capabilities"}' \
> +    'return'
> +
> +_send_qemu_cmd \
> +    $QEMU_HANDLE \
> +    '{"execute": "block-commit",
> +      "arguments": {"device": "fmt0", "job-id": "job0"}}' \
> +    'BLOCK_JOB_READY'
> +
> +_send_qemu_cmd \
> +    $QEMU_HANDLE \
> +    '{"execute": "quit"}' \
> +    'return'
> +
> +wait=y _cleanup_qemu
>   
>   echo
>   echo "=== Streaming can't get permission on base node ==="
>   echo
>   
>   # Just make sure that this doesn't crash
> -$QSD --chardev stdio,id=stdio --monitor chardev=stdio \
> +qsd=y _launch_qemu \
>       --blockdev node-name=file_base,driver=file,filename="$TEST_IMG.base" \
>       --blockdev node-name=fmt_base,driver=qcow2,file=file_base \
>       --blockdev node-name=file_overlay,driver=file,filename="$TEST_IMG" \
>       --blockdev node-name=fmt_overlay,driver=qcow2,file=file_overlay,backing=fmt_base \
>       --nbd-server addr.type=unix,addr.path="$SOCK_DIR/nbd.sock" \
> -    --export type=nbd,id=export1,node-name=fmt_base,writable=on,name=export1 \
> -    <<EOF | _filter_qmp
> -{"execute": "qmp_capabilities"}
> -{"execute": "block-stream",
> -  "arguments": {"device": "fmt_overlay", "job-id": "job0"}}
> -{"execute": "quit"}
> -EOF
> +    --export type=nbd,id=export1,node-name=fmt_base,writable=on,name=export1
> +
> +_send_qemu_cmd \
> +    $QEMU_HANDLE \
> +    '{"execute": "qmp_capabilities"}' \
> +    'return'
> +
> +_send_qemu_cmd \
> +    $QEMU_HANDLE \
> +    '{"execute": "block-stream",
> +      "arguments": {"device": "fmt_overlay", "job-id": "job0"}}' \
> +    'error'
> +
> +_send_qemu_cmd \
> +    $QEMU_HANDLE \
> +    '{"execute": "quit"}' \
> +    'return'
> +
> +wait=y _cleanup_qemu
>   
>   # success, all done
>   echo "*** done"
> diff --git a/tests/qemu-iotests/tests/qsd-jobs.out b/tests/qemu-iotests/tests/qsd-jobs.out
> index 05e1165e80..5a14668939 100644
> --- a/tests/qemu-iotests/tests/qsd-jobs.out
> +++ b/tests/qemu-iotests/tests/qsd-jobs.out
> @@ -4,13 +4,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
>   
>   === Job still present at shutdown ===
>   
> -QMP_VERSION
> +{"execute":"qmp_capabilities"}
>   {"return": {}}
> +{"execute": "block-commit",
> +      "arguments": {"device": "fmt0", "job-id": "job0"}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
>   {"return": {}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
> +{"execute": "quit"}
>   {"return": {}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "standby", "id": "job0"}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
> @@ -22,11 +25,14 @@ QMP_VERSION
>   
>   === Streaming can't get permission on base node ===
>   
> -QMP_VERSION
> +{"execute": "qmp_capabilities"}
>   {"return": {}}
> +{"execute": "block-stream",
> +      "arguments": {"device": "fmt_overlay", "job-id": "job0"}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}}
>   {"error": {"class": "GenericError", "desc": "Conflicts with use by a block device as 'root', which uses 'write' on fmt_base"}}
> +{"execute": "quit"}
>   {"return": {}}
>   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export1"}}
>   *** done
> 


-- 
Best regards,
Vladimir


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

* Re: [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for the QSD
  2021-04-01 14:44   ` Vladimir Sementsov-Ogievskiy
@ 2021-04-01 15:33     ` Max Reitz
  0 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2021-04-01 15:33 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy, qemu-block
  Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

On 01.04.21 16:44, Vladimir Sementsov-Ogievskiy wrote:
> 01.04.2021 16:28, Max Reitz wrote:
>> Using common.qemu allows us to wait for specific replies, so we can for
>> example wait for events.  This allows starting the active commit job and
>> then wait for it to be ready before quitting the QSD, so we the output
>> is always the same.
>>
>> (Strictly speaking, this is only necessary for the first test in
>> qsd-jobs, but we might as well make the second one use common.qemu's
>> infrastructure, too.)
>>
> 
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> 
>> Reported-by: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>   tests/qemu-iotests/tests/qsd-jobs     | 55 ++++++++++++++++++++-------
>>   tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++-
>>   2 files changed, 49 insertions(+), 16 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/tests/qsd-jobs 
>> b/tests/qemu-iotests/tests/qsd-jobs
>> index 972b6b3898..af7f886f15 100755
>> --- a/tests/qemu-iotests/tests/qsd-jobs
>> +++ b/tests/qemu-iotests/tests/qsd-jobs
>> @@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>>   cd ..
>>   . ./common.rc
>>   . ./common.filter
>> +. ./common.qemu
>>   _supported_fmt qcow2
>>   _supported_proto generic
>> @@ -52,32 +53,58 @@ echo "=== Job still present at shutdown ==="
>>   echo
>>   # Just make sure that this doesn't crash
>> -$QSD --chardev stdio,id=stdio --monitor chardev=stdio \
>> +qsd=y _launch_qemu \
> 
> sounds a bit strange.. Like we are starting qemu.

Yeah, well.  Yeah.  We could have a

_launch_qsd()
{
     qsd=y _launch_qemu
}

But this would still make it weird for all the other commands from 
common.qemu, and I don’t think it makes much sense to introduce aliases 
for all of them.  So I think it’d be best to live with that bit of 
weirdness.

Max



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

* Re: [PATCH 0/2] iotests/qsd-jobs: Use common.qemu for the QSD
  2021-04-01 13:28 [PATCH 0/2] iotests/qsd-jobs: Use common.qemu for the QSD Max Reitz
  2021-04-01 13:28 ` [PATCH 1/2] iotests/common.qemu: Allow using " Max Reitz
  2021-04-01 13:28 ` [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for " Max Reitz
@ 2021-04-26 10:06 ` Stefan Hajnoczi
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2021-04-26 10:06 UTC (permalink / raw)
  To: Max Reitz
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, qemu-devel, qemu-block

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

On Thu, Apr 01, 2021 at 03:28:13PM +0200, Max Reitz wrote:
> (Alternative to: “iotests/qsd-jobs: Filter events in the first test”)
> 
> Hi,
> 
> The qsd-jobs test has kind of unreliable output, because sometimes the
> job is ready before ‘quit’, and sometimes it is not.  This series
> presents one approach to fix that, which is to extend common.qemu to
> allow running the storage daemon instead of qemu, and then to use that
> in qsd-jobs to wait for the BLOCK_JOB_READY event before issuing the
> ‘quit’ command.
> 
> I took patch 1 from my “qcow2: Improve refcount structure rebuilding”
> series.
> (https://lists.nongnu.org/archive/html/qemu-block/2021-03/msg00654.html)
> 
> As noted above, this series is an alternative to “iotests/qsd-jobs:
> Filter events in the first test”.  I like this series here better
> because I’d prefer it if tests that do QMP actually check the output so
> they control what’s really happening.
> On the other hand, this may be too complicated for 6.0, and we might
> want to fix qsd-jobs in 6.0.
> 
> 
> Max Reitz (2):
>   iotests/common.qemu: Allow using the QSD
>   iotests/qsd-jobs: Use common.qemu for the QSD
> 
>  tests/qemu-iotests/common.qemu        | 53 +++++++++++++++++++++-----
>  tests/qemu-iotests/tests/qsd-jobs     | 55 ++++++++++++++++++++-------
>  tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++-
>  3 files changed, 92 insertions(+), 26 deletions(-)
> 
> -- 
> 2.29.2
> 

Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-04-26 10:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 13:28 [PATCH 0/2] iotests/qsd-jobs: Use common.qemu for the QSD Max Reitz
2021-04-01 13:28 ` [PATCH 1/2] iotests/common.qemu: Allow using " Max Reitz
2021-04-01 13:28 ` [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for " Max Reitz
2021-04-01 14:44   ` Vladimir Sementsov-Ogievskiy
2021-04-01 15:33     ` Max Reitz
2021-04-26 10:06 ` [PATCH 0/2] " 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).