From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 4/4] tests/qemu-iotests/qom-set-drive: replace with a differently sized node
Date: Wed, 12 Aug 2026 14:15:00 +0200 [thread overview]
Message-ID: <20260812121500.1034178-5-den@openvz.org> (raw)
In-Reply-To: <20260812121500.1034178-1-den@openvz.org>
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>
---
tests/qemu-iotests/tests/qom-set-drive | 14 +++++++++++---
tests/qemu-iotests/tests/qom-set-drive.out | 2 ++
2 files changed, 13 insertions(+), 3 deletions(-)
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
--
2.53.0
next prev parent reply other threads:[~2026-08-12 12:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 12:14 [PATCH 0/4] block, scsi-disk: honour a size change on child replacement Denis V. Lunev
2026-08-12 12:14 ` [PATCH 1/4] block: notify the parent when a replaced child has a different size Denis V. Lunev
2026-08-12 12:14 ` [PATCH 2/4] scsi-disk: refresh the cached capacity from the resize callback Denis V. Lunev
2026-08-12 12:14 ` [PATCH 3/4] tests/qtest/virtio-scsi: cover a replacement that changes the size Denis V. Lunev
2026-08-12 12:15 ` Denis V. Lunev [this message]
2026-08-19 9:36 ` [PATCH 0/4] block, scsi-disk: honour a size change on child replacement Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812121500.1034178-5-den@openvz.org \
--to=den@openvz.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.