Skip to contentSkip to conversation

iotests: fix 240

PATCH Applied Stefan Hajnoczi 4 participants 4 messages May 29, 2025 – Jun 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests: fix 240

Commit 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter") removed the limitation that virtio-scsi devices must successfully set the AioContext on their BlockBackends. This was made possible thanks to the QEMU multi-queue block layer.

This change broke qemu-iotests 240, which checks that adding a virtio-scsi device with a drive that is already in another AioContext will fail.

Update the test to take the relaxed behavior into account. I considered removing this test case entirely, but the code coverage still seems valuable.

Fixes 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter")
---
 tests/qemu-iotests/240     | 2 --
 tests/qemu-iotests/240.out | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)
tests/qemu-iotests/240 +0 -2
index 9b281e1dc0..f8af9ff648 100755
@@ -81,8 +81,6 @@ class TestCase(iotests.QMPTestCase):
 
         self.vm.qmp_log('device_del', id='scsi-hd0')
         self.vm.event_wait('DEVICE_DELETED')
-        self.vm.qmp_log('device_add', id='scsi-hd1', driver='scsi-hd', drive='hd0', bus="scsi1.0")
-
         self.vm.qmp_log('device_del', id='scsi-hd1')
         self.vm.event_wait('DEVICE_DELETED')
         self.vm.qmp_log('blockdev-del', node_name='hd0')
tests/qemu-iotests/240.out +1 -3
index 89ed25e506..10dcc42e06 100644
@@ -46,10 +46,8 @@
 {"execute": "device_add", "arguments": {"bus": "scsi0.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}
 {"return": {}}
 {"execute": "device_add", "arguments": {"bus": "scsi1.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
-{"error": {"class": "GenericError", "desc": "Cannot change iothread of active block backend"}}
-{"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
 {"return": {}}
-{"execute": "device_add", "arguments": {"bus": "scsi1.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
+{"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
 {"return": {}}
 {"execute": "device_del", "arguments": {"id": "scsi-hd1"}}
 {"return": {}}
Signature · 1 line
2.49.0
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 13 lines · Stefan Hajnoczi

Commit 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter") removed the limitation that virtio-scsi devices must successfully set the AioContext on their BlockBackends. This was made possible thanks to the QEMU multi-queue block layer.

This change broke qemu-iotests 240, which checks that adding a virtio-scsi device with a drive that is already in another AioContext will fail.

Update the test to take the relaxed behavior into account. I considered removing this test case entirely, but the code coverage still seems valuable.

Quoted 7 lines
Fixes 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter")
---
 tests/qemu-iotests/240     | 2 --
 tests/qemu-iotests/240.out | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)

This one has been annoying me - thanks!

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 40 lines · Stefan Hajnoczi

Commit 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter") removed the limitation that virtio-scsi devices must successfully set the AioContext on their BlockBackends. This was made possible thanks to the QEMU multi-queue block layer.

This change broke qemu-iotests 240, which checks that adding a virtio-scsi device with a drive that is already in another AioContext will fail.

Update the test to take the relaxed behavior into account. I considered removing this test case entirely, but the code coverage still seems valuable.

Fixes 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter")
---
  tests/qemu-iotests/240     | 2 --
  tests/qemu-iotests/240.out | 4 +---
  2 files changed, 1 insertion(+), 5 deletions(-)
tests/qemu-iotests/240 +0 -2
index 9b281e1dc0..f8af9ff648 100755
@@ -81,8 +81,6 @@ class TestCase(iotests.QMPTestCase):
 
          self.vm.qmp_log('device_del', id='scsi-hd0')
          self.vm.event_wait('DEVICE_DELETED')
-        self.vm.qmp_log('device_add', id='scsi-hd1', driver='scsi-hd', drive='hd0', bus="scsi1.0")
-
          self.vm.qmp_log('device_del', id='scsi-hd1')
          self.vm.event_wait('DEVICE_DELETED')
          self.vm.qmp_log('blockdev-del', node_name='hd0')
tests/qemu-iotests/240.out +0 -0
index 89ed25e506..10dcc42e06 100644
@@ -46,10 +46,8 @@
  {"execute": "device_add", "arguments": {"bus": "scsi0.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}

tests/qemu-iotests/240.out line 53

Quoted 10 lines
tests/qemu-iotests/240.out +1 -3
  {"return": {}}
  {"execute": "device_add", "arguments": {"bus": "scsi1.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
-{"error": {"class": "GenericError", "desc": "Cannot change iothread of active block backend"}}
-{"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
  {"return": {}}
-{"execute": "device_add", "arguments": {"bus": "scsi1.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
+{"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
  {"return": {}}
  {"execute": "device_del", "arguments": {"id": "scsi-hd1"}}
  {"return": {}}

Thanks for fixing it!

CC qemu-stable now since this was also in the 10.0 release.

Thomas

Applied
#3 lore raw
In reply to Stefan Hajnoczi

Am 29.05.2025 um 22:31 hat Stefan Hajnoczi geschrieben:

Quoted 9 lines

Commit 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter") removed the limitation that virtio-scsi devices must successfully set the AioContext on their BlockBackends. This was made possible thanks to the QEMU multi-queue block layer.

This change broke qemu-iotests 240, which checks that adding a virtio-scsi device with a drive that is already in another AioContext will fail.

Quoted 7 lines

Update the test to take the relaxed behavior into account. I considered removing this test case entirely, but the code coverage still seems valuable.

Fixes 2e8e18c2e463 ("virtio-scsi: add iothread-vq-mapping parameter")

Thanks, applied to the block branch.

Kevin