Skip to contentSkip to conversation

iotests: fix 185

PATCH Superseded Vladimir Sementsov-Ogievskiy 3 participants 15 messages Aug 7, 2017 – Aug 8, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests: fix 185

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
    15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300 @@ -37,7 +37,7 @@
{"return": {}}
{"return": {}}

 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
    "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
        "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
            "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
    "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
        "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

=== Start backup job and exit qemu ===

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

---
 tests/qemu-iotests/185     | 2 +-
 tests/qemu-iotests/185.out | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/185 +1 -1
index 0eda371f27..446d78447e 100755
@@ -157,7 +157,7 @@ _send_qemu_cmd $h \
     "return"
 
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
-wait=1 _cleanup_qemu
+wait=1 _cleanup_qemu | _filter_block_job_offset
 
 echo
 echo === Start backup job and exit qemu ===
tests/qemu-iotests/185.out +1 -1
index 57eaf8d699..f51af627fe 100644
@@ -37,7 +37,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
 {"return": {}}
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": OFFSET, "speed": 65536, "type": "mirror"}}
 
 === Start backup job and exit qemu ===
 
Signature · 1 line
2.11.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Vladimir Sementsov-Ogievskiy

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
    15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +0 -0
@@ -37,7 +37,7 @@
 {"return": {}}

Review

Quoted 10 lines
(quoted diff) +1 -1
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
    "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
        "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
            "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
    "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
        "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

This diff says both 'len' and 'offset' differ...

Quoted 9 lines

=== Start backup job and exit qemu ===

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

s/let/let's/

tests/qemu-iotests/185.out Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l · line 40

Quoted 9 lines
---
 tests/qemu-iotests/185     | 2 +-
 tests/qemu-iotests/185.out | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/185.out +1 -1
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": OFFSET, "speed": 65536, "type": "mirror"}}

...while this diff only touched 'offset'. Did you copy-and-paste incorrectly in the commit message? If so, then with the commit message fixed, I'm okay with:

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#2 lore raw
Quoted 47 lines · Eric Blake
Quoted 14 lines · Vladimir Sementsov-Ogievskiy

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
     15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +0 -0
@@ -37,7 +37,7 @@
  {"return": {}}

Review

Quoted 10 lines
(quoted diff) +1 -1
  {"return": {}}
  {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
      "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
             "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

This diff says both 'len' and 'offset' differ...

Quoted 8 lines

=== Start backup job and exit qemu ===

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

s/let/let's/

tests/qemu-iotests/185.out Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l · line 40

Quoted 7 lines
---
  tests/qemu-iotests/185     | 2 +-
  tests/qemu-iotests/185.out | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/185.out +1 -1
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": OFFSET, "speed": 65536, "type": "mirror"}}

...while this diff only touched 'offset'. Did you copy-and-paste incorrectly in the commit message? If so, then with the commit message fixed, I'm okay with:

Quoted 2 lines

Hmm, I can't reproduce with "len = 0", and it looks impossible. But I've scrolled up in one of my terminals and found this reproduce, really, '"len": 0', so, that is possible.

And, after looking through the code it looks like it really possible - s->common.len is set not in the very beginning, but after for ex. call to block_job_pause_point().

So, the reproduction that I've copied into commit message was very good match.

But, I'm not sure, that len should be fixed in the same way. May be it would be better to set earlier and don't update on each iteration (why is it updated??)

Signature · 2 lines
Best regards,
Vladimir
#3 lore raw
Quoted 52 lines · Vladimir Sementsov-Ogievskiy
Quoted 49 lines · Eric Blake
Quoted 14 lines · Vladimir Sementsov-Ogievskiy

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out 2017-07-14 \
     15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +0 -0
@@ -37,7 +37,7 @@
  {"return": {}}

Review

Quoted 10 lines
(quoted diff) +1 -1
  {"return": {}}
  {"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
      "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
             "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

This diff says both 'len' and 'offset' differ...

Quoted 8 lines

=== Start backup job and exit qemu ===

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

s/let/let's/

Quoted 9 lines
---
  tests/qemu-iotests/185     | 2 +-
  tests/qemu-iotests/185.out | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP},
"event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP},
"event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": OFFSET, "speed": 65536, "type": "mirror"}}

...while this diff only touched 'offset'. Did you copy-and-paste incorrectly in the commit message? If so, then with the commit message fixed, I'm okay with:

Quoted 2 lines
Quoted 9 lines

Hmm, I can't reproduce with "len = 0", and it looks impossible. But I've scrolled up in one of my terminals and found this reproduce, really, '"len": 0', so, that is possible.

And, after looking through the code it looks like it really possible - s->common.len is set not in the very beginning, but after for ex. call to block_job_pause_point().

So, the reproduction that I've copied into commit message was very good match.

But, I'm not sure, that len should be fixed in the same way. May be it would be better to set earlier and don't update on each iteration (why is it updated??)

So, IMHO, this patch is good (with s/"len": 0/"len": 4194304/ and s/let/let's/ in commit message)

Signature · 2 lines
Best regards,
Vladimir
#4 lore raw
Quoted 53 lines · Vladimir Sementsov-Ogievskiy
Quoted 52 lines · Vladimir Sementsov-Ogievskiy
Quoted 51 lines · Eric Blake
Quoted 14 lines · Vladimir Sementsov-Ogievskiy

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out 2017-07-14 \
     15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +0 -0
@@ -37,7 +37,7 @@
  {"return": {}}

Review

Quoted 10 lines
(quoted diff) +1 -1
  {"return": {}}
  {"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
      "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
             "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

This diff says both 'len' and 'offset' differ...

Quoted 8 lines

=== Start backup job and exit qemu ===

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

s/let/let's/

Quoted 9 lines
---
  tests/qemu-iotests/185     | 2 +-
  tests/qemu-iotests/185.out | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP},
"event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP},
"event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": OFFSET, "speed": 65536, "type": "mirror"}}

...while this diff only touched 'offset'. Did you copy-and-paste incorrectly in the commit message? If so, then with the commit message fixed, I'm okay with:

Quoted 1 line
Quoted 1 line

Hmm, I can't reproduce with "len = 0", and it looks impossible. But I've scrolled up in one of my terminals and found this reproduce, really, '"len": 0', so, that is possible.

reproduced on N = 426

Quoted 14 lines
Quoted 10 lines

And, after looking through the code it looks like it really possible
- s->common.len is set not in the very beginning, but after for ex. call to block_job_pause_point().

So, the reproduction that I've copied into commit message was very good match.

But, I'm not sure, that len should be fixed in the same way. May be it would be better to set earlier and don't update on each iteration (why is it updated??)

So, IMHO, this patch is good (with s/"len": 0/"len": 4194304/ and s/let/let's/ in commit message)

Signature · 2 lines
Best regards,
Vladimir
#5 lore raw
In reply to Vladimir Sementsov-Ogievskiy

Am 07.08.2017 um 16:16 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 27 lines

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
    15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +1 -1
@@ -37,7 +37,7 @@
 {"return": {}}
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
    "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
        "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
            "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
    "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
        "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}
 
 === Start backup job and exit qemu ===
Quoted 8 lines

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

I'm quoting 185:

# Note that the reference output intentionally includes the 'offset' field in # BLOCK_JOB_CANCELLED events for all of the following block jobs. They are

# predictable and any change in the offsets would hint at a bug in the job
# throttling code.
#
# In order to achieve these predictable offsets, all of the following tests
# use speed=65536. Each job will perform exactly one iteration before it has
# to sleep at least for a second, which is plenty of time for the 'quit' QMP
# command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete).
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the
# offset doesn't advance after the first iteration before qemu exits.

So before we change the expected output, can we explain why the offsets aren't predictable, even if throttling is used and contrary to what the comment says? Should we sleep a little before issuing 'quit'?

(By the way, I couldn't reproduce in N = 128 attempts, so it doesn't look like I can look into what's happening in detail, except with code review.)

Kevin

#6 lore raw
Quoted 55 lines · Kevin Wolf

Am 07.08.2017 um 16:16 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 27 lines

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
     15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +1 -1
@@ -37,7 +37,7 @@
  {"return": {}}
  {"return": {}}
  {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
      "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
             "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}
 
  === Start backup job and exit qemu ===
Quoted 8 lines

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

I'm quoting 185:

# Note that the reference output intentionally includes the 'offset' field in # BLOCK_JOB_CANCELLED events for all of the following block jobs. They are

# predictable and any change in the offsets would hint at a bug in the job
# throttling code.
#
# In order to achieve these predictable offsets, all of the following tests
# use speed=65536. Each job will perform exactly one iteration before it has
# to sleep at least for a second, which is plenty of time for the 'quit' QMP
# command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete).
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the
# offset doesn't advance after the first iteration before qemu exits.
Quoted 3 lines

So before we change the expected output, can we explain why the offsets aren't predictable, even if throttling is used and contrary to what the comment says? Should we sleep a little before issuing 'quit'?

Throttling "guaranties" that there will not be more than one request. But what prevent less than one, i.e. zero, like in my reproduction?

Quoted 6 lines

(By the way, I couldn't reproduce in N = 128 attempts, so it doesn't look like I can look into what's happening in detail, except with code review.)

Kevin

Signature · 2 lines
Best regards,
Vladimir
#7 lore raw

Am 08.08.2017 um 10:42 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 56 lines
Quoted 55 lines · Kevin Wolf

Am 07.08.2017 um 16:16 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 27 lines

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
     15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +1 -1
@@ -37,7 +37,7 @@
  {"return": {}}
  {"return": {}}
  {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
      "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
             "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
     "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
         "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}
 
  === Start backup job and exit qemu ===
Quoted 8 lines

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

I'm quoting 185:

# Note that the reference output intentionally includes the 'offset' field in # BLOCK_JOB_CANCELLED events for all of the following block jobs. They are

# predictable and any change in the offsets would hint at a bug in the job
# throttling code.
#
# In order to achieve these predictable offsets, all of the following tests
# use speed=65536. Each job will perform exactly one iteration before it has
# to sleep at least for a second, which is plenty of time for the 'quit' QMP
# command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete).
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the
# offset doesn't advance after the first iteration before qemu exits.
Quoted 6 lines
Quoted 3 lines

So before we change the expected output, can we explain why the offsets aren't predictable, even if throttling is used and contrary to what the comment says? Should we sleep a little before issuing 'quit'?

Throttling "guaranties" that there will not be more than one request. But what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Kevin

#8 lore raw
Quoted 60 lines · Kevin Wolf

Am 08.08.2017 um 10:42 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 59 lines
Quoted 58 lines · Kevin Wolf

Am 07.08.2017 um 16:16 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 27 lines

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
      15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +1 -1
@@ -37,7 +37,7 @@
   {"return": {}}
   {"return": {}}
   {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
       "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
      "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
          "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
              "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
      "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
          "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}
 
   === Start backup job and exit qemu ===
Quoted 8 lines

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

I'm quoting 185:

# Note that the reference output intentionally includes the 'offset' field in # BLOCK_JOB_CANCELLED events for all of the following block jobs. They are

# predictable and any change in the offsets would hint at a bug in the job
# throttling code.
#
# In order to achieve these predictable offsets, all of the following tests
# use speed=65536. Each job will perform exactly one iteration before it has
# to sleep at least for a second, which is plenty of time for the 'quit' QMP
# command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete).
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the
# offset doesn't advance after the first iteration before qemu exits.

So before we change the expected output, can we explain why the offsets aren't predictable, even if throttling is used and contrary to what the comment says? Should we sleep a little before issuing 'quit'?

Quoted 8 lines
Quoted 2 lines

Throttling "guaranties" that there will not be more than one request. But what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Kevin

I've started with 'sleep 0.5', now there are >100 successful iterations... The other way is to check in test that there was 0 or 1 requests, but for this it looks better to rewrite it in python.

Signature · 2 lines
Best regards,
Vladimir
#9 lore raw
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 69 lines · Kevin Wolf

Am 08.08.2017 um 10:42 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 58 lines
Quoted 57 lines · Kevin Wolf

Am 07.08.2017 um 16:16 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 29 lines

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out 2017-07-14 \
      15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +0 -1
@@ -37,7 +37,7 @@
   {"return": {}}
   {"return": {}}
   {"timestamp": {"seconds":  TIMESTAMP, "microseconds": 
 TIMESTAMP}, \
       "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
      "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
          "len": 4194304, "offset": 4194304, "speed": 65536, 
"type": \
              "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
      "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
          "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

=== Start backup job and exit qemu ===

Quoted 8 lines

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

I'm quoting 185:

# Note that the reference output intentionally includes the 'offset' field in # BLOCK_JOB_CANCELLED events for all of the following block jobs. They are

# predictable and any change in the offsets would hint at a bug in the job
# throttling code.
#
# In order to achieve these predictable offsets, all of the following tests
# use speed=65536. Each job will perform exactly one iteration before it has
# to sleep at least for a second, which is plenty of time for the 'quit' QMP
# command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete).
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the
# offset doesn't advance after the first iteration before qemu exits.
Quoted 5 lines
Quoted 3 lines

So before we change the expected output, can we explain why the offsets aren't predictable, even if throttling is used and contrary to what the comment says? Should we sleep a little before issuing 'quit'?

Throttling "guaranties" that there will not be more than one request. But what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Quoted 6 lines
Quoted 1 line

Kevin

I've started with 'sleep 0.5', now there are >100 successful iterations... The other way is to check in test that there was 0 or 1 requests, but for this it looks better to rewrite it in python.

is sleep for ms portable?

Signature · 2 lines
Best regards,
Vladimir
#10 lore raw
Quoted 83 lines · Vladimir Sementsov-Ogievskiy
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 69 lines · Kevin Wolf

Am 08.08.2017 um 10:42 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 58 lines
Quoted 57 lines · Kevin Wolf

Am 07.08.2017 um 16:16 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 29 lines

185 iotest is broken.

How to test:

Quoted 1 line

i=0; while ./check -qcow2 -nocache 185; do ((i+=1)); echo N = $i; \

done; echo N = $i

finished for me like this:

185 2s ... - output mismatch (see 185.out.bad)

--- /work/src/qemu/master/tests/qemu-iotests/185.out 2017-07-14 \
      15:14:29.520343805 +0300

+++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300

(quoted diff) +0 -1
@@ -37,7 +37,7 @@
   {"return": {}}
   {"return": {}}
   {"timestamp": {"seconds":  TIMESTAMP, "microseconds": 
 TIMESTAMP}, \
       "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
      "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
          "len": 4194304, "offset": 4194304, "speed": 65536, 
"type": \
              "mirror"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds": TIMESTAMP}, \
      "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
          "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

=== Start backup job and exit qemu ===

Quoted 8 lines

Failures: 185
Failed 1 of 1 tests
N = 8

It doesn't seems logical to expect the constant offset on cancel, so let filter it out.

I'm quoting 185:

# Note that the reference output intentionally includes the 'offset' field in # BLOCK_JOB_CANCELLED events for all of the following block jobs. They are

# predictable and any change in the offsets would hint at a bug in the job
# throttling code.
#
# In order to achieve these predictable offsets, all of the following tests
# use speed=65536. Each job will perform exactly one iteration before it has
# to sleep at least for a second, which is plenty of time for the 'quit' QMP
# command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete).
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the
# offset doesn't advance after the first iteration before qemu exits.
Quoted 5 lines
Quoted 3 lines

So before we change the expected output, can we explain why the offsets aren't predictable, even if throttling is used and contrary to what the comment says? Should we sleep a little before issuing 'quit'?

Throttling "guaranties" that there will not be more than one request. But what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Quoted 6 lines
Quoted 1 line

Kevin

I've started with 'sleep 0.5', now there are >100 successful iterations... The other way is to check in test that there was 0 or 1 requests, but for this it looks better to rewrite it in python.

is sleep for ms portable?

1500 successful iterations, so, 'sleep 0.5' is OK for me.

Signature · 2 lines
Best regards,
Vladimir
#11 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
Quoted 11 lines
Quoted 9 lines
Quoted 3 lines

Throttling "guaranties" that there will not be more than one request. But
what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Kevin

Quoted 7 lines
Quoted 5 lines

I've started with 'sleep 0.5', now there are >100 successful iterations... The other way is to check in test that there was 0 or 1 requests, but for this it looks better to rewrite it in python.

is sleep for ms portable?

Sadly, sub-second sleep is a GNU coreutils feature; I suspect the BSD machines may fail to parse it. (Of course, we could do some sort of 'sleep $SMALL', where $SMALL is 0.5 if sleep supports it, and 1 otherwise).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#12 lore raw
Quoted 17 lines · Eric Blake
Quoted 15 lines · Vladimir Sementsov-Ogievskiy
Quoted 15 lines
Quoted 9 lines
Quoted 3 lines

Throttling "guaranties" that there will not be more than one request. But
what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Kevin

I've started with 'sleep 0.5', now there are >100 successful iterations... The other way is to check in test that there was 0 or 1 requests, but for this it looks better to rewrite it in python.

Quoted 5 lines
Quoted 1 line

is sleep for ms portable?

Sadly, sub-second sleep is a GNU coreutils feature; I suspect the BSD machines may fail to parse it. (Of course, we could do some sort of 'sleep $SMALL', where $SMALL is 0.5 if sleep supports it, and 1 otherwise).

sleep for 1 second may lead to more then one request done before qemu quite.

Signature · 2 lines
Best regards,
Vladimir
#13 lore raw

Am 08.08.2017 um 17:10 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 18 lines
Quoted 17 lines · Eric Blake
Quoted 15 lines · Vladimir Sementsov-Ogievskiy
Quoted 15 lines
Quoted 9 lines
Quoted 3 lines

Throttling "guaranties" that there will not be more than one request. But
what prevent less than one, i.e. zero, like in my reproduction?

Yes, I understand. Can we somehow make sure that at least one iteration is made? I'd really like to keep the functional test for block job throttling. I suppose a simple 'sleep 0.1' would do the trick, though it's not very clean.

Kevin

I've started with 'sleep 0.5', now there are >100 successful iterations... The other way is to check in test that there was 0 or 1 requests, but for this it looks better to rewrite it in python.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

is sleep for ms portable?

Sadly, sub-second sleep is a GNU coreutils feature; I suspect the BSD machines may fail to parse it. (Of course, we could do some sort of 'sleep $SMALL', where $SMALL is 0.5 if sleep supports it, and 1 otherwise).

sleep for 1 second may lead to more then one request done before qemu quite.

_supported_os Linux

So do we really care about portability? And are all the other test cases working on the BSDs?

Kevin

#14 lore raw
Quoted 11 lines · Kevin Wolf
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

is sleep for ms portable?

Sadly, sub-second sleep is a GNU coreutils feature; I suspect the BSD machines may fail to parse it. (Of course, we could do some sort of 'sleep $SMALL', where $SMALL is 0.5 if sleep supports it, and 1 otherwise).

sleep for 1 second may lead to more then one request done before qemu quite.

_supported_os Linux

So do we really care about portability? And are all the other test cases working on the BSDs?

You've got valid points there - I suspect that a run of qemu-iotests on BSD would turn up quite a few failures, some of which would be easy to address; but it's not on my personal priority list. I'm fine with an approach of committing something that works where it was first tested, then adding followup patches to improve portability, especially as long as we are not currently getting anyone complaining about qemu-iotests failures on BSD.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org