Commit 5add514ba3 for qemu.org

commit 5add514ba36ed2cc2a5aa3be64c4adc72d4d9003
Author: Denis V. Lunev <den@openvz.org>
Date:   Wed Jul 15 12:34:51 2026 +0200

    iotests/migrate-bitmaps-postcopy-test: replace the timing assertion with a content check

    `downtime * 10 < postcopy_time` was an unnormalized wall-clock
    heuristic (commit e80a4150a5) that fails on fast hosts, where the
    bitmap payload now transfers in under a second.

    Check the actual invariant instead: right after RESUME, bitmap0's
    content hash on the destination must not yet match the fully
    migrated value. Throttle max-bandwidth first, since all-zero chunks
    skip the payload write and would otherwise let a fast host finish
    the transfer before the check runs.

    Signed-off-by: Denis V. Lunev <den@openvz.org>
    CC: Kevin Wolf <kwolf@redhat.com>
    CC: Hanna Reitz <hreitz@redhat.com>
    CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    Message-ID: <20260715103451.1930909-4-den@openvz.org>
    Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    Reviewed-by: Kevin Wolf <kwolf@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>

diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
index c519e6db8c..33ff2b861f 100755
--- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
+++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
@@ -160,12 +160,26 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):

         self.vm_b.cmd('migrate-set-capabilities', capabilities=caps)

+        # Throttle so the chunks covering our discards (the only ones
+        # not skipped by the all-zero fast path) can't outrun the check
+        # below.
+        self.vm_a.cmd('migrate-set-parameters', max_bandwidth=16536)
+
         self.vm_a.cmd('migrate', uri='exec:cat>' + fifo)

         self.vm_a.cmd('migrate-start-postcopy')

         event_resume = self.vm_b.event_wait('RESUME')
         self.vm_b_events.append(event_resume)
+
+        # bitmap0 can't already have its final content: that requires
+        # the bit data to have actually arrived.
+        result = self.vm_b.qmp('x-debug-block-dirty-bitmap-sha256',
+                               node='drive0', name='bitmap0')
+        assert result['return']['sha256'] != all_discards_sha256
+
+        self.vm_a.cmd('migrate-set-parameters', max_bandwidth=0)
+
         return (event_resume, discards1_sha256, all_discards_sha256)

     def test_postcopy_success(self):
@@ -186,7 +200,6 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
         downtime = event_dist(event_stop, event_resume)
         postcopy_time = event_dist(event_resume, event_complete)

-        assert downtime * 10 < postcopy_time
         if debug:
             print('downtime:', downtime)
             print('postcopy_time:', postcopy_time)