Commit 28fafb3147 for qemu.org
commit 28fafb3147f54291c384a305796384051882067d
Author: Denis V. Lunev <den@openvz.org>
Date: Wed Aug 12 14:15:00 2026 +0200
tests/qemu-iotests/qom-set-drive: replace with a differently sized node
All images in this test have the same size, so the test never reaches
the size change path of bdrv_replace_child_bs(). Add a node of a
different size and point a device at it.
The notification itself is not visible over QMP, so this only covers the
block layer side. What the device does with it is checked by
tests/qtest/virtio-scsi-test.c.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Message-ID: <20260812121500.1034178-5-den@openvz.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
diff --git a/tests/qemu-iotests/tests/qom-set-drive b/tests/qemu-iotests/tests/qom-set-drive
index ec8ddac4fd..52d7eb96da 100755
--- a/tests/qemu-iotests/tests/qom-set-drive
+++ b/tests/qemu-iotests/tests/qom-set-drive
@@ -24,12 +24,15 @@ import iotests
from iotests import imgfmt, log, qemu_img_create, QMPTestCase
image_size = 1 * 1024 * 1024
-images = [os.path.join(iotests.test_dir, f'{i}.img') for i in range(0, 4)]
+images = [os.path.join(iotests.test_dir, f'{i}.img') for i in range(0, 5)]
+
+# node4 is deliberately larger, to cover a replacement which changes the size
+image_sizes = [image_size] * 4 + [2 * image_size]
class TestQOMSetDrive(QMPTestCase):
def setUp(self) -> None:
- for image in images:
- qemu_img_create('-f', imgfmt, image, str(image_size))
+ for image, size in zip(images, image_sizes):
+ qemu_img_create('-f', imgfmt, image, str(size))
self.vm = iotests.VM()
for i, image in enumerate(images):
@@ -68,6 +71,11 @@ class TestQOMSetDrive(QMPTestCase):
log(self.vm.qmp('qom-get', path='/machine/peripheral/no-iot',
property='drive'))
+ log(self.vm.qmp('qom-set', path='/machine/peripheral/no-iot',
+ property='drive', value='node4'))
+ log(self.vm.qmp('qom-get', path='/machine/peripheral/no-iot',
+ property='drive'))
+
if __name__ == '__main__':
iotests.activate_logging()
# LUKS would require special key-secret handling in add_blockdevs()
diff --git a/tests/qemu-iotests/tests/qom-set-drive.out b/tests/qemu-iotests/tests/qom-set-drive.out
index 7fc243dca6..6f6e5e2b31 100644
--- a/tests/qemu-iotests/tests/qom-set-drive.out
+++ b/tests/qemu-iotests/tests/qom-set-drive.out
@@ -4,6 +4,8 @@
{"return": "node1"}
{"return": {}}
{"return": "node3"}
+{"return": {}}
+{"return": "node4"}
.
----------------------------------------------------------------------
Ran 1 tests