From nobody Mon Apr 29 09:22:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522426315718166.9624751657975; Fri, 30 Mar 2018 09:11:55 -0700 (PDT) Received: from localhost ([::1]:49758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1wd4-0001DQ-3Z for importer@patchew.org; Fri, 30 Mar 2018 12:11:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1wc4-0000lo-EP for qemu-devel@nongnu.org; Fri, 30 Mar 2018 12:10:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1wc1-00071y-Kh for qemu-devel@nongnu.org; Fri, 30 Mar 2018 12:10:48 -0400 Received: from relay.sw.ru ([185.231.240.75]:36606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1wc1-00070O-CD; Fri, 30 Mar 2018 12:10:45 -0400 Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1f1wbx-0006Qk-JX; Fri, 30 Mar 2018 19:10:41 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Fri, 30 Mar 2018 19:10:40 +0300 Message-Id: <20180330161040.350271-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH] iotests: fix 169 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, den@openvz.org, vsementsov@virtuozzo.com, jsnow@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use MIGRATION events instead of RESUME. Also, make a TODO: enable dirty-bitmaps capability for offline case. This (likely) fixes racy faults at least of the following types: - timeout on waiting for RESUME event - sha256 mismatch on 136 (138 after this patch) Signed-off-by: Vladimir Sementsov-Ogievskiy --- This patch is a true change for the test anyway. But I don't understand, why (and do really) it fixes the things. And I'm not sure about do we really have a bug in bitmap migration or persistence. So, it's up to you, take it into 2.12...=20 It was already discussed, that "STOP" event is bad for tests. What about "RESUME"? How can we miss it? And sha256 mismatch is really something strange. Max, please check, do it fix 169 for you. tests/qemu-iotests/169 | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/tests/qemu-iotests/169 b/tests/qemu-iotests/169 index 153b10b6e7..5e525ab9d5 100755 --- a/tests/qemu-iotests/169 +++ b/tests/qemu-iotests/169 @@ -31,6 +31,8 @@ disk_a =3D os.path.join(iotests.test_dir, 'disk_a') disk_b =3D os.path.join(iotests.test_dir, 'disk_b') size =3D '1M' mig_file =3D os.path.join(iotests.test_dir, 'mig_file') +mig_cmd =3D 'exec: cat > ' + mig_file +incoming_cmd =3D 'exec: cat ' + mig_file =20 =20 class TestDirtyBitmapMigration(iotests.QMPTestCase): @@ -49,7 +51,6 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.vm_a.launch() =20 self.vm_b =3D iotests.VM(path_suffix=3D'b') - self.vm_b.add_incoming("exec: cat '" + mig_file + "'") =20 def add_bitmap(self, vm, granularity, persistent): params =3D {'node': 'drive0', @@ -86,36 +87,30 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): (0xa0201, 0x1000)) =20 should_migrate =3D migrate_bitmaps or persistent and shared_storage + mig_caps =3D [{'capability': 'events', 'state': True}] + if migrate_bitmaps: + mig_caps.append({'capability': 'dirty-bitmaps', 'state': True}) =20 + result =3D self.vm_a.qmp('migrate-set-capabilities', + capabilities=3Dmig_caps) + self.assert_qmp(result, 'return', {}) + + self.vm_b.add_incoming(incoming_cmd if online else "defer") self.vm_b.add_drive(disk_a if shared_storage else disk_b) =20 if online: os.mkfifo(mig_file) self.vm_b.launch() + result =3D self.vm_b.qmp('migrate-set-capabilities', + capabilities=3Dmig_caps) + self.assert_qmp(result, 'return', {}) =20 self.add_bitmap(self.vm_a, granularity, persistent) for r in regions: self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % r) sha256 =3D self.get_bitmap_hash(self.vm_a) =20 - if migrate_bitmaps: - capabilities =3D [{'capability': 'dirty-bitmaps', 'state': Tru= e}] - - result =3D self.vm_a.qmp('migrate-set-capabilities', - capabilities=3Dcapabilities) - self.assert_qmp(result, 'return', {}) - - if online: - result =3D self.vm_b.qmp('migrate-set-capabilities', - capabilities=3Dcapabilities) - self.assert_qmp(result, 'return', {}) - - result =3D self.vm_a.qmp('migrate-set-capabilities', - capabilities=3D[{'capability': 'events', - 'state': True}]) - self.assert_qmp(result, 'return', {}) - - result =3D self.vm_a.qmp('migrate', uri=3D'exec:cat>' + mig_file) + result =3D self.vm_a.qmp('migrate', uri=3Dmig_cmd) while True: event =3D self.vm_a.event_wait('MIGRATION') if event['data']['status'] =3D=3D 'completed': @@ -124,9 +119,16 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if not online: self.vm_a.shutdown() self.vm_b.launch() - # TODO enable bitmap capability for vm_b in this case + result =3D self.vm_b.qmp('migrate-set-capabilities', + capabilities=3Dmig_caps) + self.assert_qmp(result, 'return', {}) + result =3D self.vm_b.qmp('migrate-incoming', uri=3Dincoming_cm= d) + self.assert_qmp(result, 'return', {}) =20 - self.vm_b.event_wait("RESUME", timeout=3D10.0) + while True: + event =3D self.vm_b.event_wait('MIGRATION') + if event['data']['status'] =3D=3D 'completed': + break =20 self.check_bitmap(self.vm_b, sha256 if should_migrate else False) =20 --=20 2.11.1