All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: andrey.drobyshev@virtuozzo.com
Cc: svt-core@virtuozzo.com, den@openvz.org
Subject: [PATCH hci-dev 6/6] tests/qtest/virtio-scsi: cover vz-x-blockdev-replace changing the size #VSTOR-130961
Date: Wed,  4 Nov 2026 14:45:39 +0100	[thread overview]
Message-ID: <20261104134539.1519657-7-den@openvz.org> (raw)
In-Reply-To: <20261104134539.1519657-1-den@openvz.org>

From: Denis V. Lunev <den@openvz.org>

replaced-node-size reaches bdrv_replace_child_bs() through qom-set and
blk_replace_bs(). The disk_replace migration uses vz-x-blockdev-replace
instead, which gets there from blockdev_replace() inside a transaction
of its own. Swap in a third, larger node that way as well and check that
the guest is told about the new capacity and can read past the old end.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 tests/qtest/virtio-scsi-test.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tests/qtest/virtio-scsi-test.c b/tests/qtest/virtio-scsi-test.c
index f1aaeb31559..4e2bcd7b485 100644
--- a/tests/qtest/virtio-scsi-test.c
+++ b/tests/qtest/virtio-scsi-test.c
@@ -251,6 +251,10 @@ static void test_replaced_node_size(void *obj, void *data,
     const uint8_t read_high_cdb[VIRTIO_SCSI_CDB_SIZE] = {
         0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00
     };
+    /* READ(10), LBA 0x40000 (128 MiB), transfer length 1 */
+    const uint8_t read_huge_cdb[VIRTIO_SCSI_CDB_SIZE] = {
+        0x28, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
+    };
     struct virtio_scsi_cmd_resp resp;
 
     alloc = t_alloc;
@@ -280,6 +284,22 @@ static void test_replaced_node_size(void *obj, void *data,
     g_assert_cmphex(resp.response, ==, 0);
     g_assert_cmphex(resp.status, ==, GOOD);
 
+    qtest_qmp_assert_success(global_qtest,
+                             "{'execute': 'vz-x-blockdev-replace', "
+                             "'arguments': {'parent-type': 'qdev',"
+                             "  'qdev-id': 'scsi-hd0', 'new-child': 'huge'}}");
+
+    virtio_scsi_do_command(vs, read_huge_cdb, buf, sizeof(buf), NULL, 0, &resp);
+    g_assert_cmphex(resp.response, ==, 0);
+    g_assert_cmphex(resp.status, ==, CHECK_CONDITION);
+    g_assert_cmphex(resp.sense[2], ==, UNIT_ATTENTION);
+    g_assert_cmphex(resp.sense[12], ==, 0x2a);
+    g_assert_cmphex(resp.sense[13], ==, 0x09);
+
+    virtio_scsi_do_command(vs, read_huge_cdb, buf, sizeof(buf), NULL, 0, &resp);
+    g_assert_cmphex(resp.response, ==, 0);
+    g_assert_cmphex(resp.status, ==, GOOD);
+
     qvirtio_scsi_pci_free(vs);
 }
 
@@ -394,6 +414,8 @@ static void *virtio_scsi_setup_replace(GString *cmd_line, void *arg)
                     "size=1048576,node-name=small"
                     " -blockdev driver=null-co,read-zeroes=on,"
                     "size=134217728,node-name=big"
+                    " -blockdev driver=null-co,read-zeroes=on,"
+                    "size=268435456,node-name=huge"
                     " -device scsi-hd,id=scsi-hd0,drive=small,"
                     "lun=0,scsi-id=1");
     return arg;
-- 
2.53.0


  parent reply	other threads:[~2026-11-04 13:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 13:45 [PATCH hci-dev 0/6] block, scsi-disk: honour a size change on child replacement #VSTOR-130961 Denis V. Lunev
2026-11-04 13:45 ` [PATCH hci-dev 1/6] block: make bdrv_co_parent_cb_resize() a proper IO API function #VSTOR-130961 Denis V. Lunev
2026-11-04 13:47   ` no-reply
2026-11-04 13:45 ` [PATCH hci-dev 2/6] block: notify the parent when a replaced child has a different size #VSTOR-130961 Denis V. Lunev
2026-11-04 13:51   ` no-reply
2026-11-04 13:45 ` [PATCH hci-dev 3/6] scsi-disk: refresh the cached capacity from the resize callback #VSTOR-130961 Denis V. Lunev
2026-11-04 13:50   ` no-reply
2026-11-04 13:45 ` [PATCH hci-dev 4/6] tests/qtest/virtio-scsi: cover a replacement that changes the size #VSTOR-130961 Denis V. Lunev
2026-11-04 13:54   ` no-reply
2026-11-04 13:45 ` [PATCH hci-dev 5/6] tests/qemu-iotests/qom-set-drive: replace with a differently sized node #VSTOR-130961 Denis V. Lunev
2026-11-04 13:51   ` no-reply
2026-11-04 13:45 ` Denis V. Lunev [this message]
2026-11-04 13:53   ` [PATCH hci-dev 6/6] tests/qtest/virtio-scsi: cover vz-x-blockdev-replace changing the size #VSTOR-130961 no-reply
2026-11-04 14:00 ` [PATCH hci-dev 0/6] block, scsi-disk: honour a size change on child replacement #VSTOR-130961 Andrey Drobyshev

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=20261104134539.1519657-7-den@openvz.org \
    --to=den@openvz.org \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=svt-core@virtuozzo.com \
    /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.