From nobody Sun Apr 28 21:49:39 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506604030207348.0589335477597; Thu, 28 Sep 2017 06:07:10 -0700 (PDT) Received: from localhost ([::1]:59201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxYWu-00044M-Bw for importer@patchew.org; Thu, 28 Sep 2017 09:07:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxYW5-0003hM-0B for qemu-devel@nongnu.org; Thu, 28 Sep 2017 09:06:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxYW1-0008Db-Q2 for qemu-devel@nongnu.org; Thu, 28 Sep 2017 09:06:12 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:41085 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxYW1-0008Cx-DU; Thu, 28 Sep 2017 09:06:09 -0400 Received: from kvm.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v8SD65V0018709; Thu, 28 Sep 2017 16:06:05 +0300 (MSK) From: Vladimir Sementsov-Ogievskiy To: mreitz@redhat.com Date: Thu, 28 Sep 2017 16:06:05 +0300 Message-Id: <20170928130605.79666-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170912094622.GC29136@localhost.localdomain> References: <20170912094622.GC29136@localhost.localdomain> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH] iotests: test clearing unknown autoclear_features by qcow2 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: vsementsov@virtuozzo.com, qemu-devel@nongnu.org, qemu-block@nongnu.org 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" Test clearing unknown autoclear_features by qcow2 on incoming migration. Signed-off-by: Vladimir Sementsov-Ogievskiy --- Here is a test, related to this problem, which fails with SIGABRT on master and is successful on 2.9 I've tried to fix it by some interchanges in bdrv_invalidate_cache but unsuccessfully... tests/qemu-iotests/196 | 63 ++++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/196.out | 5 ++++ tests/qemu-iotests/group | 1 + 3 files changed, 69 insertions(+) create mode 100755 tests/qemu-iotests/196 create mode 100644 tests/qemu-iotests/196.out diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 new file mode 100755 index 0000000000..9ffbc723c2 --- /dev/null +++ b/tests/qemu-iotests/196 @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# +# Test clearing unknown autoclear_features flag by qcow2 after +# migration. This test mimics migration to older qemu. +# +# Copyright (c) 2017 Parallels International GmbH +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import os +import iotests +from iotests import qemu_img + +disk =3D os.path.join(iotests.test_dir, 'disk') +migfile =3D os.path.join(iotests.test_dir, 'migfile') + +class TestInvalidateAutoclear(iotests.QMPTestCase): + + def tearDown(self): + self.vm_a.shutdown() + self.vm_b.shutdown() + os.remove(disk) + os.remove(migfile) + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, disk, '1M') + + self.vm_a =3D iotests.VM(path_suffix=3D'a').add_drive(disk) + self.vm_a.launch() + + self.vm_b =3D iotests.VM(path_suffix=3D'b').add_drive(disk) + self.vm_b.add_incoming("exec: cat '" + migfile + "'") + + def test_migration(self): + result =3D self.vm_a.qmp('migrate', uri=3D'exec:cat>' + migfile) + self.assert_qmp(result, 'return', {}); + self.assertNotEqual(self.vm_a.event_wait("STOP"), None) + + with open(disk, 'r+b') as f: + f.seek(88) # first byte of autoclear_features field + f.write(b'\xff') + + self.vm_b.launch() + self.assertNotEqual(self.vm_b.event_wait("RESUME"), None) + + with open(disk, 'rb') as f: + f.seek(88) + self.assertEqual(f.read(1), b'\x00') + +if __name__ =3D=3D '__main__': + iotests.main(supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/196.out b/tests/qemu-iotests/196.out new file mode 100644 index 0000000000..ae1213e6f8 --- /dev/null +++ b/tests/qemu-iotests/196.out @@ -0,0 +1,5 @@ +. +---------------------------------------------------------------------- +Ran 1 tests + +OK diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index cdccee319e..be219ca5fd 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -191,3 +191,4 @@ 192 rw auto quick 194 rw auto migration quick 195 rw auto quick +196 rw auto quick --=20 2.11.1