From nobody Thu May 2 14:21:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557515140; cv=none; d=zoho.com; s=zohoarc; b=mBhih6JwiHyq2yMHF3E4yo5M4y4Tkpr/WpeoUn+w/rHCYmDGb5yCAbE+x8aE6ss/ktR8uAwooqXeP7QCw1HNoUvpjQmWfixQWcT708zpPtoQCu6h8u8fP7W9Ypf5Y4Il4xeI0zC4S2UQCPz68meA+YR45zZ6GiJtFzMHjqNYrVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557515140; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=X1SSDIFRPeMLyVVZyeS74mXPdLSqEoxEJ/ilG/N6BaA=; b=mV+T/yw6/S6DkqAYbNDEfgY4TPozRQdy7S2AqS93dG3IwknQa2jsC+p3jwdR8VLBy1oglOtnldnFhXfNJD4eCQlmi/eYW9bdy60yfBnipJ1vSbWBedv8wYzuVqR94qHFr0jjksRWmDn5QqNPwLa1VPA/LSaZDp0ry+Ww17xV81A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155751514027712.066935061491108; Fri, 10 May 2019 12:05:40 -0700 (PDT) Received: from localhost ([127.0.0.1]:48657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPApv-0000PG-8w for importer@patchew.org; Fri, 10 May 2019 15:05:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPAne-0007Vm-SD for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPAnc-0005u2-Tx for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49422) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPAnZ-0005r7-Is; Fri, 10 May 2019 15:03:13 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 434FA13A5C; Fri, 10 May 2019 19:03:12 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-164.bos.redhat.com [10.18.17.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 529065ED4A; Fri, 10 May 2019 19:03:11 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 10 May 2019 15:03:04 -0400 Message-Id: <20190510190307.17647-2-jsnow@redhat.com> In-Reply-To: <20190510190307.17647-1-jsnow@redhat.com> References: <20190510190307.17647-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 10 May 2019 19:03:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/4] blockdev-backup: don't check aio_context too early 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: Kevin Wolf , aihua liang , Markus Armbruster , qemu-stable@nongnu.org, Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" in blockdev_backup_prepare, we check to make sure that the target is associated with a compatible aio context. However, do_blockdev_backup is called later and has some logic to move the target to a compatible aio_context. The transaction version will fail certain commands needlessly early as a result. Allow blockdev_backup_prepare to simply call do_blockdev_backup, which will ultimately decide if the contexts are compatible or not. Note: the transaction version has always disallowed this operation since its initial commit bd8baecd (2014), whereas the version of qmp_blockdev_backup at the time, from commit c29c1dd312f, tried to enforce the aio_context switch instead. It's not clear, and I can't see from the mailing list archives at the time, why the two functions take a different approach. It wasn't until later in efd7556708b (2016) that the standalone version tried to determine if it could set the context or not. Reported-by: aihua liang Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1683498 Signed-off-by: John Snow --- blockdev.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index 79fbac8450..a81d88980c 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1872,10 +1872,6 @@ static void blockdev_backup_prepare(BlkActionState *= common, Error **errp) } =20 aio_context =3D bdrv_get_aio_context(bs); - if (aio_context !=3D bdrv_get_aio_context(target)) { - error_setg(errp, "Backup between two IO threads is not implemented= "); - return; - } aio_context_acquire(aio_context); state->bs =3D bs; =20 --=20 2.20.1 From nobody Thu May 2 14:21:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557515135; cv=none; d=zoho.com; s=zohoarc; b=EYS7VF9ZGC+V8/MRWsC+o2+zGuWFubFBSB03dV2w0aSCdGkQK/LWJMMcCX0ABp9NjFEL4o3am7UP28EGbYxK4ZfELr998l9BujMwQNhZ1wK+tz01SuMcbfnEtCKXjS1v4rJTuKHp9C6VI1gPrbzLPcpjlsTO75ZdSyw2sSvrxBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557515135; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eNUnEYZBh3BnPHGea7wIzfNhOokU76pDMXyUguMXldA=; b=TNtK8kZ4T9lfJ+aESWXVQ498FNCe1AZElhXQUPI8hPyCG/NuVcmRmh647X27V6CwOTHY3gY3CLNaUFvdtTlRAVC76ChGcw1y4ANbKcGUpDDtfMcUc2LSzMKwJENAQwfnBo1DN9+06XcnNaJn6uwsZAhv3Fp3upReyKLyolC9YhI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557515135491469.40258896827686; Fri, 10 May 2019 12:05:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:48655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPApq-0000KZ-Cg for importer@patchew.org; Fri, 10 May 2019 15:05:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPAng-0007Xr-Q1 for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPAne-0005vf-Qa for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPAna-0005ri-8K; Fri, 10 May 2019 15:03:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44C083082A4C; Fri, 10 May 2019 19:03:13 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-164.bos.redhat.com [10.18.17.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6744018A75; Fri, 10 May 2019 19:03:12 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 10 May 2019 15:03:05 -0400 Message-Id: <20190510190307.17647-3-jsnow@redhat.com> In-Reply-To: <20190510190307.17647-1-jsnow@redhat.com> References: <20190510190307.17647-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 10 May 2019 19:03:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/4] iotests.py: do not use infinite waits 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: Kevin Wolf , Markus Armbruster , qemu-stable@nongnu.org, Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Cap waits to 60 seconds so that iotests can fail gracefully if something goes wrong. Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f811f69135..561f547a97 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -516,7 +516,7 @@ class VM(qtest.QEMUQtestMachine): output_list +=3D [key + '=3D' + obj[key]] return ','.join(output_list) =20 - def get_qmp_events_filtered(self, wait=3DTrue): + def get_qmp_events_filtered(self, wait=3D60.0): result =3D [] for ev in self.get_qmp_events(wait=3Dwait): result.append(filter_qmp_event(ev)) @@ -533,10 +533,10 @@ class VM(qtest.QEMUQtestMachine): return result =20 # Returns None on success, and an error string on failure - def run_job(self, job, auto_finalize=3DTrue, auto_dismiss=3DFalse): + def run_job(self, job, auto_finalize=3DTrue, auto_dismiss=3DFalse, wai= t=3D60.0): error =3D None while True: - for ev in self.get_qmp_events_filtered(wait=3DTrue): + for ev in self.get_qmp_events_filtered(wait=3Dwait): if ev['event'] =3D=3D 'JOB_STATUS_CHANGE': status =3D ev['data']['status'] if status =3D=3D 'aborting': @@ -625,7 +625,7 @@ class QMPTestCase(unittest.TestCase): self.assertEqual(self.vm.flatten_qmp_object(json.loads(json_filena= me[5:])), self.vm.flatten_qmp_object(reference)) =20 - def cancel_and_wait(self, drive=3D'drive0', force=3DFalse, resume=3DFa= lse): + def cancel_and_wait(self, drive=3D'drive0', force=3DFalse, resume=3DFa= lse, wait=3D60.0): '''Cancel a block job and wait for it to finish, returning the eve= nt''' result =3D self.vm.qmp('block-job-cancel', device=3Ddrive, force= =3Dforce) self.assert_qmp(result, 'return', {}) @@ -636,7 +636,7 @@ class QMPTestCase(unittest.TestCase): cancelled =3D False result =3D None while not cancelled: - for event in self.vm.get_qmp_events(wait=3DTrue): + for event in self.vm.get_qmp_events(wait=3Dwait): if event['event'] =3D=3D 'BLOCK_JOB_COMPLETED' or \ event['event'] =3D=3D 'BLOCK_JOB_CANCELLED': self.assert_qmp(event, 'data/device', drive) @@ -649,10 +649,10 @@ class QMPTestCase(unittest.TestCase): self.assert_no_active_block_jobs() return result =20 - def wait_until_completed(self, drive=3D'drive0', check_offset=3DTrue): + def wait_until_completed(self, drive=3D'drive0', check_offset=3DTrue, = wait=3D60.0): '''Wait for a block job to finish, returning the event''' while True: - for event in self.vm.get_qmp_events(wait=3DTrue): + for event in self.vm.get_qmp_events(wait=3Dwait): if event['event'] =3D=3D 'BLOCK_JOB_COMPLETED': self.assert_qmp(event, 'data/device', drive) self.assert_qmp_absent(event, 'data/error') --=20 2.20.1 From nobody Thu May 2 14:21:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557515433; cv=none; d=zoho.com; s=zohoarc; b=OVbgasGGf307Xntsf4K6YdDng09jE6lQ6dykRYdieI3JA16JBOEukiE5+omgZSPlsejXncgOtbozCAIz3XTdGtq0CSn/jZqz5tzx/O5w0okGsK5bn4HepZcADpePEdwQeqvUJF15CFbh+fnot6VYECYLP1Tqafy+3PJVNTEQGFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557515433; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ONALvlHpaEG4Ys5vQNgrqzhiZsq/pBWuKjz2khhIh/I=; b=V18AkdeBk+lPsGBKAddsOVvW5UEwK3j1PxPfAjxE7jWfy40+I1DvrhRDqT621pRxgOjHWn19iEEeaZPgi+cSoPBgfIBNH+o0OePKjd5DUtg93hbYtdh1BdMeEurHMxst67c7RjWhlL+01SbnGP9013bRwlG/y0/+fEbYBrmnZKU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15575154332870.985224501757898; Fri, 10 May 2019 12:10:33 -0700 (PDT) Received: from localhost ([127.0.0.1]:48775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPAuY-000551-CY for importer@patchew.org; Fri, 10 May 2019 15:10:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPAni-0007aI-QJ for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPAng-0005xB-Oy for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41700) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPAnb-0005sM-0o; Fri, 10 May 2019 15:03:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44EA7308339A; Fri, 10 May 2019 19:03:14 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-164.bos.redhat.com [10.18.17.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64FE75ED4B; Fri, 10 May 2019 19:03:13 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 10 May 2019 15:03:06 -0400 Message-Id: <20190510190307.17647-4-jsnow@redhat.com> In-Reply-To: <20190510190307.17647-1-jsnow@redhat.com> References: <20190510190307.17647-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 10 May 2019 19:03:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/4] iotests.py: rewrite run_job to be pickier 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: Kevin Wolf , Markus Armbruster , qemu-stable@nongnu.org, Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Don't pull events out of the queue that don't belong to us; be choosier so that we can use this method to drive jobs that were launched by transactions that may have more jobs. Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 561f547a97..601c802476 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -536,23 +536,21 @@ class VM(qtest.QEMUQtestMachine): def run_job(self, job, auto_finalize=3DTrue, auto_dismiss=3DFalse, wai= t=3D60.0): error =3D None while True: - for ev in self.get_qmp_events_filtered(wait=3Dwait): - if ev['event'] =3D=3D 'JOB_STATUS_CHANGE': - status =3D ev['data']['status'] - if status =3D=3D 'aborting': - result =3D self.qmp('query-jobs') - for j in result['return']: - if j['id'] =3D=3D job: - error =3D j['error'] - log('Job failed: %s' % (j['error'])) - elif status =3D=3D 'pending' and not auto_finalize: - self.qmp_log('job-finalize', id=3Djob) - elif status =3D=3D 'concluded' and not auto_dismiss: - self.qmp_log('job-dismiss', id=3Djob) - elif status =3D=3D 'null': - return error - else: - iotests.log(ev) + ev =3D self.event_wait(name=3D'JOB_STATUS_CHANGE', + match=3D{'data':{'id':job}}) + status =3D ev['data']['status'] + if status =3D=3D 'aborting': + result =3D self.qmp('query-jobs') + for j in result['return']: + if j['id'] =3D=3D job: + error =3D j['error'] + log('Job failed: %s' % (j['error'])) + elif status =3D=3D 'pending' and not auto_finalize: + self.qmp_log('job-finalize', id=3Djob) + elif status =3D=3D 'concluded' and not auto_dismiss: + self.qmp_log('job-dismiss', id=3Djob) + elif status =3D=3D 'null': + return error =20 def node_info(self, node_name): nodes =3D self.qmp('query-named-block-nodes') --=20 2.20.1 From nobody Thu May 2 14:21:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557515356; cv=none; d=zoho.com; s=zohoarc; b=jDrwztcFj0Zmh+GJDdYTOndv4IwWrMnDnDF0a/zUxT/zza/+sYR2RxRuvAebqRRwPV39X4z5s1VRk3kpUntlIknwGPIlMb+KAwzPCFlHtmOmIAOwvHQtBBoVmbAW/dB8in2aTZx6jCj14szNjCC5oOQKZ+4GvDXr+mfaNJ6uVbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557515356; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=s3SHR/xxRmqI/VmcU3yU+3KneoSDYnTdyYnFR+PwdYA=; b=iXJWG/wCEsYbZpZo775W+5mEnnGRdXOBRzW7AlI35UJIGgj3ywtZVwQaEYW4hH6v4P6dq31EeRWJFGz8iTwxVqE7s4ICkM/OEQFtbQNn0JjCuF1OHrP4mjrBi/UFVN8Kh8cSv5humW96fr+vFjhTao/D1piEF/oI3Plehxan3S4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557515356797874.9888837313696; Fri, 10 May 2019 12:09:16 -0700 (PDT) Received: from localhost ([127.0.0.1]:48734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPAt9-0003ba-6H for importer@patchew.org; Fri, 10 May 2019 15:08:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPAnl-0007dT-MU for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPAni-0005yY-P5 for qemu-devel@nongnu.org; Fri, 10 May 2019 15:03:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPAnc-0005tA-U5; Fri, 10 May 2019 15:03:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CF6CA7F8; Fri, 10 May 2019 19:03:15 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-164.bos.redhat.com [10.18.17.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66AF65ED4D; Fri, 10 May 2019 19:03:14 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 10 May 2019 15:03:07 -0400 Message-Id: <20190510190307.17647-5-jsnow@redhat.com> In-Reply-To: <20190510190307.17647-1-jsnow@redhat.com> References: <20190510190307.17647-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 10 May 2019 19:03:15 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/4] iotests: add iotest 250 for testing blockdev-backup across iothread contexts 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: Kevin Wolf , Markus Armbruster , qemu-stable@nongnu.org, Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow --- tests/qemu-iotests/250 | 129 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/250.out | 119 ++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 249 insertions(+) create mode 100755 tests/qemu-iotests/250 create mode 100644 tests/qemu-iotests/250.out diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250 new file mode 100755 index 0000000000..1406b10958 --- /dev/null +++ b/tests/qemu-iotests/250 @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# +# Test incremental/backup across iothread contexts +# +# Copyright (c) 2019 John Snow for Red Hat, Inc. +# +# 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 . +# +# owner=3Djsnow@redhat.com + +import logging +import os +import iotests +from iotests import log + +iotests.verify_image_format(supported_fmts=3D['qcow2']) +size =3D 64 * 1024 * 1024 + +with iotests.FilePath('img0') as img0_path, \ + iotests.FilePath('img1') as img1_path, \ + iotests.FilePath('img0-full') as img0_full_path, \ + iotests.FilePath('img1-full') as img1_full_path, \ + iotests.FilePath('img0-incr') as img0_incr_path, \ + iotests.FilePath('img1-incr') as img1_incr_path, \ + iotests.VM() as vm: + + def create_target(filepath, name, size): + basename =3D os.path.basename(filepath) + nodename =3D "file_{}".format(basename) + log(vm.command('blockdev-create', job_id=3D'job1', + options=3D{ + 'driver': 'file', + 'filename': filepath, + 'size': size, + })) + vm.run_job('job1') + log(vm.command('blockdev-add', driver=3D'file', + node_name=3Dnodename, filename=3Dfilepath)) + log(vm.command('blockdev-create', job_id=3D'job2', + options=3D{ + 'driver': iotests.imgfmt, + 'file': nodename, + 'size': size, + })) + vm.run_job('job2') + log(vm.command('blockdev-add', driver=3Diotests.imgfmt, + node_name=3Dname, + file=3Dnodename)) + + def wait_job(job): + vm.run_job(job, auto_dismiss=3DTrue) + event =3D vm.event_wait(name=3D'BLOCK_JOB_COMPLETED', + match=3D{'data':{'device':job}}) + log(iotests.filter_qmp_event(event)) + + log('--- Preparing images & VM ---\n') + vm.add_object('iothread,id=3Diothread0') + vm.add_object('iothread,id=3Diothread1') + vm.add_device('virtio-scsi-pci,id=3Dscsi0,iothread=3Diothread0') + vm.add_device('virtio-scsi-pci,id=3Dscsi1,iothread=3Diothread1') + iotests.qemu_img_create('-f', iotests.imgfmt, img0_path, str(size)) + iotests.qemu_img_create('-f', iotests.imgfmt, img1_path, str(size)) + vm.add_drive(img0_path, interface=3D'none') + vm.add_device('scsi-hd,id=3Ddevice0,drive=3Ddrive0,bus=3Dscsi0.0') + vm.add_drive(img1_path, interface=3D'none') + vm.add_device('scsi-hd,id=3Ddevice1,drive=3Ddrive1,bus=3Dscsi1.0') + + log('--- Starting VM ---\n') + vm.launch() + + log('--- Create Targets & Full Backups ---\n') + create_target(img0_full_path, 'img0-full', size) + create_target(img1_full_path, 'img1-full', size) + ret =3D vm.qmp_log('transaction', indent=3D2, actions=3D[ + { 'type': 'block-dirty-bitmap-add', + 'data': { 'node': 'drive0', 'name': 'bitmap0' }}, + { 'type': 'block-dirty-bitmap-add', + 'data': { 'node': 'drive1', 'name': 'bitmap1' }}, + { 'type': 'blockdev-backup', + 'data': { 'device': 'drive0', + 'target': 'img0-full', + 'sync': 'full', + 'job-id': 'j0' }}, + { 'type': 'blockdev-backup', + 'data': { 'device': 'drive1', + 'target': 'img1-full', + 'sync': 'full', + 'job-id': 'j1' }} + ]) + if "error" in ret: + raise Exception(ret['error']['desc']) + wait_job('j0') + wait_job('j1') + + log('\n--- Create Targets & Incremental Backups ---\n') + create_target(img0_incr_path, 'img0-incr', size) + create_target(img1_incr_path, 'img1-incr', size) + ret =3D vm.qmp_log('transaction', indent=3D2, actions=3D[ + { 'type': 'blockdev-backup', + 'data': { 'device': 'drive0', + 'target': 'img0-incr', + 'sync': 'incremental', + 'bitmap': 'bitmap0', + 'job-id': 'j2' }}, + { 'type': 'blockdev-backup', + 'data': { 'device': 'drive1', + 'target': 'img1-incr', + 'sync': 'incremental', + 'bitmap': 'bitmap1', + 'job-id': 'j3' }} + ]) + if "error" in ret: + raise Exception(ret['error']['desc']) + wait_job('j2') + wait_job('j3') + + log('\n--- Done ---') + vm.shutdown() diff --git a/tests/qemu-iotests/250.out b/tests/qemu-iotests/250.out new file mode 100644 index 0000000000..eec38614ec --- /dev/null +++ b/tests/qemu-iotests/250.out @@ -0,0 +1,119 @@ +--- Preparing images & VM --- + +--- Starting VM --- + +--- Create Targets & Full Backups --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "job1"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "job2"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "job1"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "job2"}} +{"return": {}} +{} +{ + "execute": "transaction", + "arguments": { + "actions": [ + { + "data": { + "name": "bitmap0", + "node": "drive0" + }, + "type": "block-dirty-bitmap-add" + }, + { + "data": { + "name": "bitmap1", + "node": "drive1" + }, + "type": "block-dirty-bitmap-add" + }, + { + "data": { + "device": "drive0", + "job-id": "j0", + "sync": "full", + "target": "img0-full" + }, + "type": "blockdev-backup" + }, + { + "data": { + "device": "drive1", + "job-id": "j1", + "sync": "full", + "target": "img1-full" + }, + "type": "blockdev-backup" + } + ] + } +} +{ + "return": {} +} +{"data": {"device": "j0", "len": 67108864, "offset": 67108864, "speed": 0,= "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsec= onds": "USECS", "seconds": "SECS"}} +{"data": {"device": "j1", "len": 67108864, "offset": 67108864, "speed": 0,= "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsec= onds": "USECS", "seconds": "SECS"}} + +--- Create Targets & Incremental Backups --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "job1"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "job2"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "job1"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "job2"}} +{"return": {}} +{} +{ + "execute": "transaction", + "arguments": { + "actions": [ + { + "data": { + "bitmap": "bitmap0", + "device": "drive0", + "job-id": "j2", + "sync": "incremental", + "target": "img0-incr" + }, + "type": "blockdev-backup" + }, + { + "data": { + "bitmap": "bitmap1", + "device": "drive1", + "job-id": "j3", + "sync": "incremental", + "target": "img1-incr" + }, + "type": "blockdev-backup" + } + ] + } +} +{ + "return": {} +} +{"data": {"device": "j2", "len": 67108864, "offset": 67108864, "speed": 0,= "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsec= onds": "USECS", "seconds": "SECS"}} +{"data": {"device": "j3", "len": 67108864, "offset": 67108864, "speed": 0,= "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsec= onds": "USECS", "seconds": "SECS"}} + +--- Done --- diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 7ac9a5ea4a..f533836848 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -249,3 +249,4 @@ 247 rw auto quick 248 rw auto quick 249 rw auto quick +250 rw auto quick --=20 2.20.1