Skip to contentSkip to conversation

iotests: Filter second BLOCK_JOB_ERROR from 229

PATCH Applied Max Reitz 3 participants 4 messages Jan 30, 2019 – Feb 1, 2019

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 iotests: Filter second BLOCK_JOB_ERROR from 229

Without this filter, this test sometimes fails.

---
I intended to send this as part of my iotest fixes series, but it ended up on the wrong branch... Doesn't really matter, though, as there is no functional dependency.

---
 tests/qemu-iotests/229     | 6 +++++-
 tests/qemu-iotests/229.out | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/229 +5 -1
index 893d098ad2..b0d4885fa6 100755
@@ -81,11 +81,15 @@ echo
 echo '=== Force cancel job paused in error state  ==='
 echo
 
+# Filter out BLOCK_JOB_ERROR events because they may or may not occur.
+# Cancelling the job means resuming it for a bit before it is actually
+# aborted, and in that time it may or may not re-encounter the error.
 success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \
     "{'execute': 'block-job-cancel',
                  'arguments': { 'device': 'testdisk',
                                 'force': true}}" \
-     "BLOCK_JOB_CANCELLED" "Assertion"
+     "BLOCK_JOB_CANCELLED" "Assertion" \
+    | grep -v '"BLOCK_JOB_ERROR"'
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/229.out +0 -1
index 4c4112805f..a3eb33788a 100644
@@ -17,7 +17,6 @@ wrote 2097152/2097152 bytes at offset 0
 
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}}
 *** done
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Max Reitz

Without this filter, this test sometimes fails.

---
I intended to send this as part of my iotest fixes series, but it ended up on the wrong branch... Doesn't really matter, though, as there is no functional dependency.

---
 tests/qemu-iotests/229     | 6 +++++-
 tests/qemu-iotests/229.out | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/229 +0 -0
index 893d098ad2..b0d4885fa6 100755

tests/qemu-iotests/229 echo · line 86

Quoted 6 lines
tests/qemu-iotests/229 +3 -0
@@ -81,11 +81,15 @@ echo
 echo '=== Force cancel job paused in error state  ==='
 echo
 
+# Filter out BLOCK_JOB_ERROR events because they may or may not occur.
+# Cancelling the job means resuming it for a bit before it is actually
+# aborted, and in that time it may or may not re-encounter the error.

Oh, because the job is "paused" and cancelling it involves job_enter, which we then allow the job to gracefully fail through it's own pathways -- but depending on where it failed originally, it may-or-may-not wind up trying something else that fails before it finds the "exit gracefully" signal, is that right?

I guess there's no real way to adjust that behavior.

Quoted 16 lines
tests/qemu-iotests/229 +2 -1
 success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \
     "{'execute': 'block-job-cancel',
                  'arguments': { 'device': 'testdisk',
                                 'force': true}}" \
-     "BLOCK_JOB_CANCELLED" "Assertion"
+     "BLOCK_JOB_CANCELLED" "Assertion" \
+    | grep -v '"BLOCK_JOB_ERROR"'
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/229.out +0 -0
index 4c4112805f..a3eb33788a 100644

tests/qemu-iotests/229.out wrote 2097152/2097152 bytes at offset 0 · line 22

Quoted 7 lines
tests/qemu-iotests/229.out +0 -1
@@ -17,7 +17,6 @@ wrote 2097152/2097152 bytes at offset 0
 
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}}
 *** done

I think this is fine, if we cannot help to make this any more deterministic, so I'm fine with:

but I am curious to know if this poses any theoretical problems for libvirt having to deal with possibly an extra hiccup before the cancel registers.

author
#2 lore raw
Quoted 23 lines · John Snow
Quoted 20 lines · Max Reitz

Without this filter, this test sometimes fails.

---
I intended to send this as part of my iotest fixes series, but it ended up on the wrong branch... Doesn't really matter, though, as there is no functional dependency.

---
 tests/qemu-iotests/229     | 6 +++++-
 tests/qemu-iotests/229.out | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/229 +0 -0
index 893d098ad2..b0d4885fa6 100755
@@ -81,11 +81,15 @@ echo
 echo '=== Force cancel job paused in error state  ==='
 echo
 
Quoted 9 lines

tests/qemu-iotests/229 echo · line 86

Quoted 3 lines
tests/qemu-iotests/229 +3 -0
+# Filter out BLOCK_JOB_ERROR events because they may or may not occur.
+# Cancelling the job means resuming it for a bit before it is actually
+# aborted, and in that time it may or may not re-encounter the error.

Oh, because the job is "paused" and cancelling it involves job_enter, which we then allow the job to gracefully fail through it's own pathways -- but depending on where it failed originally, it may-or-may-not wind up trying something else that fails before it finds the "exit gracefully" signal, is that right?

That's at least how I explained it to me, yes.

Quoted 29 lines

I guess there's no real way to adjust that behavior.

Quoted 16 lines
tests/qemu-iotests/229 +2 -1
 success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \
     "{'execute': 'block-job-cancel',
                  'arguments': { 'device': 'testdisk',
                                 'force': true}}" \
-     "BLOCK_JOB_CANCELLED" "Assertion"
+     "BLOCK_JOB_CANCELLED" "Assertion" \
+    | grep -v '"BLOCK_JOB_ERROR"'
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/229.out +0 -0
index 4c4112805f..a3eb33788a 100644

tests/qemu-iotests/229.out wrote 2097152/2097152 bytes at offset 0 · line 22

Quoted 7 lines
tests/qemu-iotests/229.out +0 -1
@@ -17,7 +17,6 @@ wrote 2097152/2097152 bytes at offset 0
 
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}}
 *** done

I think this is fine, if we cannot help to make this any more deterministic, so I'm fine with:

Quoted 5 lines

but I am curious to know if this poses any theoretical problems for libvirt having to deal with possibly an extra hiccup before the cancel registers.

Hm... I would say the bigger issue is the error event appearing than that not being the case. Because it appears most of the time, I think libvirt can deal with it.

Max