From nobody Thu Apr 25 09:03:05 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=1557951455; cv=none; d=zoho.com; s=zohoarc; b=Nqmf8VGlw9r/VVpvXPSqRJBl3hEV49FOiJsb6xycwRm4B2eiLi0beO5W3S+ZCT1six9AcXVsKTEOncY41ehmSQ853eu5oUbtKiOo5bL2/FEhML+QLh8/kB86KTn4aG+VPYXk2XITFgbmD0s3JmzFTeJTTXuGbj3p9o8h4bPuaLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557951455; 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=hrXTHd7cnaBrT84f1glHBjU42laoP/5oQ9zKiqcc4CY=; b=oI2tVevSgDWZ/UKf9ETr/xM5I/SWwns1ImqngSW9kFF5SultXN2fEkwvVv+xb+0FTbJsDRbEyg7S39ByWHBTz83JtzIW098RK+UZ+whJsCcKyKmNNXgQSGdVfcsAjR5RQozbBO2BS/RgG7drF1P5QJw/uS5i9UkiWVOYCAmMB10= 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 1557951455644783.6262618159888; Wed, 15 May 2019 13:17:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:41906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0L8-0006ql-DA for importer@patchew.org; Wed, 15 May 2019 16:17:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0JF-0005tg-75 for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hR0J7-0007fn-Lq for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2677) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR0Iv-0007Zq-Og; Wed, 15 May 2019 16:15:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 329DA7FDCD; Wed, 15 May 2019 20:15:08 +0000 (UTC) Received: from localhost (unknown [10.40.205.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAAA51972A; Wed, 15 May 2019 20:15:07 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 15 May 2019 22:15:00 +0200 Message-Id: <20190515201503.19069-2-mreitz@redhat.com> In-Reply-To: <20190515201503.19069-1-mreitz@redhat.com> References: <20190515201503.19069-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 15 May 2019 20:15:08 +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 1/4] block: Improve "Block node is read-only" message 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 , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This message does not make any sense when it appears as the response to making an R/W node read-only. We should detect that case and emit a different message, then. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- block.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 16ef5edfd8..af662d5f17 100644 --- a/block.c +++ b/block.c @@ -1689,6 +1689,8 @@ static int bdrv_child_check_perm(BdrvChild *c, BlockR= eopenQueue *q, GSList *ignore_children, Error **errp); static void bdrv_child_abort_perm_update(BdrvChild *c); static void bdrv_child_set_perm(BdrvChild *c, uint64_t perm, uint64_t shar= ed); +static void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm, + uint64_t *shared_perm); =20 typedef struct BlockReopenQueueEntry { bool prepared; @@ -1775,7 +1777,20 @@ static int bdrv_check_perm(BlockDriverState *bs, Blo= ckReopenQueue *q, if ((cumulative_perms & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED)) && !bdrv_is_writable_after_reopen(bs, q)) { - error_setg(errp, "Block node is read-only"); + if (!bdrv_is_writable_after_reopen(bs, NULL)) { + error_setg(errp, "Block node is read-only"); + } else { + uint64_t current_perms, current_shared; + bdrv_get_cumulative_perm(bs, ¤t_perms, ¤t_shared); + if (current_perms & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED= )) { + error_setg(errp, "Cannot make block node read-only, there = is " + "a writer on it"); + } else { + error_setg(errp, "Cannot make block node read-only and cre= ate " + "a writer on it"); + } + } + return -EPERM; } =20 --=20 2.21.0 From nobody Thu Apr 25 09:03:05 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=1557951588; cv=none; d=zoho.com; s=zohoarc; b=Ipb5luciXqFVRTI0J6O1y1YfANX5HBm3bzmc80x9iJPuHh/3SMFYSf4t6rpcs2uEQqntTUlM+Ax6GxgFLxHg+o/pOsZo7pZsIX8o7wrlaoFzlqhJdACWZdnqRxEQ6IcEa2qh3WSW6p8Axh6QFWDRtJvjX7f/fr+ToMxh9oDUvXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557951588; 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=7EE5AcvKVG1piUl6wpSsRzJvDCAFN726UCz1s+BLdas=; b=ZhH+N0L1biJ2RfQlBPlen7lu6InAM1vYk9VAG9G215ectHXhwz35sGcUGqYsQaSNWUFhpdJycttATe4IrzXUruAPJ+K2FtW0wHadzUwEsoX7fGez/FXgCsTt1utYY0Yqw8XDKBS+96i0fYcS52Mm0aMETmTafQ8CjTegQGne+tY= 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 1557951588576901.9345872693681; Wed, 15 May 2019 13:19:48 -0700 (PDT) Received: from localhost ([127.0.0.1]:41928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0NN-0000e5-JJ for importer@patchew.org; Wed, 15 May 2019 16:19:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0JF-0005ti-A9 for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hR0JC-0007lG-HJ for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40311) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR0J0-0007aV-Bh; Wed, 15 May 2019 16:15:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF4DF3071524; Wed, 15 May 2019 20:15:10 +0000 (UTC) Received: from localhost (unknown [10.40.205.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4876010013D9; Wed, 15 May 2019 20:15:10 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 15 May 2019 22:15:01 +0200 Message-Id: <20190515201503.19069-3-mreitz@redhat.com> In-Reply-To: <20190515201503.19069-1-mreitz@redhat.com> References: <20190515201503.19069-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 15 May 2019 20:15:10 +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 2/4] iotests.py: Let assert_qmp() accept an array 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 , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Sometimes we cannot tell which error message qemu will emit, and we do not care. With this change, we can then just pass an array of all possible messages to assert_qmp() and it will choose the right one. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- tests/qemu-iotests/iotests.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f811f69135..d96ba1f63c 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -596,9 +596,23 @@ class QMPTestCase(unittest.TestCase): self.fail('path "%s" has value "%s"' % (path, str(result))) =20 def assert_qmp(self, d, path, value): - '''Assert that the value for a specific path in a QMP dict matches= ''' + '''Assert that the value for a specific path in a QMP dict + matches. When given a list of values, assert that any of + them matches.''' + result =3D self.dictpath(d, path) - self.assertEqual(result, value, 'values not equal "%s" and "%s"' %= (str(result), str(value))) + + # [] makes no sense as a list of valid values, so treat it as + # an actual single value. + if isinstance(value, list) and value !=3D []: + for v in value: + if result =3D=3D v: + return + self.fail('no match for "%s" in %s' % (str(result), str(value)= )) + else: + self.assertEqual(result, value, + 'values not equal "%s" and "%s"' + % (str(result), str(value))) =20 def assert_no_active_block_jobs(self): result =3D self.vm.qmp('query-block-jobs') --=20 2.21.0 From nobody Thu Apr 25 09:03:05 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=1557951603; cv=none; d=zoho.com; s=zohoarc; b=k9MUehuLW6n0Z/ocXGSpRxrzMpkmCKmzZFKzYU+UXY/0nBHYXVuvQjA6udXXPYQ060/4AsovaLoFUhy/cp/z0zlpDJRsHCQaZ8ZjZGKxaEQv05XoxbvG/Wovx7Rq0sm3O2eu/Ma9LdWrlAOgyIOLgS507T0xmQw/K38xwt1+gzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557951603; 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=QuZ95ppieiGQKDuKfFEoTNUmEA/Y4yIioTiIOGCsJ4g=; b=n3VADGqR4pjiPXvi9zOqEnHjfF5z2BRMqWFBzhm2jU72ob7UoDSA7wPl853TXp2kbHVk3zbs0jIlUEQLD8A0j2MArOF05gXKZUngDQPNphDgAw6xcoA/vML6N+xNITW/T22HuI0R+bFLfgbt87kyYkUN58sA26yM5G1LJDNznvw= 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 1557951603455722.831811705231; Wed, 15 May 2019 13:20:03 -0700 (PDT) Received: from localhost ([127.0.0.1]:41930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0Na-0000kN-Dl for importer@patchew.org; Wed, 15 May 2019 16:19:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0JH-0005ua-JH for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hR0JG-0007qJ-K8 for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR0J2-0007bO-0g; Wed, 15 May 2019 16:15:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F16331760ED; Wed, 15 May 2019 20:15:13 +0000 (UTC) Received: from localhost (unknown [10.40.205.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99D351972A; Wed, 15 May 2019 20:15:12 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 15 May 2019 22:15:02 +0200 Message-Id: <20190515201503.19069-4-mreitz@redhat.com> In-Reply-To: <20190515201503.19069-1-mreitz@redhat.com> References: <20190515201503.19069-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 15 May 2019 20:15: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 3/4] iotests.py: Fix VM.run_job 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 , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" log() is in the current module, there is no need to prefix it. In fact, doing so may make VM.run_job() unusable in tests that never use iotests.log() themselves. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- tests/qemu-iotests/iotests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index d96ba1f63c..7bde380d96 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -552,7 +552,7 @@ class VM(qtest.QEMUQtestMachine): elif status =3D=3D 'null': return error else: - iotests.log(ev) + log(ev) =20 def node_info(self, node_name): nodes =3D self.qmp('query-named-block-nodes') --=20 2.21.0 From nobody Thu Apr 25 09:03:05 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=1557951728; cv=none; d=zoho.com; s=zohoarc; b=QqegMbQkyD8i3doeivZUtZMYNy7tYjCz7utnJk2cBnuEgXRPgTxerk3NjPNCXUUX9RUjrRjgT086hRLFnvrN+13yUGRpkLBofrRjQ3wILiahzRUoW0l7kcX42Q9KJlAamyFO9g6dmvVOYHdxp3At/4pghDugRGDffj7ZAuZ0tBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557951728; 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=QZSf250vXyt7TCgsLbjzFe43qQy9hcjPHcGyTEn1qxY=; b=UtKbERjn2foIvgE3xdxsuJcPa6+zmjA7IDKQk/Z67WSBFdql9WuKIF0sX50I7lCPc1HbrGWxEi9vBQ5zj410/6VU+h1QcIk8exmk7fUoD6jdK/xIDiAhxuqvIJKH8bANQToi8BWS0blmCvVwAMQX2dDbSEYwPslyw/mTxQBmrCc= 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 1557951728177130.52676464321678; Wed, 15 May 2019 13:22:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:41982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0Pb-0002eN-SH for importer@patchew.org; Wed, 15 May 2019 16:22:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0JK-0005wX-GR for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hR0JJ-0007xB-2M for qemu-devel@nongnu.org; Wed, 15 May 2019 16:15:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52310) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR0JF-0007c1-Cp; Wed, 15 May 2019 16:15:29 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C31373002738; Wed, 15 May 2019 20:15:15 +0000 (UTC) Received: from localhost (unknown [10.40.205.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 585311001959; Wed, 15 May 2019 20:15:15 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 15 May 2019 22:15:03 +0200 Message-Id: <20190515201503.19069-5-mreitz@redhat.com> In-Reply-To: <20190515201503.19069-1-mreitz@redhat.com> References: <20190515201503.19069-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 15 May 2019 20:15: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 4/4] iotests: Make 245 faster and more reliable 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 , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Sometimes, 245 fails for me because some stream job has already finished while the test expects it to still be active. (With -c none, it fails basically every time.) The most reliable way to fix this is to simply set auto_finalize=3Dfalse so the job will remain in the block graph as long as we need it. This allows us to drop the rate limiting, too, which makes the test faster. The only problem with this is that there is a single place that yields a different error message depending on whether the stream job is still copying data (so COR is enabled) or not (COR has been disabled, but the job still has the WRITE_UNCHANGED permission on the target node). We can easily address that by expecting either error message. Note that we do not need auto_finalize=3Dfalse (or rate limiting) for the active commit job, because It never completes without an explicit block-job-complete anyway. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- tests/qemu-iotests/245 | 22 ++++++++++++++-------- tests/qemu-iotests/245.out | 12 ++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index a04c6235c1..349b94aace 100644 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -862,7 +862,8 @@ class TestBlockdevReopen(iotests.QMPTestCase): =20 # hd2 <- hd0 result =3D self.vm.qmp('block-stream', conv_keys =3D True, job_id = =3D 'stream0', - device =3D 'hd0', base_node =3D 'hd2', speed = =3D 512 * 1024) + device =3D 'hd0', base_node =3D 'hd2', + auto_finalize =3D False) self.assert_qmp(result, 'return', {}) =20 # We can't remove hd2 while the stream job is ongoing @@ -873,7 +874,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts['backing'] =3D None self.reopen(opts, {}, "Cannot change 'backing' link from 'hd0' to = 'hd1'") =20 - self.wait_until_completed(drive =3D 'stream0') + self.vm.run_job('stream0', auto_finalize =3D False, auto_dismiss = =3D True) =20 # Reopen the chain during a block-stream job (from hd2 to hd1) def test_block_stream_4(self): @@ -886,12 +887,16 @@ class TestBlockdevReopen(iotests.QMPTestCase): =20 # hd1 <- hd0 result =3D self.vm.qmp('block-stream', conv_keys =3D True, job_id = =3D 'stream0', - device =3D 'hd1', speed =3D 512 * 1024) + device =3D 'hd1', auto_finalize =3D False) self.assert_qmp(result, 'return', {}) =20 # We can't reopen with the original options because that would # make hd1 read-only and block-stream requires it to be read-write - self.reopen(opts, {}, "Can't set node 'hd1' to r/o with copy-on-re= ad enabled") + # (Which error message appears depends on whether the stream job is + # already done with copying at this point.) + self.reopen(opts, {}, + ["Can't set node 'hd1' to r/o with copy-on-read enabled", + "Cannot make block node read-only, there is a writer on it"]) =20 # We can't remove hd2 while the stream job is ongoing opts['backing']['backing'] =3D None @@ -901,7 +906,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts['backing'] =3D None self.reopen(opts) =20 - self.wait_until_completed(drive =3D 'stream0') + self.vm.run_job('stream0', auto_finalize =3D False, auto_dismiss = =3D True) =20 # Reopen the chain during a block-commit job (from hd0 to hd2) def test_block_commit_1(self): @@ -913,7 +918,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('block-commit', conv_keys =3D True, job_id = =3D 'commit0', - device =3D 'hd0', speed =3D 1024 * 1024) + device =3D 'hd0') self.assert_qmp(result, 'return', {}) =20 # We can't remove hd2 while the commit job is ongoing @@ -944,7 +949,8 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('block-commit', conv_keys =3D True, job_id = =3D 'commit0', - device =3D 'hd0', top_node =3D 'hd1', speed = =3D 1024 * 1024) + device =3D 'hd0', top_node =3D 'hd1', + auto_finalize =3D False) self.assert_qmp(result, 'return', {}) =20 # We can't remove hd2 while the commit job is ongoing @@ -956,7 +962,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts, {}, "Cannot change backing link if 'hd0' has an = implicit backing file") =20 # hd2 <- hd0 - self.wait_until_completed(drive =3D 'commit0') + self.vm.run_job('commit0', auto_finalize =3D False, auto_dismiss = =3D True) =20 self.assert_qmp(self.get_node('hd0'), 'ro', False) self.assertEqual(self.get_node('hd1'), None) diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out index 71009c239f..a19de5214d 100644 --- a/tests/qemu-iotests/245.out +++ b/tests/qemu-iotests/245.out @@ -3,3 +3,15 @@ Ran 18 tests =20 OK +{"execute": "job-finalize", "arguments": {"id": "commit0"}} +{"return": {}} +{"data": {"id": "commit0", "type": "commit"}, "event": "BLOCK_JOB_PENDING"= , "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "commit0", "len": 3145728, "offset": 3145728, "speed":= 0, "type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micro= seconds": "USECS", "seconds": "SECS"}} +{"execute": "job-finalize", "arguments": {"id": "stream0"}} +{"return": {}} +{"data": {"id": "stream0", "type": "stream"}, "event": "BLOCK_JOB_PENDING"= , "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "stream0", "len": 3145728, "offset": 3145728, "speed":= 0, "type": "stream"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micro= seconds": "USECS", "seconds": "SECS"}} +{"execute": "job-finalize", "arguments": {"id": "stream0"}} +{"return": {}} +{"data": {"id": "stream0", "type": "stream"}, "event": "BLOCK_JOB_PENDING"= , "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "stream0", "len": 3145728, "offset": 3145728, "speed":= 0, "type": "stream"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micro= seconds": "USECS", "seconds": "SECS"}} --=20 2.21.0