From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542905826589531.6194289320068; Thu, 22 Nov 2018 08:57:06 -0800 (PST) Received: from localhost ([::1]:47731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsHi-0003Mo-Tz for importer@patchew.org; Thu, 22 Nov 2018 11:56:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFM-0001eA-Du for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFK-0000iP-Jf for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35374) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFG-0000ee-K4; Thu, 22 Nov 2018 11:54:26 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 999453001FE5; Thu, 22 Nov 2018 16:54:25 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F6DE5D760; Thu, 22 Nov 2018 16:54:24 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:05 +0100 Message-Id: <20181122165417.23894-2-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 22 Nov 2018 16:54:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/13] iotests: Replace time.clock() with Timeout 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" time.clock() is deprecated since Python 3.3. Current Python versions warn that the function will be removed in Python 3.8, and those warnings make the test case 118 fail. Replace it with the Timeout mechanism that is compatible with both Python 2 and 3, and makes the code even a little nicer. Signed-off-by: Kevin Wolf Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qemu-iotests/118 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index ff3b2ae3e7..c4f4c213ca 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -53,21 +53,17 @@ class ChangeBaseClass(iotests.QMPTestCase): if not self.has_real_tray: return =20 - timeout =3D time.clock() + 3 - while not self.has_opened and time.clock() < timeout: - self.process_events() - if not self.has_opened: - self.fail('Timeout while waiting for the tray to open') + with iotests.Timeout(3, 'Timeout while waiting for the tray to ope= n'): + while not self.has_opened: + self.process_events() =20 def wait_for_close(self): if not self.has_real_tray: return =20 - timeout =3D time.clock() + 3 - while not self.has_closed and time.clock() < timeout: - self.process_events() - if not self.has_opened: - self.fail('Timeout while waiting for the tray to close') + with iotests.Timeout(3, 'Timeout while waiting for the tray to clo= se'): + while not self.has_closed: + self.process_events() =20 class GeneralChangeTestsBaseClass(ChangeBaseClass): =20 --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906197768821.7310029838771; Thu, 22 Nov 2018 09:03:17 -0800 (PST) Received: from localhost ([::1]:47793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsNj-0000wA-3F for importer@patchew.org; Thu, 22 Nov 2018 12:03:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFO-0001gI-Jl for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFM-0000ke-OV for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFI-0000fA-9Y; Thu, 22 Nov 2018 11:54:28 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F37C989AD6; Thu, 22 Nov 2018 16:54:26 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id E641B5D763; Thu, 22 Nov 2018 16:54:25 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:06 +0100 Message-Id: <20181122165417.23894-3-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 22 Nov 2018 16:54:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/13] iotests: Replace assertEquals() with assertEqual() 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" TestCase.assertEquals() is deprecated since Python 2.7. Recent Python versions print a warning when the function is called, which makes test cases fail. Replace it with the preferred spelling assertEqual(). Signed-off-by: Kevin Wolf Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qemu-iotests/041 | 6 +++--- tests/qemu-iotests/118 | 4 ++-- tests/qemu-iotests/iotests.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 3615011d98..26bf1701eb 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -469,7 +469,7 @@ new_state =3D "1" self.assert_qmp(event, 'data/id', 'drive0') event =3D self.vm.get_qmp_event(wait=3DTrue) =20 - self.assertEquals(event['event'], 'BLOCK_JOB_ERROR') + self.assertEqual(event['event'], 'BLOCK_JOB_ERROR') self.assert_qmp(event, 'data/device', 'drive0') self.assert_qmp(event, 'data/operation', 'read') result =3D self.vm.qmp('query-block-jobs') @@ -494,7 +494,7 @@ new_state =3D "1" self.assert_qmp(event, 'data/id', 'drive0') event =3D self.vm.get_qmp_event(wait=3DTrue) =20 - self.assertEquals(event['event'], 'BLOCK_JOB_ERROR') + self.assertEqual(event['event'], 'BLOCK_JOB_ERROR') self.assert_qmp(event, 'data/device', 'drive0') self.assert_qmp(event, 'data/operation', 'read') result =3D self.vm.qmp('query-block-jobs') @@ -625,7 +625,7 @@ new_state =3D "1" self.assert_qmp(result, 'return', {}) =20 event =3D self.vm.event_wait(name=3D'BLOCK_JOB_ERROR') - self.assertEquals(event['event'], 'BLOCK_JOB_ERROR') + self.assertEqual(event['event'], 'BLOCK_JOB_ERROR') self.assert_qmp(event, 'data/device', 'drive0') self.assert_qmp(event, 'data/operation', 'write') result =3D self.vm.qmp('query-block-jobs') diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index c4f4c213ca..603e10e8a2 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -261,7 +261,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device_nam= e) # Should be a no-op self.assert_qmp(result, 'return', {}) - self.assertEquals(self.vm.get_qmp_events(wait=3DFalse), []) + self.assertEqual(self.vm.get_qmp_events(wait=3DFalse), []) =20 def test_remove_on_closed(self): if not self.has_real_tray: @@ -448,7 +448,7 @@ class TestChangeReadOnly(ChangeBaseClass): read_only_mode=3D'r= etain') self.assert_qmp(result, 'error/class', 'GenericError') =20 - self.assertEquals(self.vm.get_qmp_events(wait=3DFalse), []) + self.assertEqual(self.vm.get_qmp_events(wait=3DFalse), []) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 27bb2b600c..d537538ba0 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -581,7 +581,7 @@ class QMPTestCase(unittest.TestCase): def wait_ready_and_cancel(self, drive=3D'drive0'): self.wait_ready(drive=3Ddrive) event =3D self.cancel_and_wait(drive=3Ddrive) - self.assertEquals(event['event'], 'BLOCK_JOB_COMPLETED') + self.assertEqual(event['event'], 'BLOCK_JOB_COMPLETED') self.assert_qmp(event, 'data/type', 'mirror') self.assert_qmp(event, 'data/offset', event['data']['len']) =20 --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542905992206514.9219820332232; Thu, 22 Nov 2018 08:59:52 -0800 (PST) Received: from localhost ([::1]:47745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsKU-0006p8-AC for importer@patchew.org; Thu, 22 Nov 2018 11:59:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFP-0001h1-9C for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFN-0000lC-MM for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFJ-0000gg-Jg; Thu, 22 Nov 2018 11:54:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 575862D809; Thu, 22 Nov 2018 16:54:28 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A5E55D760; Thu, 22 Nov 2018 16:54:27 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:07 +0100 Message-Id: <20181122165417.23894-4-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 22 Nov 2018 16:54:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/13] iotests: Skip 233 if certtool not installed 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Eric Blake The use of TLS while building qemu is optional. While the 'certtool' binary should be available on every platform that supports building against TLS, that does not imply that the developer has installed it. Make the test gracefully skip in that case. Reported-by: Kevin Wolf Signed-off-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Wainer dos Santos Moschetta Signed-off-by: Kevin Wolf --- tests/qemu-iotests/common.tls | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls index 39f17c1b99..eae81789bb 100644 --- a/tests/qemu-iotests/common.tls +++ b/tests/qemu-iotests/common.tls @@ -31,6 +31,9 @@ tls_x509_cleanup() =20 tls_x509_init() { + (certtool --help) >/dev/null 2>&1 || \ + _notrun "certtool utility not found, skipping test" + mkdir -p "${tls_dir}" =20 # use a fixed key so we don't waste system entropy on --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542905826566325.5859228177587; Thu, 22 Nov 2018 08:57:06 -0800 (PST) Received: from localhost ([::1]:47729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsHa-0003FI-IH for importer@patchew.org; Thu, 22 Nov 2018 11:56:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFR-0001ix-9e for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFP-0000md-3J for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51466) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFK-0000hj-T3; Thu, 22 Nov 2018 11:54:31 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B00B4882EA; Thu, 22 Nov 2018 16:54:29 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id A213E5D760; Thu, 22 Nov 2018 16:54:28 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:08 +0100 Message-Id: <20181122165417.23894-5-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 22 Nov 2018 16:54:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/13] qemu-img: Fix typo 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Reitz Fixes: d402b6a21a825a5c07aac9251990860723d49f5d Reported-by: Kevin Wolf Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 13a6ca31b4..a9a2470e1a 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -261,7 +261,7 @@ static int print_block_option_help(const char *filename= , const char *fmt) return 1; } if (!proto_drv->create_opts) { - error_report("Protocal driver '%s' does not support image crea= tion", + error_report("Protocol driver '%s' does not support image crea= tion", proto_drv->format_name); return 1; } --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906393951840.4881312767642; Thu, 22 Nov 2018 09:06:33 -0800 (PST) Received: from localhost ([::1]:47844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsQy-0004Ms-TV for importer@patchew.org; Thu, 22 Nov 2018 12:06:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFT-0001kq-3G for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFR-0000rN-Dz for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51470) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFM-0000jn-Es; Thu, 22 Nov 2018 11:54:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EDC622D; Thu, 22 Nov 2018 16:54:31 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04B785D760; Thu, 22 Nov 2018 16:54:29 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:09 +0100 Message-Id: <20181122165417.23894-6-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 22 Nov 2018 16:54:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/13] qemu-img: Fix leak 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Reitz create_opts was leaked here. This is not too bad since the process is about to exit anyway, but relying on that does not make the code nicer to read. Fixes: d402b6a21a825a5c07aac9251990860723d49f5d Reported-by: Kevin Wolf Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- qemu-img.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qemu-img.c b/qemu-img.c index a9a2470e1a..ad04f59565 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -263,6 +263,7 @@ static int print_block_option_help(const char *filename= , const char *fmt) if (!proto_drv->create_opts) { error_report("Protocol driver '%s' does not support image crea= tion", proto_drv->format_name); + qemu_opts_free(create_opts); return 1; } create_opts =3D qemu_opts_append(create_opts, proto_drv->create_op= ts); --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154290598359772.78200452006092; Thu, 22 Nov 2018 08:59:43 -0800 (PST) Received: from localhost ([::1]:47743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsKM-0006gM-0r for importer@patchew.org; Thu, 22 Nov 2018 11:59:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFU-0001mz-Sq for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFT-0000vg-FD for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFN-0000kk-RW; Thu, 22 Nov 2018 11:54:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BB443084026; Thu, 22 Nov 2018 16:54:32 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AFDA5D760; Thu, 22 Nov 2018 16:54:31 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:10 +0100 Message-Id: <20181122165417.23894-7-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 22 Nov 2018 16:54:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/13] scsi-disk: Fix crash if underlying host file or disk returns error 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Richard W.M. Jones" Commit 40dce4ee6 "scsi-disk: fix rerror/werror=3Dignore" introduced a bug which causes qemu to crash with the assertion error below if the host file or disk returns an error: qemu-system-x86_64: hw/scsi/scsi-bus.c:1374: scsi_req_complete: Assertion `req->status =3D=3D -1' failed. Kevin Wolf suggested this fix: < kwolf> Hm, should the final return false; in that patch actually be a return true? < kwolf> Because I think he didn't intend to change anything except BLOCK_ERROR_ACTION_IGNORE Buglink: https://bugs.launchpad.net/qemu/+bug/1804323 Fixes: 40dce4ee61c68395f6d463fae792f61b7c003bce Signed-off-by: Richard W.M. Jones Signed-off-by: Kevin Wolf --- hw/scsi/scsi-disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 6eb258d3f3..0e9027c8f3 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -482,7 +482,7 @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int er= ror, bool acct_failed) if (action =3D=3D BLOCK_ERROR_ACTION_STOP) { scsi_req_retry(&r->req); } - return false; + return true; } =20 static void scsi_write_complete_noio(SCSIDiskReq *r, int ret) --=20 2.19.1 From nobody Wed May 8 14:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906567377224.8797652000983; Thu, 22 Nov 2018 09:09:27 -0800 (PST) Received: from localhost ([::1]:47887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsTk-0007A6-4M for importer@patchew.org; Thu, 22 Nov 2018 12:09:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFU-0001ms-OO for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFT-0000vv-Hs for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36762) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFP-0000lV-2k; Thu, 22 Nov 2018 11:54:35 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEA9030821EF; Thu, 22 Nov 2018 16:54:33 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id D29275D763; Thu, 22 Nov 2018 16:54:32 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:11 +0100 Message-Id: <20181122165417.23894-8-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 22 Nov 2018 16:54:33 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/13] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options() 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Alberto Garcia Commit e35bdc123a4ace9f4d3fcca added the auto-read-only option and the code to update its corresponding flag in update_flags_from_options(), but forgot to clear the flag if auto-read-only is false. Signed-off-by: Alberto Garcia Reported-by: Max Reitz Signed-off-by: Kevin Wolf --- block.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block.c b/block.c index 3feac08535..9cd6f4a50d 100644 --- a/block.c +++ b/block.c @@ -1137,7 +1137,7 @@ static int bdrv_open_flags(BlockDriverState *bs, int = flags) =20 static void update_flags_from_options(int *flags, QemuOpts *opts) { - *flags &=3D ~BDRV_O_CACHE_MASK; + *flags &=3D ~(BDRV_O_CACHE_MASK | BDRV_O_RDWR | BDRV_O_AUTO_RDONLY); =20 assert(qemu_opt_find(opts, BDRV_OPT_CACHE_NO_FLUSH)); if (qemu_opt_get_bool_del(opts, BDRV_OPT_CACHE_NO_FLUSH, false)) { @@ -1149,8 +1149,6 @@ static void update_flags_from_options(int *flags, Qem= uOpts *opts) *flags |=3D BDRV_O_NOCACHE; } =20 - *flags &=3D ~BDRV_O_RDWR; - assert(qemu_opt_find(opts, BDRV_OPT_READ_ONLY)); if (!qemu_opt_get_bool_del(opts, BDRV_OPT_READ_ONLY, false)) { *flags |=3D BDRV_O_RDWR; --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542905827086500.8779627376815; Thu, 22 Nov 2018 08:57:07 -0800 (PST) Received: from localhost ([::1]:47730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsHg-0003Jq-Oz for importer@patchew.org; Thu, 22 Nov 2018 11:56:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFV-0001nq-KV for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFU-0000wc-6s for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46886) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFQ-0000n2-I4; Thu, 22 Nov 2018 11:54:36 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 465A44D4DE; Thu, 22 Nov 2018 16:54:35 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3573F5D760; Thu, 22 Nov 2018 16:54:34 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:12 +0100 Message-Id: <20181122165417.23894-9-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 22 Nov 2018 16:54:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/13] iotests: fix nbd test 233 to work correctly with raw images 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 The first qemu-io command must honour the $IMGFMT that is set rather than hardcoding qcow2. The qemu-nbd commands should also set $IMGFMT to avoid the insecure format probe warning. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- tests/qemu-iotests/233 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233 index a4da60d0ad..1814efe333 100755 --- a/tests/qemu-iotests/233 +++ b/tests/qemu-iotests/233 @@ -66,7 +66,7 @@ $QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_= io =20 echo echo "=3D=3D check TLS client to plain server fails =3D=3D" -nbd_server_start_tcp_socket "$TEST_IMG" +nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG" =20 $QEMU_IMG info --image-opts \ --object tls-creds-x509,dir=3D${tls_dir}/client1,endpoint=3Dclient,id= =3Dtls0 \ @@ -78,7 +78,10 @@ nbd_server_stop echo echo "=3D=3D check plain client to TLS server fails =3D=3D" =20 -nbd_server_start_tcp_socket --object tls-creds-x509,dir=3D${tls_dir}/serve= r1,endpoint=3Dserver,id=3Dtls0,verify-peer=3Dyes --tls-creds tls0 "$TEST_IM= G" +nbd_server_start_tcp_socket \ + --object tls-creds-x509,dir=3D${tls_dir}/server1,endpoint=3Dserver,id= =3Dtls0,verify-peer=3Dyes \ + --tls-creds tls0 \ + -f $IMGFMT "$TEST_IMG" =20 $QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/P= ORT/g" =20 @@ -104,7 +107,7 @@ $QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --im= age-opts \ driver=3Dnbd,host=3D$nbd_tcp_addr,port=3D$nbd_tcp_port,tls-creds=3Dtls= 0 \ 2>&1 | _filter_qemu_io =20 -$QEMU_IO -f qcow2 -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io +$QEMU_IO -f $IMGFMT -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_= io =20 # success, all done echo "*** done" --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906002380800.01406439381; Thu, 22 Nov 2018 09:00:02 -0800 (PST) Received: from localhost ([::1]:47747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsKb-0006x7-FH for importer@patchew.org; Thu, 22 Nov 2018 11:59:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFY-0001rP-AK for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFW-0000ze-4a for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35780) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFR-0000pW-QV; Thu, 22 Nov 2018 11:54:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1331C06586F; Thu, 22 Nov 2018 16:54:36 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91C175D760; Thu, 22 Nov 2018 16:54:35 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:13 +0100 Message-Id: <20181122165417.23894-10-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 22 Nov 2018 16:54:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/13] nvme: call blk_drain in NVMe reset code to avoid lockups 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Igor Druzhinin When blk_flush called in NVMe reset path S/C queues are already freed which means that re-entering AIO handling loop having some IO requests unfinished will lockup or crash as their SG structures being potentially reused. Call blk_drain before freeing the queues to avoid this nasty scenario. Signed-off-by: Igor Druzhinin Acked-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index d0226e7fdc..28d284346d 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -797,6 +797,8 @@ static void nvme_clear_ctrl(NvmeCtrl *n) { int i; =20 + blk_drain(n->conf.blk); + for (i =3D 0; i < n->num_queues; i++) { if (n->sq[i] !=3D NULL) { nvme_free_sq(n->sq[i], n); --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906392131856.6738630384721; Thu, 22 Nov 2018 09:06:32 -0800 (PST) Received: from localhost ([::1]:47842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsQr-0004Hd-KC for importer@patchew.org; Thu, 22 Nov 2018 12:06:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFa-0001uI-Pe for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFX-00011q-VI for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35796) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFT-0000sz-6W; Thu, 22 Nov 2018 11:54:39 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06635C05681F; Thu, 22 Nov 2018 16:54:38 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED8AD5D763; Thu, 22 Nov 2018 16:54:36 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:14 +0100 Message-Id: <20181122165417.23894-11-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 22 Nov 2018 16:54:38 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/13] nvme: fix out-of-bounds access to the CMB 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini Because the CMB BAR has a min_access_size of 2, if you read the last byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one error. This is CVE-2018-16847. Another way to fix this might be to register the CMB as a RAM memory region, which would also be more efficient. However, that might be a change for big-endian machines; I didn't think this through and I don't know how real hardware works. Add a basic testcase for the CMB in case somebody does this change later on. Cc: Keith Busch Cc: qemu-block@nongnu.org Reported-by: Li Qiang Reviewed-by: Li Qiang Tested-by: Li Qiang Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 2 +- tests/nvme-test.c | 68 +++++++++++++++++++++++++++++++++++------- tests/Makefile.include | 2 +- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 28d284346d..8c35cab2b4 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1201,7 +1201,7 @@ static const MemoryRegionOps nvme_cmb_ops =3D { .write =3D nvme_cmb_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .impl =3D { - .min_access_size =3D 2, + .min_access_size =3D 1, .max_access_size =3D 8, }, }; diff --git a/tests/nvme-test.c b/tests/nvme-test.c index 7674a446e4..2700ba838a 100644 --- a/tests/nvme-test.c +++ b/tests/nvme-test.c @@ -8,25 +8,73 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "libqtest.h" +#include "libqos/libqos-pc.h" + +static QOSState *qnvme_start(const char *extra_opts) +{ + QOSState *qs; + const char *arch =3D qtest_get_arch(); + const char *cmd =3D "-drive id=3Ddrv0,if=3Dnone,file=3Dnull-co://,form= at=3Draw " + "-device nvme,addr=3D0x4.0,serial=3Dfoo,drive=3Ddrv0= %s"; + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + qs =3D qtest_pc_boot(cmd, extra_opts ? : ""); + global_qtest =3D qs->qts; + return qs; + } + + g_printerr("nvme tests are only available on x86\n"); + exit(EXIT_FAILURE); +} + +static void qnvme_stop(QOSState *qs) +{ + qtest_shutdown(qs); +} =20 -/* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) { + QOSState *qs; + + qs =3D qnvme_start(NULL); + qnvme_stop(qs); } =20 -int main(int argc, char **argv) +static void nvmetest_cmb_test(void) { - int ret; + const int cmb_bar_size =3D 2 * MiB; + QOSState *qs; + QPCIDevice *pdev; + QPCIBar bar; =20 - g_test_init(&argc, &argv, NULL); - qtest_add_func("/nvme/nop", nop); + qs =3D qnvme_start("-global nvme.cmb_size_mb=3D2"); + pdev =3D qpci_device_find(qs->pcibus, QPCI_DEVFN(4,0)); + g_assert(pdev !=3D NULL); + + qpci_device_enable(pdev); + bar =3D qpci_iomap(pdev, 2, NULL); + + qpci_io_writel(pdev, bar, 0, 0xccbbaa99); + g_assert_cmpint(qpci_io_readb(pdev, bar, 0), =3D=3D, 0x99); + g_assert_cmpint(qpci_io_readw(pdev, bar, 0), =3D=3D, 0xaa99); + + /* Test partially out-of-bounds accesses. */ + qpci_io_writel(pdev, bar, cmb_bar_size - 1, 0x44332211); + g_assert_cmpint(qpci_io_readb(pdev, bar, cmb_bar_size - 1), =3D=3D, 0x= 11); + g_assert_cmpint(qpci_io_readw(pdev, bar, cmb_bar_size - 1), !=3D, 0x22= 11); + g_assert_cmpint(qpci_io_readl(pdev, bar, cmb_bar_size - 1), !=3D, 0x44= 332211); + g_free(pdev); =20 - qtest_start("-drive id=3Ddrv0,if=3Dnone,file=3Dnull-co://,format=3Draw= " - "-device nvme,drive=3Ddrv0,serial=3Dfoo"); - ret =3D g_test_run(); + qnvme_stop(qs); +} =20 - qtest_end(); +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + qtest_add_func("/nvme/nop", nop); + qtest_add_func("/nvme/cmb_test", nvmetest_cmb_test); =20 - return ret; + return g_test_run(); } diff --git a/tests/Makefile.include b/tests/Makefile.include index 613242bc6e..fb0b449c02 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -730,7 +730,7 @@ tests/test-hmp$(EXESUF): tests/test-hmp.o tests/machine-none-test$(EXESUF): tests/machine-none-test.o tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-= y) tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-ob= j-y) -tests/nvme-test$(EXESUF): tests/nvme-test.o +tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y) tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o tests/ac97-test$(EXESUF): tests/ac97-test.o --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906203384616.5623238567119; Thu, 22 Nov 2018 09:03:23 -0800 (PST) Received: from localhost ([::1]:47794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsNk-0000zP-AP for importer@patchew.org; Thu, 22 Nov 2018 12:03:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFa-0001uH-PU for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFY-00012D-2l for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41562) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFU-0000w7-EC; Thu, 22 Nov 2018 11:54:40 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63022307EAAC; Thu, 22 Nov 2018 16:54:39 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51C3A5D760; Thu, 22 Nov 2018 16:54:38 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:15 +0100 Message-Id: <20181122165417.23894-12-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 22 Nov 2018 16:54:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/13] Revert "nvme: fix oob access issue(CVE-2018-16847)" 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This reverts commit 5e3c0220d7e4f0361c4d36c697a8842f2b583402. We have a better fix commited for this now. Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 8c35cab2b4..84062d388f 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1177,10 +1177,6 @@ static void nvme_cmb_write(void *opaque, hwaddr addr= , uint64_t data, unsigned size) { NvmeCtrl *n =3D (NvmeCtrl *)opaque; - - if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) { - return; - } memcpy(&n->cmbuf[addr], &data, size); } =20 @@ -1189,9 +1185,6 @@ static uint64_t nvme_cmb_read(void *opaque, hwaddr ad= dr, unsigned size) uint64_t val; NvmeCtrl *n =3D (NvmeCtrl *)opaque; =20 - if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) { - return 0; - } memcpy(&val, &n->cmbuf[addr], size); return val; } --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906213632729.9057276158636; Thu, 22 Nov 2018 09:03:33 -0800 (PST) Received: from localhost ([::1]:47797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsO2-0001PO-J5 for importer@patchew.org; Thu, 22 Nov 2018 12:03:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFc-0001wW-QU for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFa-00018J-Ug for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41570) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFV-0000xv-SL; Thu, 22 Nov 2018 11:54:42 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF09330832E8; Thu, 22 Nov 2018 16:54:40 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAB7D5D760; Thu, 22 Nov 2018 16:54:39 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:16 +0100 Message-Id: <20181122165417.23894-13-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 22 Nov 2018 16:54:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/13] nvme: fix bug with PCI IRQ pins on teardown 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Logan Gunthorpe When the submission and completion queues are being torn down the IRQ will be asserted for the completion queue when the submsission queue is deleted. Then when the completion queue is deleted it stays asserted. Thus, on systems that do not use MSI, no further interrupts can be triggered on the host. Linux sees this as a long delay when unbinding the nvme device. Eventually the interrupt timeout occurs and it continues. To fix this we ensure we deassert the IRQ for a CQ when it is deleted. Signed-off-by: Logan Gunthorpe Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 84062d388f..1687a8e151 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -554,6 +554,7 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd) trace_nvme_err_invalid_del_cq_notempty(qid); return NVME_INVALID_QUEUE_DEL; } + nvme_irq_deassert(n, cq); trace_nvme_del_cq(qid); nvme_free_cq(cq, n); return NVME_SUCCESS; --=20 2.19.1 From nobody Wed May 8 14:18:38 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542906560579716.9285782388649; Thu, 22 Nov 2018 09:09:20 -0800 (PST) Received: from localhost ([::1]:47885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsTf-00075f-7l for importer@patchew.org; Thu, 22 Nov 2018 12:09:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPsFf-0001z3-6L for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPsFd-0001D2-D8 for qemu-devel@nongnu.org; Thu, 22 Nov 2018 11:54:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34730) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPsFX-00010D-7q; Thu, 22 Nov 2018 11:54:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F9323154872; Thu, 22 Nov 2018 16:54:42 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10C1D5D760; Thu, 22 Nov 2018 16:54:40 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 22 Nov 2018 17:54:17 +0100 Message-Id: <20181122165417.23894-14-kwolf@redhat.com> In-Reply-To: <20181122165417.23894-1-kwolf@redhat.com> References: <20181122165417.23894-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 22 Nov 2018 16:54:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/13] iotests: Enhance 223 to cover multiple bitmap granularities 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, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Eric Blake Testing granularity at the same size as the cluster isn't quite as fun as what happens when it is larger or smaller. This enhancement also shows that qemu's nbd server can serve the same disk over multiple exports simultaneously. Signed-off-by: Eric Blake Tested-by: John Snow Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/223 | 43 +++++++++++++++++++++++++++++++------- tests/qemu-iotests/223.out | 32 +++++++++++++++++++++------- 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223 index 72419e0338..397b865d34 100755 --- a/tests/qemu-iotests/223 +++ b/tests/qemu-iotests/223 @@ -57,10 +57,11 @@ run_qemu() } =20 echo -echo "=3D=3D=3D Create partially sparse image, then add dirty bitmap =3D= =3D=3D" +echo "=3D=3D=3D Create partially sparse image, then add dirty bitmaps =3D= =3D=3D" echo =20 -_make_test_img 4M +# Two bitmaps, to contrast granularity issues +_make_test_img -o cluster_size=3D4k 4M $QEMU_IO -c 'w -P 0x11 1M 2M' "$TEST_IMG" | _filter_qemu_io run_qemu < >(_filter_nbd) @@ -103,6 +114,8 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add", "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return" _send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable", "arguments":{"node":"n", "name":"b"}}' "return" +_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable", + "arguments":{"node":"n", "name":"b2"}}' "return" _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"'"$TEST_DIR/nbd"'"}}}}' "return" @@ -110,26 +123,40 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-a= dd", "arguments":{"device":"n"}}' "return" _send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap", "arguments":{"name":"n", "bitmap":"b"}}' "return" +_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2"}}' "return" +_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap", + "arguments":{"name":"n2", "bitmap":"b2"}}' "return" =20 echo -echo "=3D=3D=3D Contrast normal status with dirty-bitmap status =3D=3D=3D" +echo "=3D=3D=3D Contrast normal status to large granularity dirty-bitmap = =3D=3D=3D" echo =20 QEMU_IO_OPTIONS=3D$QEMU_IO_OPTIONS_NO_FMT IMG=3D"driver=3Dnbd,export=3Dn,server.type=3Dunix,server.path=3D$TEST_DIR/= nbd" -$QEMU_IO -r -c 'r -P 0 0 1m' -c 'r -P 0x11 1m 1m' \ - -c 'r -P 0x22 2m 2m' --image-opts "$IMG" | _filter_qemu_io +$QEMU_IO -r -c 'r -P 0x22 512 512' -c 'r -P 0 512k 512k' -c 'r -P 0x11 1m = 1m' \ + -c 'r -P 0x33 2m 2m' --image-opts "$IMG" | _filter_qemu_io $QEMU_IMG map --output=3Djson --image-opts \ "$IMG" | _filter_qemu_img_map $QEMU_IMG map --output=3Djson --image-opts \ "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:b" | _filter_qemu_img_map =20 +echo +echo "=3D=3D=3D Contrast to small granularity dirty-bitmap =3D=3D=3D" +echo + +IMG=3D"driver=3Dnbd,export=3Dn2,server.type=3Dunix,server.path=3D$TEST_DIR= /nbd" +$QEMU_IMG map --output=3Djson --image-opts \ + "$IMG,x-dirty-bitmap=3Dqemu:dirty-bitmap:b2" | _filter_qemu_img_map + echo echo "=3D=3D=3D End NBD server =3D=3D=3D" echo =20 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove", "arguments":{"name":"n"}}' "return" +_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}}' "return" _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "return" _send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return" =20 diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out index 33021c8e6a..de417477de 100644 --- a/tests/qemu-iotests/223.out +++ b/tests/qemu-iotests/223.out @@ -1,6 +1,6 @@ QA output created by 223 =20 -=3D=3D=3D Create partially sparse image, then add dirty bitmap =3D=3D=3D +=3D=3D=3D Create partially sparse image, then add dirty bitmaps =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4194304 wrote 2097152/2097152 bytes at offset 1048576 @@ -11,15 +11,18 @@ QMP_VERSION {"return": {}} {"return": {}} {"return": {}} +{"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} =20 =20 =3D=3D=3D Write part of the file under active bitmap =3D=3D=3D =20 +wrote 512/512 bytes at offset 512 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 2097152/2097152 bytes at offset 2097152 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 -=3D=3D=3D End dirty bitmap, and start serving image over NBD =3D=3D=3D +=3D=3D=3D End dirty bitmaps, and start serving image over NBD =3D=3D=3D =20 {"return": {}} {"return": {}} @@ -27,18 +30,32 @@ wrote 2097152/2097152 bytes at offset 2097152 {"return": {}} {"return": {}} {"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} =20 -=3D=3D=3D Contrast normal status with dirty-bitmap status =3D=3D=3D +=3D=3D=3D Contrast normal status to large granularity dirty-bitmap =3D=3D= =3D =20 -read 1048576/1048576 bytes at offset 0 -1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 512 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 2097152/2097152 bytes at offset 2097152 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false}, +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true}, +{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": fals= e}, { "start": 1048576, "length": 3145728, "depth": 0, "zero": false, "data": = true}] -[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true}, +[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false}, +{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": tr= ue}, +{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": = false}] + +=3D=3D=3D Contrast to small granularity dirty-bitmap =3D=3D=3D + +[{ "start": 0, "length": 512, "depth": 0, "zero": false, "data": true}, +{ "start": 512, "length": 512, "depth": 0, "zero": false, "data": false}, +{ "start": 1024, "length": 2096128, "depth": 0, "zero": false, "data": tru= e}, { "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": = false}] =20 =3D=3D=3D End NBD server =3D=3D=3D @@ -46,4 +63,5 @@ read 2097152/2097152 bytes at offset 2097152 {"return": {}} {"return": {}} {"return": {}} +{"return": {}} *** done --=20 2.19.1