From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224772; cv=none; d=zohomail.com; s=zohoarc; b=HRGcQDvRyUkvhsZYuTOdG6xzgK+jVTNQjOWeo+2I0P0mxRc7lAM+6D9GSZPeLy2wGZFK7mtB9/1w1CKFiqxB1CynyZx9+3MZJTmdU7vD7Fza3HB1Xtu5mDqBk/pQ/vi3ugksrwxOrkYct9dPHlXuSEKmiRZuAmAeX+KfHdoZ2cQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224772; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OAVtoVSpnW5Wvlas0E9i9zwJ+HL17YG1l57fv8jrf5Y=; b=jVXGp+6wjpSUt47xyWwU6wSvVuAae2xSBHezbz8ml+7Aci6j+IBg/H7H1VqMaPLucNY/0xt1gtFHZrGZSLtCyCqT/bL5YzGcg9gJDboVeM0m0a9v1CWhEZPmACw2LVnUinlGgtiAJjbp1UYDYgGNOrS9OulpAc+HhPwFdjkRGVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224772544214.4780288585789; Fri, 13 Oct 2023 12:19:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYG-0006sF-JX; Fri, 13 Oct 2023 15:10:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXy-0006ae-72 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXr-0001cG-Ek for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:02 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-14-BGnS8LPcOJu4EmIAQpmnUQ-1; Fri, 13 Oct 2023 15:09:45 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5AD685A5A8; Fri, 13 Oct 2023 19:09:44 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C8A640C6CA3; Fri, 13 Oct 2023 19:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OAVtoVSpnW5Wvlas0E9i9zwJ+HL17YG1l57fv8jrf5Y=; b=Z5BFru4s8iBTQajc9L7c4SbYCDUmqWOBsisJT1R4pzlrNKeJpwDPPI9TXYPyPbKu6YKzLA qmGr0BPVvkpjt/VIFSSExBi0f8G0bTaPMc4nV01n3DYsIwSxJtELnUxdNMlvnd4prF8M9f 8vttP2TAZCzdyBY+VE8hl5f/lVT+/3I= X-MC-Unique: BGnS8LPcOJu4EmIAQpmnUQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 01/25] python/machine: move socket setup out of _base_args property Date: Fri, 13 Oct 2023 15:09:16 -0400 Message-ID: <20231013190941.3699288-2-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224773687100007 This property isn't meant to do much else besides return a list of strings, so move this setup back out into _pre_launch(). Signed-off-by: John Snow Reviewed-by: Ani Sinha Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230928044943.849073-2-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/machine.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 35d5a672db..345610d6e4 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -301,9 +301,7 @@ def _base_args(self) -> List[str]: =20 if self._qmp_set: if self._sock_pair: - fd =3D self._sock_pair[0].fileno() - os.set_inheritable(fd, True) - moncdev =3D f"socket,id=3Dmon,fd=3D{fd}" + moncdev =3D f"socket,id=3Dmon,fd=3D{self._sock_pair[0].fil= eno()}" elif isinstance(self._monitor_address, tuple): moncdev =3D "socket,id=3Dmon,host=3D{},port=3D{}".format( *self._monitor_address @@ -340,6 +338,7 @@ def _pre_launch(self) -> None: if self._qmp_set: if self._monitor_address is None: self._sock_pair =3D socket.socketpair() + os.set_inheritable(self._sock_pair[0].fileno(), True) sock =3D self._sock_pair[1] if isinstance(self._monitor_address, str): self._remove_files.append(self._monitor_address) --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224296; cv=none; d=zohomail.com; s=zohoarc; b=RJoN6dUYVE4irl5fuNDVY6E21TuhS6QV1cSbQmfdsYpxXOvzUnZs0O48Ix9gAESKmDEr5DHcz78TdM0y47/Ybhs2s01JSOGKfA5LT/eNhgZW+ciwyAM0rhanBTyEXiDWRS/cYRn/t0OFxEneuZQUYtZ3dyHjyuzN7IDOgXQgMes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224296; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Sz519R7DOSzxGsZ6pnZE5PJ0mp6TylEz4erYoFJyd2U=; b=HewgBx+s4a9TRjacdlcqfo8W75c/D5faRBDCBgcJT5MOY9864JhXB7QUBSANnOPjPfb1E4sRSEWYG5/a2ZppvGfTljV9slpdJF5/a+AHbZ9uC6Ln5eGAfWFyipttvCpOxq/4TpomKrtY6dyi9G2rL7WSTnHB34d9m2sIwnpVOzc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224296638264.0462964517999; Fri, 13 Oct 2023 12:11:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNY6-0006e0-V2; Fri, 13 Oct 2023 15:10:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXr-0006Xb-5M for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXo-0001bB-LU for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:09:58 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-34-sknuVkFTPi-8HIxaNLuW-w-1; Fri, 13 Oct 2023 15:09:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECD3D800B23; Fri, 13 Oct 2023 19:09:45 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3D6340C6CA0; Fri, 13 Oct 2023 19:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sz519R7DOSzxGsZ6pnZE5PJ0mp6TylEz4erYoFJyd2U=; b=EL8eesu0y20W3w4AHuG+GW6LUsOiIAf3KUw4KSfpDZdsFcmG4MFJbMIKWbnybJONN9ccJr SPsaGYef7KCeuNCLk9kSZh64ruvWlrxnEG/MeMuNcTQ/fxAgCRc6XpEp2fsvDjpPAL7pR1 C1siBOxqx1wBRMXlKxxkrem5ld9NeL0= X-MC-Unique: sknuVkFTPi-8HIxaNLuW-w-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 02/25] python/machine: close sock_pair in cleanup path Date: Fri, 13 Oct 2023 15:09:17 -0400 Message-ID: <20231013190941.3699288-3-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224297700100003 If everything has gone smoothly, we'll already have closed the socket we gave to the child during post_launch. The other half of the pair that we gave to the QMP connection should, likewise, be definitively closed by now. However, in the cleanup path, it's possible we've created the socketpair but flubbed the launch and need to clean up resources. These resources *would* be handled by the garbage collector, but that can happen at unpredictable times. Nicer to just clean them up synchronously on the exit path, here. Signed-off-by: John Snow Reviewed-by: Ani Sinha Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230928044943.849073-3-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/machine.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 345610d6e4..e26109e6f0 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -396,6 +396,11 @@ def _post_shutdown(self) -> None: finally: assert self._qmp_connection is None =20 + if self._sock_pair: + self._sock_pair[0].close() + self._sock_pair[1].close() + self._sock_pair =3D None + self._close_qemu_log_file() =20 self._load_io_log() --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224345; cv=none; d=zohomail.com; s=zohoarc; b=dx7jXR309eM8GgNUphYJX5rHsa4ek99kbKmYzchd9ZXHw7bEW1/vilegUEcCxuG+XDdrTO5yqBwzZHn0/fqqC0Y9kkFjyYJGoRMXXP1rFpPNjbe6CPLCa+e2dKbcQmtlWoS95MydGMYaJCwXVeJJsW8ie/3tCByaW4DPPGABQUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224345; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PbwImhP6iyusgvGhiC7g0PBcTytQaaVCsTqxMoRHC2A=; b=K1gBrswU8cHUAzBKzEwbOCG2QkMPehllhO1axxyYdFJgPq5ktzm9lRR+SAMdqiyZn3nSuOZ0gZtdBjiszLvv+CVfQg/a/6jY2cEuL/TJFS+u+Pi4X75f1g/mU1zxL7TYhQQdbn/xt54j13sdcmlbCcOYI8qX4fvbXj2aWQWMT+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224345711334.29042057789434; Fri, 13 Oct 2023 12:12:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNXq-0006XA-Sn; Fri, 13 Oct 2023 15:09:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXn-0006Ul-5a for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:09:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXk-0001a8-Ps for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:09:54 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-253-g8qbn04cMNeONAs9Thz74A-1; Fri, 13 Oct 2023 15:09:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F18F85A5BF; Fri, 13 Oct 2023 19:09:47 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07F9F40C6F79; Fri, 13 Oct 2023 19:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PbwImhP6iyusgvGhiC7g0PBcTytQaaVCsTqxMoRHC2A=; b=ZPWKGFEK2+NJfFCDsarQNeX5zGl7w2Rg0DKtvFZw7/o/lpUwqttrhop7/yFjh276sR+EwQ UmJnMD5B/YAnQC5KZ5EOKAdaPB9TtUrTjvuCgz68Q6zmj27JqvQ37VGIqTKZLW8MWypxsz 0Pfjy1NOvZr6bmXqLmC6RMRgWKbVG2A= X-MC-Unique: g8qbn04cMNeONAs9Thz74A-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 03/25] python/console_socket: accept existing FD in initializer Date: Fri, 13 Oct 2023 15:09:18 -0400 Message-ID: <20231013190941.3699288-4-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224347889100001 Useful if we want to use ConsoleSocket() for a socket created by socketpair(). Signed-off-by: John Snow Reviewed-by: Ani Sinha Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230928044943.849073-4-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/console_socket.py | 29 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/python/qemu/machine/console_socket.py b/python/qemu/machine/co= nsole_socket.py index 4e28ba9bb2..0a4e09ffc7 100644 --- a/python/qemu/machine/console_socket.py +++ b/python/qemu/machine/console_socket.py @@ -24,19 +24,32 @@ class ConsoleSocket(socket.socket): """ ConsoleSocket represents a socket attached to a char device. =20 - Optionally (if drain=3D=3DTrue), drains the socket and places the bytes - into an in memory buffer for later processing. - - Optionally a file path can be passed in and we will also - dump the characters to this file for debugging purposes. + :param address: An AF_UNIX path or address. + :param sock_fd: Optionally, an existing socket file descriptor. + One of address or sock_fd must be specified. + :param file: Optionally, a filename to log to. + :param drain: Optionally, drains the socket and places the bytes + into an in memory buffer for later processing. """ - def __init__(self, address: str, file: Optional[str] =3D None, + def __init__(self, + address: Optional[str] =3D None, + sock_fd: Optional[int] =3D None, + file: Optional[str] =3D None, drain: bool =3D False): + if address is None and sock_fd is None: + raise ValueError("one of 'address' or 'sock_fd' must be specif= ied") + if address is not None and sock_fd is not None: + raise ValueError("can't specify both 'address' and 'sock_fd'") + self._recv_timeout_sec =3D 300.0 self._sleep_time =3D 0.5 self._buffer: Deque[int] =3D deque() - socket.socket.__init__(self, socket.AF_UNIX, socket.SOCK_STREAM) - self.connect(address) + if address is not None: + socket.socket.__init__(self, socket.AF_UNIX, socket.SOCK_STREA= M) + self.connect(address) + else: + assert sock_fd is not None + socket.socket.__init__(self, fileno=3Dsock_fd) self._logfile =3D None if file: # pylint: disable=3Dconsider-using-with --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224254; cv=none; d=zohomail.com; s=zohoarc; b=Y/ZEkp8am3tytlmLSQM0M1hXZR6ViEG5Cz1Bml6QpjvQ5nB+PeFWEY0MxtPpaL8WjRgqamj/DlEw/SBuWIibIO/ney1OHG3gh0qb+FQFt22cDEZl3mVLoTCIWVRi8hXcVzpieLE9JyZi2kqbZ2D+FRZxjQoP8XGBN4QuADWoLOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224254; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CY2ZzbNsrWHODBZH2uuGMmWYkeDgboyCelntd6RYtQ8=; b=VHRD1HhhCzbUvAOfdenfHeUB/z8MYp/0D30tKhzKhI4OpDW7XMwPQ05ViqxNRmwcM2dpb3z628sal698Lu8oE59k/Zrg8r+948LpK9HN2SkCmrgDFzUuu3REwX3U4dtsAwaf1R66zBE2oKcA1bNiyUqL1H412Wv6Zqs1V3Y+0NA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224254479245.61261918170112; Fri, 13 Oct 2023 12:10:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNY1-0006Zx-5Y; Fri, 13 Oct 2023 15:10:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXp-0006WR-T4 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:09:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXm-0001ar-Ve for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:09:57 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173-IxGOvmAON-GYZM5AE8Y25A-1; Fri, 13 Oct 2023 15:09:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 896CD1C00D1A; Fri, 13 Oct 2023 19:09:48 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D53340C6CA2; Fri, 13 Oct 2023 19:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CY2ZzbNsrWHODBZH2uuGMmWYkeDgboyCelntd6RYtQ8=; b=aPu1dfejCh9jRDVj48ImGAOMuMI8wd1Dk2cU/qyphzVK7qyfEx+2ivWAuMNcddJ0HEZj0C VJnVrSqwcVLzP6+YIvHROUoTKr67yAj8A+LhaJ5+d931Q/gAgvhBqtu8qI1YvAlpWFkYLY deaF67gEzhnbJV5uRf8hEePd8zbJFLg= X-MC-Unique: IxGOvmAON-GYZM5AE8Y25A-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 04/25] python/machine: use socketpair() for console connections Date: Fri, 13 Oct 2023 15:09:19 -0400 Message-ID: <20231013190941.3699288-5-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224256579100001 Create a socketpair for the console output. This should help eliminate race conditions around console text early in the boot process that might otherwise have been dropped on the floor before being able to connect to QEMU under "server,nowait". Signed-off-by: John Snow Reviewed-by: Ani Sinha Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230928044943.849073-5-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/machine.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index e26109e6f0..4156b8cf7d 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -159,6 +159,8 @@ def __init__(self, =20 self._name =3D name or f"{id(self):x}" self._sock_pair: Optional[Tuple[socket.socket, socket.socket]] =3D= None + self._cons_sock_pair: Optional[ + Tuple[socket.socket, socket.socket]] =3D None self._temp_dir: Optional[str] =3D None self._base_temp_dir =3D base_temp_dir self._sock_dir =3D sock_dir @@ -316,8 +318,9 @@ def _base_args(self) -> List[str]: for _ in range(self._console_index): args.extend(['-serial', 'null']) if self._console_set: - chardev =3D ('socket,id=3Dconsole,path=3D%s,server=3Don,wait= =3Doff' % - self._console_address) + assert self._cons_sock_pair is not None + fd =3D self._cons_sock_pair[0].fileno() + chardev =3D f"socket,id=3Dconsole,fd=3D{fd}" args.extend(['-chardev', chardev]) if self._console_device_type is None: args.extend(['-serial', 'chardev:console']) @@ -352,6 +355,10 @@ def _pre_launch(self) -> None: nickname=3Dself._name ) =20 + if self._console_set: + self._cons_sock_pair =3D socket.socketpair() + os.set_inheritable(self._cons_sock_pair[0].fileno(), True) + # NOTE: Make sure any opened resources are *definitely* freed in # _post_shutdown()! # pylint: disable=3Dconsider-using-with @@ -369,6 +376,9 @@ def _pre_launch(self) -> None: def _post_launch(self) -> None: if self._sock_pair: self._sock_pair[0].close() + if self._cons_sock_pair: + self._cons_sock_pair[0].close() + if self._qmp_connection: if self._sock_pair: self._qmp.connect() @@ -524,6 +534,11 @@ def _early_cleanup(self) -> None: self._console_socket.close() self._console_socket =3D None =20 + if self._cons_sock_pair: + self._cons_sock_pair[0].close() + self._cons_sock_pair[1].close() + self._cons_sock_pair =3D None + def _hard_shutdown(self) -> None: """ Perform early cleanup, kill the VM, and wait for it to terminate. @@ -885,10 +900,19 @@ def console_socket(self) -> socket.socket: """ if self._console_socket is None: LOG.debug("Opening console socket") + if not self._console_set: + raise QEMUMachineError( + "Attempt to access console socket with no connection") + assert self._cons_sock_pair is not None + # os.dup() is used here for sock_fd because otherwise we'd + # have two rich python socket objects that would each try to + # close the same underlying fd when either one gets garbage + # collected. self._console_socket =3D console_socket.ConsoleSocket( - self._console_address, + sock_fd=3Dos.dup(self._cons_sock_pair[1].fileno()), file=3Dself._console_log_path, drain=3Dself._drain_console) + self._cons_sock_pair[1].close() return self._console_socket =20 @property --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224620; cv=none; d=zohomail.com; s=zohoarc; b=HOP3W1oqbYeKs5lOq9B9LoxfRcXOHfw2dFWGmM6r4GKUUBHy8klQqjXa1RZULj1dw6n+R6j7tAG9JoMqAiZ0N4OcOArVXue2G8873dBTBhe11uuupk63IPM2lqvVoP996qXrsavR5d7hZ5ZytzBcoKn5j+onDrMMVcrUabhIlIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224620; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5f0J1I00tgVSiN9VRb+ChusZ1yvCyLAj0W1V3gjAZJo=; b=jjMQ3thxpo7+0RLxMeRnYksWomlOvhKFlNGmmBnDJGkr5gLfSXPmcnhjcdYcPAlG03HyanYISBF7FlLxUXGe+BtF4xHk9sf79zzVncVwU6yVBKxeR02sRLRk9sT2h5dH0IQQiWqT9YiVJpyj/rTlzBsqGafrjKsOYzQg0pqp7MI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224620891193.0965028799169; Fri, 13 Oct 2023 12:17:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYQ-0007Bz-9C; Fri, 13 Oct 2023 15:10:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYG-0006sO-M1 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY5-0001tw-2J for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:24 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-eQiDZcfFPaugXpx9nL3Kew-1; Fri, 13 Oct 2023 15:09:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5E0B85A5BA; Fri, 13 Oct 2023 19:09:49 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9876440C6CA0; Fri, 13 Oct 2023 19:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5f0J1I00tgVSiN9VRb+ChusZ1yvCyLAj0W1V3gjAZJo=; b=XBW1oIw/2HXma+japKO+EEU1KAPU/lCtx+JW4yHdB+dz9aDC6o9zdG2akMGdY9Kil0DECG BYE4xD7tv3qohGhIEM8VoAdmfcaKrxQghTzWRVGlFWFV9qB886MnnKqJR6YystdZsT2LU/ jQ7DnDrZDukh2qIcr1NvAHenxpPrio4= X-MC-Unique: eQiDZcfFPaugXpx9nL3Kew-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 05/25] python/machine: use socketpair() for qtest connection Date: Fri, 13 Oct 2023 15:09:20 -0400 Message-ID: <20231013190941.3699288-6-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224623119100011 Like the QMP and console sockets, begin using socketpairs for the qtest connection, too. After this patch, we'll be able to remove the vestigial sock_dir argument, but that cleanup is best done in its own patch. Signed-off-by: John Snow Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230928044943.849073-6-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/qtest.py | 49 +++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py index 1c46138bd0..8180d3ab01 100644 --- a/python/qemu/machine/qtest.py +++ b/python/qemu/machine/qtest.py @@ -24,6 +24,7 @@ Optional, Sequence, TextIO, + Tuple, ) =20 from qemu.qmp import SocketAddrT @@ -38,23 +39,41 @@ class QEMUQtestProtocol: :param address: QEMU address, can be either a unix socket path (string) or a tuple in the form ( address, port ) for a TCP connection - :param server: server mode, listens on the socket (bool) + :param sock: An existing socket can be provided as an alternative to + an address. One of address or sock must be provided. + :param server: server mode, listens on the socket. Only meaningful + in conjunction with an address and not an existing + socket. + :raise socket.error: on socket connection errors =20 .. note:: No connection is established by __init__(), this is done by the connect() or accept() methods. """ - def __init__(self, address: SocketAddrT, + def __init__(self, + address: Optional[SocketAddrT] =3D None, + sock: Optional[socket.socket] =3D None, server: bool =3D False): + if address is None and sock is None: + raise ValueError("Either 'address' or 'sock' must be specified= ") + if address is not None and sock is not None: + raise ValueError( + "Either 'address' or 'sock' must be specified, but not bot= h") + if sock is not None and server: + raise ValueError("server=3DTrue is meaningless when passing so= cket") + self._address =3D address - self._sock =3D self._get_sock() + self._sock =3D sock or self._get_sock() self._sockfile: Optional[TextIO] =3D None + if server: + assert self._address is not None self._sock.bind(self._address) self._sock.listen(1) =20 def _get_sock(self) -> socket.socket: + assert self._address is not None if isinstance(self._address, tuple): family =3D socket.AF_INET else: @@ -67,7 +86,8 @@ def connect(self) -> None: =20 @raise socket.error on socket connection errors """ - self._sock.connect(self._address) + if self._address is not None: + self._sock.connect(self._address) self._sockfile =3D self._sock.makefile(mode=3D'r') =20 def accept(self) -> None: @@ -127,29 +147,40 @@ def __init__(self, base_temp_dir=3Dbase_temp_dir, sock_dir=3Dsock_dir, qmp_timer=3Dqmp_timer) self._qtest: Optional[QEMUQtestProtocol] =3D None - self._qtest_path =3D os.path.join(sock_dir, name + "-qtest.sock") + self._qtest_sock_pair: Optional[ + Tuple[socket.socket, socket.socket]] =3D None =20 @property def _base_args(self) -> List[str]: args =3D super()._base_args + assert self._qtest_sock_pair is not None + fd =3D self._qtest_sock_pair[0].fileno() args.extend([ - '-qtest', f"unix:path=3D{self._qtest_path}", + '-chardev', f"socket,id=3Dqtest,fd=3D{fd}", + '-qtest', 'chardev:qtest', '-accel', 'qtest' ]) return args =20 def _pre_launch(self) -> None: + self._qtest_sock_pair =3D socket.socketpair() + os.set_inheritable(self._qtest_sock_pair[0].fileno(), True) super()._pre_launch() - self._qtest =3D QEMUQtestProtocol(self._qtest_path, server=3DTrue) + self._qtest =3D QEMUQtestProtocol(sock=3Dself._qtest_sock_pair[1]) =20 def _post_launch(self) -> None: assert self._qtest is not None super()._post_launch() - self._qtest.accept() + if self._qtest_sock_pair: + self._qtest_sock_pair[0].close() + self._qtest.connect() =20 def _post_shutdown(self) -> None: + if self._qtest_sock_pair: + self._qtest_sock_pair[0].close() + self._qtest_sock_pair[1].close() + self._qtest_sock_pair =3D None super()._post_shutdown() - self._remove_if_exists(self._qtest_path) =20 def qtest(self, cmd: str) -> str: """ --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224488; cv=none; d=zohomail.com; s=zohoarc; b=mMio7qp9KngLJOhlnG1182rKhrwESXMn1Za6+ubBk+4YMpKoMMQozEk+RaHRQVeaS9zdOA5JnN6oAvV29ptvTeB29eQJoUqUjRzNNSv6Cy0y9ltFf3qOoKBpdq220m2KM6cE9QsVXebJT4uj4fWgjtA63OJ9qzF/2h0Qdp44F4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224488; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=t8sv+78KTJhHOiCUg6jfT+/hp9K/9RBZWBgneYLcY6g=; b=MuOhs70e6eH7yUUG7lcKx+KubmIxlhQONnny8xjKY+O+Vh64X+4LkjWSyFyuS6/rG7jcNPmMIxhXDJC7igzlwM7t/IwyDOVBWXLs1TyU8GDiWiDNHdmE5fpLqL7L5TCUhkwE9gu2fXL6D4TZ9Ionm9LxFcCwQB0PzKFzyOXHTIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224488307982.2615874715342; Fri, 13 Oct 2023 12:14:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYJ-0006vJ-9B; Fri, 13 Oct 2023 15:10:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY1-0006dN-TG for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXu-0001dY-QH for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:09 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-y0adCPpANvCk1EGO0FPNyQ-1; Fri, 13 Oct 2023 15:09:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3046D3C025BA; Fri, 13 Oct 2023 19:09:51 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8BBE40C6F79; Fri, 13 Oct 2023 19:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t8sv+78KTJhHOiCUg6jfT+/hp9K/9RBZWBgneYLcY6g=; b=aNjdGOwL86aSfeIaKCd87ib48eD7BmWMIfW9R5210Rcm273YnuQzrS9wrgQ63Hxgz+ndDi ZQcp5s9P/LOqKEroSv7LjgOMxYL3dYIbEqujYEsTNbzUZlW8Kn7xiKQbOdtLmY5QtohQVc R/DXXI/3IrNjxQuoUgOx0+TKRB1h1fw= X-MC-Unique: y0adCPpANvCk1EGO0FPNyQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 06/25] python/machine: remove unused sock_dir argument Date: Fri, 13 Oct 2023 15:09:21 -0400 Message-ID: <20231013190941.3699288-7-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224490508100003 By using a socketpair for all of the sockets managed by the VM class and its extensions, we don't need the sock_dir argument anymore, so remove it. We only added this argument so that we could specify a second, shorter temporary directory for cases where the temp/log dirs were "too long" as a socket name on macOS. We don't need it for this class now. In one case, avocado testing takes over responsibility for creating an appropriate sockdir. Signed-off-by: John Snow Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230928044943.849073-7-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/machine.py | 18 ------------------ python/qemu/machine/qtest.py | 5 +---- tests/avocado/acpi-bits.py | 5 +---- tests/avocado/avocado_qemu/__init__.py | 2 +- tests/avocado/machine_aspeed.py | 5 ++++- tests/qemu-iotests/iotests.py | 2 +- tests/qemu-iotests/tests/copy-before-write | 3 +-- 7 files changed, 9 insertions(+), 31 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 4156b8cf7d..d539e91268 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -127,7 +127,6 @@ def __init__(self, name: Optional[str] =3D None, base_temp_dir: str =3D "/var/tmp", monitor_address: Optional[SocketAddrT] =3D None, - sock_dir: Optional[str] =3D None, drain_console: bool =3D False, console_log: Optional[str] =3D None, log_dir: Optional[str] =3D None, @@ -141,7 +140,6 @@ def __init__(self, @param name: prefix for socket and log file names (default: qemu-P= ID) @param base_temp_dir: default location where temp files are created @param monitor_address: address for QMP monitor - @param sock_dir: where to create socket (defaults to base_temp_dir) @param drain_console: (optional) True to drain console socket to b= uffer @param console_log: (optional) path to console log file @param log_dir: where to create and keep log files @@ -163,7 +161,6 @@ def __init__(self, Tuple[socket.socket, socket.socket]] =3D None self._temp_dir: Optional[str] =3D None self._base_temp_dir =3D base_temp_dir - self._sock_dir =3D sock_dir self._log_dir =3D log_dir =20 self._monitor_address =3D monitor_address @@ -189,9 +186,6 @@ def __init__(self, self._console_index =3D 0 self._console_set =3D False self._console_device_type: Optional[str] =3D None - self._console_address =3D os.path.join( - self.sock_dir, f"{self._name}.con" - ) self._console_socket: Optional[socket.socket] =3D None self._console_file: Optional[socket.SocketIO] =3D None self._remove_files: List[str] =3D [] @@ -335,9 +329,6 @@ def args(self) -> List[str]: return self._args =20 def _pre_launch(self) -> None: - if self._console_set: - self._remove_files.append(self._console_address) - if self._qmp_set: if self._monitor_address is None: self._sock_pair =3D socket.socketpair() @@ -937,15 +928,6 @@ def temp_dir(self) -> str: dir=3Dself._base_temp_dir) return self._temp_dir =20 - @property - def sock_dir(self) -> str: - """ - Returns the directory used for sockfiles by this machine. - """ - if self._sock_dir: - return self._sock_dir - return self.temp_dir - @property def log_dir(self) -> str: """ diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py index 8180d3ab01..4f5ede85b2 100644 --- a/python/qemu/machine/qtest.py +++ b/python/qemu/machine/qtest.py @@ -135,17 +135,14 @@ def __init__(self, wrapper: Sequence[str] =3D (), name: Optional[str] =3D None, base_temp_dir: str =3D "/var/tmp", - sock_dir: Optional[str] =3D None, qmp_timer: Optional[float] =3D None): # pylint: disable=3Dtoo-many-arguments =20 if name is None: name =3D "qemu-%d" % os.getpid() - if sock_dir is None: - sock_dir =3D base_temp_dir super().__init__(binary, args, wrapper=3Dwrapper, name=3Dname, base_temp_dir=3Dbase_temp_dir, - sock_dir=3Dsock_dir, qmp_timer=3Dqmp_timer) + qmp_timer=3Dqmp_timer) self._qtest: Optional[QEMUQtestProtocol] =3D None self._qtest_sock_pair: Optional[ Tuple[socket.socket, socket.socket]] =3D None diff --git a/tests/avocado/acpi-bits.py b/tests/avocado/acpi-bits.py index bb3f818689..eca13dc518 100644 --- a/tests/avocado/acpi-bits.py +++ b/tests/avocado/acpi-bits.py @@ -92,17 +92,14 @@ def __init__(self, base_temp_dir: str =3D "/var/tmp", debugcon_log: str =3D "debugcon-log.txt", debugcon_addr: str =3D "0x403", - sock_dir: Optional[str] =3D None, qmp_timer: Optional[float] =3D None): # pylint: disable=3Dtoo-many-arguments =20 if name is None: name =3D "qemu-bits-%d" % os.getpid() - if sock_dir is None: - sock_dir =3D base_temp_dir super().__init__(binary, args, wrapper=3Dwrapper, name=3Dname, base_temp_dir=3Dbase_temp_dir, - sock_dir=3Dsock_dir, qmp_timer=3Dqmp_timer) + qmp_timer=3Dqmp_timer) self.debugcon_log =3D debugcon_log self.debugcon_addr =3D debugcon_addr self.base_temp_dir =3D base_temp_dir diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado= _qemu/__init__.py index 0172a359b7..0589534f28 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -322,7 +322,7 @@ def require_multiprocess(self): def _new_vm(self, name, *args): self._sd =3D tempfile.TemporaryDirectory(prefix=3D"qemu_") vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.workdir, - sock_dir=3Dself._sd.name, log_dir=3Dself.logdir) + log_dir=3Dself.logdir) self.log.debug('QEMUMachine "%s" created', name) self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir) self.log.debug('QEMUMachine "%s" log_dir: %s', name, vm.log_dir) diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed= .py index 90f1b7cb77..f691ee3fb8 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -247,7 +247,10 @@ def test_arm_ast2600_evb_buildroot_tpm(self): image_path =3D self.fetch_asset(image_url, asset_hash=3Dimage_hash, algorithm=3D'sha256') =20 - socket =3D os.path.join(self.vm.sock_dir, 'swtpm-socket') + # force creation of VM object, which also defines self._sd + vm =3D self.vm + + socket =3D os.path.join(self._sd.name, 'swtpm-socket') =20 subprocess.run(['swtpm', 'socket', '-d', '--tpm2', '--tpmstate', f'dir=3D{self.vm.temp_dir}', diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ef66fbd62b..145c682713 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -823,7 +823,7 @@ def __init__(self, path_suffix=3D''): super().__init__(qemu_prog, qemu_opts, wrapper=3Dwrapper, name=3Dname, base_temp_dir=3Dtest_dir, - sock_dir=3Dsock_dir, qmp_timer=3Dtimer) + qmp_timer=3Dtimer) self._num_drives =3D 0 =20 def _post_shutdown(self) -> None: diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index 2ffe092b31..d3987db942 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -44,8 +44,7 @@ class TestCbwError(iotests.QMPTestCase): =20 opts =3D ['-nodefaults', '-display', 'none', '-machine', 'none'] self.vm =3D QEMUMachine(iotests.qemu_prog, opts, - base_temp_dir=3Diotests.test_dir, - sock_dir=3Diotests.sock_dir) + base_temp_dir=3Diotests.test_dir) self.vm.launch() =20 def do_cbw_error(self, on_cbw_error): --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224663; cv=none; d=zohomail.com; s=zohoarc; b=nlRI8TqE+1ukBf+ZHHDnbQWKVEhZp+03/Yk4f6MyduIBM+ZJAKsiqo8upV+jx3w0DIx0os6rCHk7Fo23PXyWQm7hKUX06F0MoxproEGXws578/qN4ALspy8QZhQI7a8S+WX8JmNuICxUIEInmJcr01fLJ02aw4BLKAUWa9y+FnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224663; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w3StD4bo+PpSuLq5pwNj05F876gF6NHUKZzqNiociig=; b=RZFdthg078uClMyr+Cm28vSHJOi+YDeUM8QugaTqaCl1Z6zdAcnfv0MsdmOE6Hq/RyNK3ByySgfYV4YnjFSl0hntkPzZSzZY5yflisyPKso8oC6I9Sn9rb0Q/vovydSeGeB8q/eyg73BqK59g0BBpGTH7SRAVc98WYnecf7qCOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224663389787.0369411852785; Fri, 13 Oct 2023 12:17:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYN-00075J-LK; Fri, 13 Oct 2023 15:10:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYC-0006mJ-Bk for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY1-0001ra-Fk for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:20 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-101-TMkMF7QkN8aTAtOUq7MQ-Q-1; Fri, 13 Oct 2023 15:09:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 756C51029F40; Fri, 13 Oct 2023 19:09:52 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4233040C6CA0; Fri, 13 Oct 2023 19:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w3StD4bo+PpSuLq5pwNj05F876gF6NHUKZzqNiociig=; b=YTBgDfKTbACqCQc6/Q4MWjmonVjaRf+QoBIW8REaFAEBd7WZI+Mgq8fFJQ5mLE1cUt1COE 8366uQA+2sPP/Crsfzv3MYp7lSiI3mY7xHunX0NNiwXux2sHjbnzkMj7DD8vyEq5QX7Iqj HxXqAV0FfXQOhTu3XorKpB16WHd6DS8= X-MC-Unique: TMkMF7QkN8aTAtOUq7MQ-Q-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 07/25] Python/iotests: Add type hint for nbd module Date: Fri, 13 Oct 2023 15:09:22 -0400 Message-ID: <20231013190941.3699288-8-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224665285100003 Content-Type: text/plain; charset="utf-8" The test bails gracefully if this module isn't installed, but linters need a little help understanding that. It's enough to just declare the type in this case. (Fixes pylint complaining about use of an uninitialized variable because it isn't wise enough to understand the notrun call is noreturn.) Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20231006195243.3131140-2-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/tests/nbd-multiconn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/tests/nbd-multiconn b/tests/qemu-iotests/te= sts/nbd-multiconn index 478a1eaba2..7e686a786e 100755 --- a/tests/qemu-iotests/tests/nbd-multiconn +++ b/tests/qemu-iotests/tests/nbd-multiconn @@ -20,6 +20,8 @@ =20 import os from contextlib import contextmanager +from types import ModuleType + import iotests from iotests import qemu_img_create, qemu_io =20 @@ -28,7 +30,7 @@ disk =3D os.path.join(iotests.test_dir, 'disk') size =3D '4M' nbd_sock =3D os.path.join(iotests.sock_dir, 'nbd_sock') nbd_uri =3D 'nbd+unix:///{}?socket=3D' + nbd_sock - +nbd: ModuleType =20 @contextmanager def open_nbd(export_name): --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224572; cv=none; d=zohomail.com; s=zohoarc; b=AbE8/rynpYz9iTXmGUoeveMrW6Bsz3dtS9yssOIQcV3Rsi6RSWVvNrlLtCZBawA6EhxY4zwzbKy/ju09ENHcKmoSxtL0w47QLqBYC0S+nNskX3qWVT+em6Gqb4gtmOj03vGjE+uKoBLeEchOGq9qwZG1/StQLFMF7QS/ilWGYTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224572; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6Wk63tEYkkJ6DYHqO2WS70EapGOvR59GzuZeJ88eG2Y=; b=jtJ/cW6HQtey5JFLubo1WKW7ze5KD9vBHwNfE9p3NLT1g14gag67cbn27ZC5I0CmDnYuahGu7XYKTy9r30SyLJLS1iedBCH6hWnC+HfAK/BJCL6XAWlO+jbwaTv2PJDlL+ekwUhP220PN38DVHFjASCTshsaKMBmTc/Jg1SuNNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224572007403.5728612013776; Fri, 13 Oct 2023 12:16:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYF-0006np-2u; Fri, 13 Oct 2023 15:10:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXt-0006YN-0q for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXq-0001bs-MP for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-461-Ldv_5wPROWaY9-AE9jcnBg-1; Fri, 13 Oct 2023 15:09:54 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB4EF1029F41; Fri, 13 Oct 2023 19:09:53 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8369740C6F79; Fri, 13 Oct 2023 19:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Wk63tEYkkJ6DYHqO2WS70EapGOvR59GzuZeJ88eG2Y=; b=EKuyQFbom+J1CPXW9SluJvwYOfW5CU0Z5BBm1Bt4huZOW1XCt0LcBLUxOVlzZTBhSzFxfb Rn8Ln6/ojI9KQZY8Ex2keobZUMOHWshUbHDniz4uwK5wVI8FMUrWJPtMTmxwLtUSN2o3Jp aMPB7+MY7yXzN2PefE1GDFTSsKrEoh0= X-MC-Unique: Ldv_5wPROWaY9-AE9jcnBg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 08/25] python/qmp: remove Server.wait_closed() call for Python 3.12 Date: Fri, 13 Oct 2023 15:09:23 -0400 Message-ID: <20231013190941.3699288-9-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224573415100001 Content-Type: text/plain; charset="utf-8" This patch is a backport from https://gitlab.com/qemu-project/python-qemu-qmp/-/commit/e03a3334b6a477beb0= 9b293708632f2c06fe9f61 According to Guido in https://github.com/python/cpython/issues/104344 , this call was never meant to wait for the server to shut down - that is handled synchronously - but instead, this waits for all connections to close. Or, it would have, if it wasn't broken since it was introduced. 3.12 fixes the bug, which now causes a hang in our code. The fix is just to remove the wait. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20231006195243.3131140-3-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/qmp/protocol.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py index 753182131f..a4ffdfad51 100644 --- a/python/qemu/qmp/protocol.py +++ b/python/qemu/qmp/protocol.py @@ -495,7 +495,6 @@ async def _stop_server(self) -> None: try: self.logger.debug("Stopping server.") self._server.close() - await self._server.wait_closed() self.logger.debug("Server stopped.") finally: self._server =3D None --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224720; cv=none; d=zohomail.com; s=zohoarc; b=gjkL/IOtfVI1IhVP+Hq1TIN+IIUQ9qxSyIwWlli+sb8Viw5+QBFwz3wB5GnUm8fNjfgPlmzuPmfqcTTCyhDYefQX5BruIiIMe55uwy+V9Rgd1Pajwnd65YeB5GHYypAOj9uJS4RutfrsP8UXhM3nxMtOEttFvJzfBp485oglB8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224720; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TxjBcwAKy5hKEG8R8bR7k9fKvAnIttJRBhG+jyK2Scw=; b=i+fTUXIHbcHTR6JT7xRQCi1obCIWO9yun4zq6OAoVAvDyampHS0lTPUdxsJ1kIJNab36hSjTMjHYDsG1Jz33SMWOMZSMUXWk83AWsZ1tvzajB/s6DTHDxxblKnYur0+4QUSWDEKeQfndrUSoJDrpQwAfxJuTfke15igFiOqeKqQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224720470324.05342092749606; Fri, 13 Oct 2023 12:18:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYG-0006sc-UC; Fri, 13 Oct 2023 15:10:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY1-0006dD-9N for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXu-0001dR-Pe for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:07 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-CHZrUiKTMCC1DZsEJ4i6Rg-1; Fri, 13 Oct 2023 15:09:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FCB52810D45; Fri, 13 Oct 2023 19:09:55 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA3B940C6CA0; Fri, 13 Oct 2023 19:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TxjBcwAKy5hKEG8R8bR7k9fKvAnIttJRBhG+jyK2Scw=; b=ekUTdG0gHKTn88dB859slAzvaU/KPcnns28q/HgWE791rRyjjRmOQORUQBQgCBgSiLSe6L ls3mWx5nG/bmdzZDfLRMZ5XzXr0rLMJ+A0MvL2p+oiEVksp9vUrTrahWO9WL0ehCMiRkot Q6D02/D4IiSjPk3rLlNZJ/37CnJsbr8= X-MC-Unique: CHZrUiKTMCC1DZsEJ4i6Rg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 09/25] configure: fix error message to say Python 3.8 Date: Fri, 13 Oct 2023 15:09:24 -0400 Message-ID: <20231013190941.3699288-10-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224721490100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20231006195243.3131140-4-jsnow@redhat.com Signed-off-by: John Snow --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 8fada85a71..a49fc7b7e7 100755 --- a/configure +++ b/configure @@ -948,7 +948,7 @@ then # If first_python is set, there was a binary somewhere even though # it was not suitable. Use it for the error message. if test -n "$first_python"; then - error_exit "Cannot use '$first_python', Python >=3D 3.7 is require= d." \ + error_exit "Cannot use '$first_python', Python >=3D 3.8 is require= d." \ "Use --python=3D/path/to/python to specify a supported Python." else error_exit "Python not found. Use --python=3D/path/to/python" --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224651; cv=none; d=zohomail.com; s=zohoarc; b=l3BTEcoCDYjxWiYa6m943AVCVkDYZum/WZYTj7XaCO8zLHrbQHrrAHFjiCKAb6Xyyn7I7SK0fBwwAMs4vpV9xvpBqS6aPVMx/AOy/9Tkl8bhYFg1CQFGcsGdGPG7Lf+vE05H0brLlpM6ia8ECVXOobyUIHtB3Z0CTYWiKELt8gw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224651; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S55iOiMBHLn7mCEBQzBqeCldmVsvG97z++Q+ZUFBvvA=; b=IBJpE1TQ3c5WasCiHB0260JmecSFVccP428qlv2B85BLOTVa3idd3Rxip16sEGdixxEdI8/ZVeo2XL4qb+pSXitF82NR5Z/ZQ9JEwpFMRoJHsFeDfCERj1UDquV9m7SB23ZTUP+z7VdDwICkxMyxSGKHtPiUf12kAX9Q6owgVII= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224651426296.63012171556375; Fri, 13 Oct 2023 12:17:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYJ-0006vK-8S; Fri, 13 Oct 2023 15:10:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXz-0006am-Tq for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXs-0001cp-S2 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:06 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-369-PEWdQaN_ODmPQDXEChByeg-1; Fri, 13 Oct 2023 15:09:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5C3CE3C17128; Fri, 13 Oct 2023 19:09:56 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 240B940C6CA0; Fri, 13 Oct 2023 19:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S55iOiMBHLn7mCEBQzBqeCldmVsvG97z++Q+ZUFBvvA=; b=YVrBwxrSjY/d59+iyerBhQuTij3oKDWAMI8cYT7GDSzuEvs0u25XCi621mLUMtQ6t+otlB qy+AEnqyoXLSwdCgI0hoQnyiCpJpSwhW9/TV4y2GMQR7/OYcJuxtYTd0NdyK997k0VJeQd oI1x7YiqKLY9rOkn+8YMAnntn6KTAwk= X-MC-Unique: PEWdQaN_ODmPQDXEChByeg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 10/25] Python: Enable python3.12 support Date: Fri, 13 Oct 2023 15:09:25 -0400 Message-ID: <20231013190941.3699288-11-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224653229100003 Content-Type: text/plain; charset="utf-8" Python 3.12 has released, so update the test infrastructure to test against this version. Update the configure script to look for it when an explicit Python interpreter isn't chosen. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20231006195243.3131140-5-jsnow@redhat.com Signed-off-by: John Snow --- configure | 3 ++- python/setup.cfg | 3 ++- tests/docker/dockerfiles/python.docker | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/configure b/configure index a49fc7b7e7..96d0dd5ffc 100755 --- a/configure +++ b/configure @@ -562,7 +562,8 @@ first_python=3D if test -z "${PYTHON}"; then # A bare 'python' is traditionally python 2.x, but some distros # have it as python 3.x, so check in both places. - for binary in python3 python python3.11 python3.10 python3.9 python3.8= ; do + for binary in python3 python python3.12 python3.11 \ + python3.10 python3.9 python3.8; do if has "$binary"; then python=3D$(command -v "$binary") if check_py_version "$python"; then diff --git a/python/setup.cfg b/python/setup.cfg index 8c67dce457..48668609d3 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -18,6 +18,7 @@ classifiers =3D Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Typing :: Typed =20 [options] @@ -182,7 +183,7 @@ multi_line_output=3D3 # of python available on your system to run this test. =20 [tox:tox] -envlist =3D py38, py39, py310, py311 +envlist =3D py38, py39, py310, py311, py312 skip_missing_interpreters =3D true =20 [testenv] diff --git a/tests/docker/dockerfiles/python.docker b/tests/docker/dockerfi= les/python.docker index 383ccbdc3a..a3c1321190 100644 --- a/tests/docker/dockerfiles/python.docker +++ b/tests/docker/dockerfiles/python.docker @@ -11,7 +11,11 @@ ENV PACKAGES \ python3-pip \ python3-tox \ python3-virtualenv \ - python3.10 + python3.10 \ + python3.11 \ + python3.12 \ + python3.8 \ + python3.9 =20 RUN dnf install -y $PACKAGES RUN rpm -q $PACKAGES | sort > /packages.txt --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224771; cv=none; d=zohomail.com; s=zohoarc; b=MS8ZITY7bCU1blHIag1NgffTXjHm6NbnFS2Bffr1rzSbP9rbqUfShl/ylXlD6LumOPclGXFTBp2fcB28ng5VPyDu02uUJJylC60pGUtaAJ6koqYbWi8lF5liysUft57GetfU8/d7+GILB3ykCDPD2rIVN1C9wF5j/9ZVTsD3JTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224771; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MmkD59q/P21wa9VckhVCoRBedLwAP1Ul151IgE+jaUE=; b=RzP7YphPA8dBTif33slYS8of01fzcMHtH8QFWCEYli6V1cTnTjI6rdXTap/xGvVMHK4vTsXaIVAsMyrn5jlROV60VnFyfmUJMGuEVbcD6kSQc/R1iGg17gZuKrIx4EIHGNxuQlPHuAhvM/jQomAfEJ7NJDq+IVP9TmCFqXdwlos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224771395906.8058567154741; Fri, 13 Oct 2023 12:19:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYK-0006yE-Qz; Fri, 13 Oct 2023 15:10:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY6-0006hR-Ka for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXy-0001o9-Ve for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:14 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-219-3t_aLIL7OL6oQFFMP4eJEg-1; Fri, 13 Oct 2023 15:09:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DF6E1C00D1B; Fri, 13 Oct 2023 19:09:57 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A11B40C6CA2; Fri, 13 Oct 2023 19:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MmkD59q/P21wa9VckhVCoRBedLwAP1Ul151IgE+jaUE=; b=Kl3yYsThgH7ZzBbchI1XoA3fkwooeec7ihTc5Uu8D9O2o17gw5Pew0oScnqMoHpsISLWR6 YX/PKERWoiqm2EOZMKO0O2obe/Z/Tq8WEqVMqVNl/nHroqlS/k1/h5eJYlKTF8d0W5EBnZ M/+d0MrgRX87bO1f4tD61cTud4Owd6g= X-MC-Unique: 3t_aLIL7OL6oQFFMP4eJEg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 11/25] python/qemu/qmp/legacy: cmd(): drop cmd_id unused argument Date: Fri, 13 Oct 2023 15:09:26 -0400 Message-ID: <20231013190941.3699288-12-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224771670100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy The argument is unused, let's drop it for now, as we are going to refactor the interface and don't want to refactor unused things. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-2-vsementsov@yandex-team.ru Signed-off-by: John Snow --- python/qemu/qmp/legacy.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py index e1e9383978..fe115e301c 100644 --- a/python/qemu/qmp/legacy.py +++ b/python/qemu/qmp/legacy.py @@ -195,20 +195,16 @@ def cmd_obj(self, qmp_cmd: QMPMessage) -> QMPMessage: ) =20 def cmd(self, name: str, - args: Optional[Dict[str, object]] =3D None, - cmd_id: Optional[object] =3D None) -> QMPMessage: + args: Optional[Dict[str, object]] =3D None) -> QMPMessage: """ Build a QMP command and send it to the QMP Monitor. =20 :param name: command name (string) :param args: command arguments (dict) - :param cmd_id: command id (dict, list, string or int) """ qmp_cmd: QMPMessage =3D {'execute': name} if args: qmp_cmd['arguments'] =3D args - if cmd_id: - qmp_cmd['id'] =3D cmd_id return self.cmd_obj(qmp_cmd) =20 def command(self, cmd: str, **kwds: object) -> QMPReturnValue: --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224742; cv=none; d=zohomail.com; s=zohoarc; b=TXLc1gGV7Hkg9IZhj+JU1NbRobnjhPqpvCeCJnXRMnbKaTQ3tAf2UkyNnhTpRA1y1Q9zxBOUiGcLdGgD4vDtIYv6YG9TT7iMUllVX4z0HsCvEag4mcYf6vAr14+ILQ+ld/DTNoIUWpSAcEyPT4Yaz+fy6qjLBbIU3l9EVKNPNEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224742; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cxgTEoBavOn4bsrLaLlgOod3d59bBtFgJHbxexkR54s=; b=fwRdZnbIqRmJMgkVZ7UXEELNKIZ48Uq6yOL7H4eWb2c1Pm2qbDh2mqBWrCSax4DgKSELk2ZhRf0PNpEPOkk0r/wcWm5aorILNe7+OzJ+RhNchJELpHErhkkKrj6aVY+QgSk5HImkm6mp+VQF4YwH8WSR7efQCz66utJVGtbYmsw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224742074516.1873996581505; Fri, 13 Oct 2023 12:19:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYL-0006zJ-K9; Fri, 13 Oct 2023 15:10:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY5-0006fL-AI for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNXv-0001g0-Ee for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-83-gMv1fUy1OkSI5r3m9cSsRQ-1; Fri, 13 Oct 2023 15:10:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 062A41029F41; Fri, 13 Oct 2023 19:09:59 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9B1640C6CA1; Fri, 13 Oct 2023 19:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cxgTEoBavOn4bsrLaLlgOod3d59bBtFgJHbxexkR54s=; b=hoY8z9At8haalzFRVzPVfKJNL9agbgO73blf3OkD+rpk03XIdumI6keuO1X3k7r55oeGo/ PDx0OYzwzGUY4WNajDkEYKs8wP2vkTrO+I2dCDeENxz+dGEU6DxTv49a2XLUfTiCMVYifz lFrQpHFRp2t99Au9NsS0eF1U4HG6KaQ= X-MC-Unique: gMv1fUy1OkSI5r3m9cSsRQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 12/25] qmp_shell.py: _fill_completion() use .command() instead of .cmd() Date: Fri, 13 Oct 2023 15:09:27 -0400 Message-ID: <20231013190941.3699288-13-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224743572100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We just want to ignore failure, so we don't need low level .cmd(). This helps further renaming .command() to .cmd(). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-3-vsementsov@yandex-team.ru Signed-off-by: John Snow --- python/qemu/qmp/qmp_shell.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py index 619ab42ced..988d79c01b 100644 --- a/python/qemu/qmp/qmp_shell.py +++ b/python/qemu/qmp/qmp_shell.py @@ -91,14 +91,21 @@ import sys from typing import ( IO, + Dict, Iterator, List, NoReturn, Optional, Sequence, + cast, ) =20 -from qemu.qmp import ConnectError, QMPError, SocketAddrT +from qemu.qmp import ( + ConnectError, + ExecuteError, + QMPError, + SocketAddrT, +) from qemu.qmp.legacy import ( QEMUMonitorProtocol, QMPBadPortError, @@ -194,11 +201,12 @@ def close(self) -> None: super().close() =20 def _fill_completion(self) -> None: - cmds =3D self.cmd('query-commands') - if 'error' in cmds: - return - for cmd in cmds['return']: - self._completer.append(cmd['name']) + try: + cmds =3D cast(List[Dict[str, str]], self.command('query-comman= ds')) + for cmd in cmds: + self._completer.append(cmd['name']) + except ExecuteError: + pass =20 def _completer_setup(self) -> None: self._completer =3D QMPCompleter() --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224778; cv=none; d=zohomail.com; s=zohoarc; b=WFP1EIRv+rD82YprV83nUgmY7fA3dBdH8rd2Fz9tTt7+ddG8X11ocSGKHmyBkm9JYiDJrlJjDwQyZJgIovQYLN9YdeedaEIC8YItTTqBMqm3OqfBqIMXJ0O56PdRMyuqjxh9We9FRRgtFXl4xIhYKMC11tEat7uDarLxzDVggrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224778; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fMibcf1WJOst7WqdTUuAwHMJI3PCzA21uGEzA6VguR4=; b=TqWoRFyCdgdI6NT1jpQ102Nhn5cYQsTylE5rQLeohjVENAKCAiYKgS4J4uDCXUUVBvnUGwuNCVJli7kC0iChCwTE62srDPBirSENodKtWH/zsXNv9Ob41Ks3ezsusK51p9dX93vgwnZcVEHTLi/Nm9E+gApyWWO3heER930GvXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224778462720.9594390481225; Fri, 13 Oct 2023 12:19:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYH-0006uP-TO; Fri, 13 Oct 2023 15:10:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY9-0006kp-6A for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY1-0001rc-2A for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:16 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-634-HmZhD6_JNOCSufd1RPs1Tg-1; Fri, 13 Oct 2023 15:10:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5161329A9D2A; Fri, 13 Oct 2023 19:10:00 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14A1D40C6CA0; Fri, 13 Oct 2023 19:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fMibcf1WJOst7WqdTUuAwHMJI3PCzA21uGEzA6VguR4=; b=HbESlxFp1ABUYgRTcjmVsrbMQM21FbtTDtUbLfCUtzcJZt/HaL/CKq2ZsMYAzJ1uQgI3bX t2wg0q7eq/iY4dCN1awscH4P5Ox4/PA4fTqBlmcHZfFDCbp+v9sV04N3IrPIQeTO+Zk3Ud wnOMFpGnP1MHk8wRUexlv3rSP5IZY3E= X-MC-Unique: HmZhD6_JNOCSufd1RPs1Tg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 13/25] scripts/cpu-x86-uarch-abi.py: use .command() instead of .cmd() Date: Fri, 13 Oct 2023 15:09:28 -0400 Message-ID: <20231013190941.3699288-14-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224779688100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Here we don't expect a failure. In case of failure we'll crash on trying to access ['return']. Better is to use .command() that clearly raises on failure. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-4-vsementsov@yandex-team.ru Signed-off-by: John Snow --- scripts/cpu-x86-uarch-abi.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index 82ff07582f..893afd1b35 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @@ -69,7 +69,7 @@ shell =3D QEMUMonitorProtocol(sock) shell.connect() =20 -models =3D shell.cmd("query-cpu-definitions") +models =3D shell.command("query-cpu-definitions") =20 # These QMP props don't correspond to CPUID fatures # so ignore them @@ -85,7 +85,7 @@ =20 names =3D [] =20 -for model in models["return"]: +for model in models: if "alias-of" in model: continue names.append(model["name"]) @@ -93,12 +93,12 @@ models =3D {} =20 for name in sorted(names): - cpu =3D shell.cmd("query-cpu-model-expansion", - { "type": "static", - "model": { "name": name }}) + cpu =3D shell.command("query-cpu-model-expansion", + { "type": "static", + "model": { "name": name }}) =20 got =3D {} - for (feature, present) in cpu["return"]["model"]["props"].items(): + for (feature, present) in cpu["model"]["props"].items(): if present and feature not in skip: got[feature] =3D True =20 --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224579; cv=none; d=zohomail.com; s=zohoarc; b=DbeAcDDj0sMp0yx01x31hTs21OJvXh0RCZBOgx6lw8nZ4OZwCvCgA3mHuRpbWTvmYIJrTcEAZ/alNgttvxYzpF8A9T/U9sGom3sCD5uQqEDZ8fK0E8MAGM5nPYlLDq6z8VaaD4pMveW1o+6NHj9kLBYxU2qT0wi0CyLGIjtsP58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224579; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iJ7wl0Ii06+M3pV66TBNc0GtswGn7yjmI2vwYEHWBIg=; b=I98f6x5MG5uFuQBsPIZmFI0PohVM98KbgOMobJOCdGW8sXWAN4vAJW6XzXE6CjkbWK2KEWvM6W/Q4UYZEyF6bHDEaDZvr8Im0iVYfEB3RJXEc/QvOZBLZ5r31omIlw5eJhEc6QSfvsmHjEh+pwzY/327QV4cVURjtYt5eJeJtj4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224579111997.5333683404392; Fri, 13 Oct 2023 12:16:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYL-0006zB-Fa; Fri, 13 Oct 2023 15:10:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYK-0006xc-Ft for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY5-0001tR-4x for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:28 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-413-FXReLPtdMmqGpbsaF9VE1A-1; Fri, 13 Oct 2023 15:10:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93CB28039C1; Fri, 13 Oct 2023 19:10:01 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D6EB40C6CA0; Fri, 13 Oct 2023 19:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iJ7wl0Ii06+M3pV66TBNc0GtswGn7yjmI2vwYEHWBIg=; b=QDHs/YrWOBh+awiDlO5RA3v7rWpEQQF4cQj8pCJYleTL8bIs03FyY/ryB25PgSOdLomsnP mQi576SrN9RGp13fZmF2XjV2UqNfK7VMCa9DB7XyI9GJwaqUq7gF1KJeaRY1+pCAp0RsEf Jtx80kMAagYR/SJA+ntAxombN532uAo= X-MC-Unique: FXReLPtdMmqGpbsaF9VE1A-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 14/25] python: rename QEMUMonitorProtocol.cmd() to cmd_raw() Date: Fri, 13 Oct 2023 15:09:29 -0400 Message-ID: <20231013190941.3699288-15-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224580978100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Having cmd() and command() methods in one class doesn't look good. Rename cmd() to cmd_raw(), to show its meaning better. We also want to rename command() to cmd() in future, so this commit is a necessary step. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-5-vsementsov@yandex-team.ru Signed-off-by: John Snow --- python/qemu/machine/machine.py | 2 +- python/qemu/qmp/legacy.py | 4 ++-- tests/qemu-iotests/iotests.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index d539e91268..50bba33729 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -702,7 +702,7 @@ def qmp(self, cmd: str, conv_keys =3D True =20 qmp_args =3D self._qmp_args(conv_keys, args) - ret =3D self._qmp.cmd(cmd, args=3Dqmp_args) + ret =3D self._qmp.cmd_raw(cmd, args=3Dqmp_args) if cmd =3D=3D 'quit' and 'error' not in ret and 'return' in ret: self._quit_issued =3D True return ret diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py index fe115e301c..e5fa1ce9c4 100644 --- a/python/qemu/qmp/legacy.py +++ b/python/qemu/qmp/legacy.py @@ -194,8 +194,8 @@ def cmd_obj(self, qmp_cmd: QMPMessage) -> QMPMessage: ) ) =20 - def cmd(self, name: str, - args: Optional[Dict[str, object]] =3D None) -> QMPMessage: + def cmd_raw(self, name: str, + args: Optional[Dict[str, object]] =3D None) -> QMPMessage: """ Build a QMP command and send it to the QMP Monitor. =20 diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 145c682713..0c061d8986 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -460,7 +460,7 @@ def __init__(self, *args: str, instance_id: str =3D 'a'= , qmp: bool =3D False): def qmp(self, cmd: str, args: Optional[Dict[str, object]] =3D None) \ -> QMPMessage: assert self._qmp is not None - return self._qmp.cmd(cmd, args) + return self._qmp.cmd_raw(cmd, args) =20 def get_qmp(self) -> QEMUMonitorProtocol: assert self._qmp is not None --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224751; cv=none; d=zohomail.com; s=zohoarc; b=HNNZk2JZuFrzI3+HM0LlsKVi9m/GnryuMJB47NtzsOXoqmpFU/DdCqd8hgCSocIzUMkJ2B9duXqRXqZgWEKXHePOdgh4JeANeqpxhiikNRZirj2GvgLfhS9IocS0fiiIET1Ql8uk5KvyWNmCY08lGXxo4qIJR4GSI3y6rwPqflA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224751; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8xFtf4Yd0bb3Y8zYTnVPaNGv5cj//QNA285qIPF9jAI=; b=YqF57brDevbGwZZfqoGDuwIAmVFunD7YJIDFivQvhs3bssHdDryllucU/2qFAObmcUjfbyk0Kzotp0ophQ7TBpB812n800XwrNbhn13YQrc34m7dGR2Oyl7rYErbGjpOS0n4hpLD5pB9mndkU5NUvQExtGyhTPyMtLqeqy6M4HE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224751381739.5542263039795; Fri, 13 Oct 2023 12:19:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYt-0008Km-4l; Fri, 13 Oct 2023 15:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYW-0007Kw-Nj for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYH-0001zJ-34 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:40 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-288-0gJx9rJ5PFyMuCY1sX6unQ-1; Fri, 13 Oct 2023 15:10:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF72D3C17703; Fri, 13 Oct 2023 19:10:02 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2DD740C6CA0; Fri, 13 Oct 2023 19:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8xFtf4Yd0bb3Y8zYTnVPaNGv5cj//QNA285qIPF9jAI=; b=TVqAWoNeVbROb1s/KmiTqDECusHcOuMTDuU4Xsl5V3HZ8QlMbTGdZc+XuNM6P0vp/icA+/ Y5Isr7vM4tfCUy9507mRaRR6WrvL+PEgJSXdoqL5PJZZMpR0m0fco93hS+VUSWzAYAkuaZ VqV0Z6Gy6tYJD4+JRkmjT6DbRfNy/GU= X-MC-Unique: 0gJx9rJ5PFyMuCY1sX6unQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 15/25] python/qemu: rename command() to cmd() Date: Fri, 13 Oct 2023 15:09:30 -0400 Message-ID: <20231013190941.3699288-16-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224751668100001 From: Vladimir Sementsov-Ogievskiy Use a shorter name. We are going to move in iotests from qmp() to command() where possible. But command() is longer than qmp() and don't look better. Let's rename. You can simply grep for '\.command(' and for 'def command(' to check that everything is updated (command() in tests/docker/docker.py is unrelated). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Juan Quintela Message-id: 20231006154125.1068348-6-vsementsov@yandex-team.ru [vsementsov: also update three occurrences in tests/avocado/machine_aspeed.py and keep r-b] Signed-off-by: John Snow --- docs/devel/testing.rst | 10 +- python/qemu/machine/machine.py | 8 +- python/qemu/qmp/legacy.py | 2 +- python/qemu/qmp/qmp_shell.py | 2 +- python/qemu/utils/qemu_ga_client.py | 2 +- python/qemu/utils/qom.py | 8 +- python/qemu/utils/qom_common.py | 2 +- python/qemu/utils/qom_fuse.py | 6 +- scripts/cpu-x86-uarch-abi.py | 8 +- scripts/device-crash-test | 8 +- scripts/render_block_graph.py | 8 +- tests/avocado/avocado_qemu/__init__.py | 4 +- tests/avocado/cpu_queries.py | 5 +- tests/avocado/hotplug_cpu.py | 10 +- tests/avocado/info_usernet.py | 4 +- tests/avocado/machine_arm_integratorcp.py | 6 +- tests/avocado/machine_aspeed.py | 12 +- tests/avocado/machine_m68k_nextcube.py | 4 +- tests/avocado/machine_mips_malta.py | 6 +- tests/avocado/machine_s390_ccw_virtio.py | 28 ++--- tests/avocado/migration.py | 10 +- tests/avocado/pc_cpu_hotplug_props.py | 2 +- tests/avocado/version.py | 4 +- tests/avocado/virtio_check_params.py | 6 +- tests/avocado/virtio_version.py | 5 +- tests/avocado/x86_cpu_model_versions.py | 13 +- tests/migration/guestperf/engine.py | 144 +++++++++++----------- tests/qemu-iotests/256 | 34 ++--- tests/qemu-iotests/257 | 34 ++--- 29 files changed, 200 insertions(+), 195 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index f3e2472189..b0680cbb22 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -1014,8 +1014,8 @@ class. Here's a simple usage example: """ def test_qmp_human_info_version(self): self.vm.launch() - res =3D self.vm.command('human-monitor-command', - command_line=3D'info version') + res =3D self.vm.cmd('human-monitor-command', + command_line=3D'info version') self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)') =20 To execute your test, run: @@ -1065,15 +1065,15 @@ and hypothetical example follows: first_machine.launch() second_machine.launch() =20 - first_res =3D first_machine.command( + first_res =3D first_machine.cmd( 'human-monitor-command', command_line=3D'info version') =20 - second_res =3D second_machine.command( + second_res =3D second_machine.cmd( 'human-monitor-command', command_line=3D'info version') =20 - third_res =3D self.get_vm(name=3D'third_machine').command( + third_res =3D self.get_vm(name=3D'third_machine').cmd( 'human-monitor-command', command_line=3D'info version') =20 diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 50bba33729..eae193eb00 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -707,16 +707,16 @@ def qmp(self, cmd: str, self._quit_issued =3D True return ret =20 - def command(self, cmd: str, - conv_keys: bool =3D True, - **args: Any) -> QMPReturnValue: + def cmd(self, cmd: str, + conv_keys: bool =3D True, + **args: Any) -> QMPReturnValue: """ Invoke a QMP command. On success return the response dict. On failure raise an exception. """ qmp_args =3D self._qmp_args(conv_keys, args) - ret =3D self._qmp.command(cmd, **qmp_args) + ret =3D self._qmp.cmd(cmd, **qmp_args) if cmd =3D=3D 'quit': self._quit_issued =3D True return ret diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py index e5fa1ce9c4..22a2b5616e 100644 --- a/python/qemu/qmp/legacy.py +++ b/python/qemu/qmp/legacy.py @@ -207,7 +207,7 @@ def cmd_raw(self, name: str, qmp_cmd['arguments'] =3D args return self.cmd_obj(qmp_cmd) =20 - def command(self, cmd: str, **kwds: object) -> QMPReturnValue: + def cmd(self, cmd: str, **kwds: object) -> QMPReturnValue: """ Build and send a QMP command to the monitor, report errors if any """ diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py index 988d79c01b..98e684e9e8 100644 --- a/python/qemu/qmp/qmp_shell.py +++ b/python/qemu/qmp/qmp_shell.py @@ -202,7 +202,7 @@ def close(self) -> None: =20 def _fill_completion(self) -> None: try: - cmds =3D cast(List[Dict[str, str]], self.command('query-comman= ds')) + cmds =3D cast(List[Dict[str, str]], self.cmd('query-commands')) for cmd in cmds: self._completer.append(cmd['name']) except ExecuteError: diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_g= a_client.py index d8411bb2d0..9a665e6e99 100644 --- a/python/qemu/utils/qemu_ga_client.py +++ b/python/qemu/utils/qemu_ga_client.py @@ -64,7 +64,7 @@ class QemuGuestAgent(QEMUMonitorProtocol): def __getattr__(self, name: str) -> Callable[..., Any]: def wrapper(**kwds: object) -> object: - return self.command('guest-' + name.replace('_', '-'), **kwds) + return self.cmd('guest-' + name.replace('_', '-'), **kwds) return wrapper =20 =20 diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py index bcf192f477..426a0f245f 100644 --- a/python/qemu/utils/qom.py +++ b/python/qemu/utils/qom.py @@ -84,7 +84,7 @@ def __init__(self, args: argparse.Namespace): self.value =3D args.value =20 def run(self) -> int: - rsp =3D self.qmp.command( + rsp =3D self.qmp.cmd( 'qom-set', path=3Dself.path, property=3Dself.prop, @@ -129,7 +129,7 @@ def __init__(self, args: argparse.Namespace): self.prop =3D tmp[1] =20 def run(self) -> int: - rsp =3D self.qmp.command( + rsp =3D self.qmp.cmd( 'qom-get', path=3Dself.path, property=3Dself.prop @@ -231,8 +231,8 @@ def _list_node(self, path: str) -> None: if item.child: continue try: - rsp =3D self.qmp.command('qom-get', path=3Dpath, - property=3Ditem.name) + rsp =3D self.qmp.cmd('qom-get', path=3Dpath, + property=3Ditem.name) print(f" {item.name}: {rsp} ({item.type})") except ExecuteError as err: print(f" {item.name}: ({item.type})") diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common= .py index 80da1b2304..dd2c8b1908 100644 --- a/python/qemu/utils/qom_common.py +++ b/python/qemu/utils/qom_common.py @@ -140,7 +140,7 @@ def qom_list(self, path: str) -> List[ObjectPropertyInf= o]: """ :return: a strongly typed list from the 'qom-list' command. """ - rsp =3D self.qmp.command('qom-list', path=3Dpath) + rsp =3D self.qmp.cmd('qom-list', path=3Dpath) # qom-list returns List[ObjectPropertyInfo] assert isinstance(rsp, list) return [ObjectPropertyInfo.make(x) for x in rsp] diff --git a/python/qemu/utils/qom_fuse.py b/python/qemu/utils/qom_fuse.py index 8dcd59fcde..cf7e344bd5 100644 --- a/python/qemu/utils/qom_fuse.py +++ b/python/qemu/utils/qom_fuse.py @@ -137,7 +137,7 @@ def read(self, path: str, size: int, offset: int, fh: I= O[bytes]) -> bytes: if path =3D=3D '': path =3D '/' try: - data =3D str(self.qmp.command('qom-get', path=3Dpath, property= =3Dprop)) + data =3D str(self.qmp.cmd('qom-get', path=3Dpath, property=3Dp= rop)) data +=3D '\n' # make values shell friendly except ExecuteError as err: raise FuseOSError(EPERM) from err @@ -152,8 +152,8 @@ def readlink(self, path: str) -> Union[bool, str]: return False path, prop =3D path.rsplit('/', 1) prefix =3D '/'.join(['..'] * (len(path.split('/')) - 1)) - return prefix + str(self.qmp.command('qom-get', path=3Dpath, - property=3Dprop)) + return prefix + str(self.qmp.cmd('qom-get', path=3Dpath, + property=3Dprop)) =20 def getattr(self, path: str, fh: Optional[IO[bytes]] =3D None) -> Mapping[str, object]: diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index 893afd1b35..f6baeeff24 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @@ -69,7 +69,7 @@ shell =3D QEMUMonitorProtocol(sock) shell.connect() =20 -models =3D shell.command("query-cpu-definitions") +models =3D shell.cmd("query-cpu-definitions") =20 # These QMP props don't correspond to CPUID fatures # so ignore them @@ -93,9 +93,9 @@ models =3D {} =20 for name in sorted(names): - cpu =3D shell.command("query-cpu-model-expansion", - { "type": "static", - "model": { "name": name }}) + cpu =3D shell.cmd("query-cpu-model-expansion", + { "type": "static", + "model": { "name": name }}) =20 got =3D {} for (feature, present) in cpu["model"]["props"].items(): diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 353aa575d7..da8b56edd9 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -269,14 +269,14 @@ def formatTestCase(t): =20 def qomListTypeNames(vm, **kwargs): """Run qom-list-types QMP command, return type names""" - types =3D vm.command('qom-list-types', **kwargs) + types =3D vm.cmd('qom-list-types', **kwargs) return [t['name'] for t in types] =20 =20 def infoQDM(vm): """Parse 'info qdm' output""" args =3D {'command-line': 'info qdm'} - devhelp =3D vm.command('human-monitor-command', **args) + devhelp =3D vm.cmd('human-monitor-command', **args) for l in devhelp.split('\n'): l =3D l.strip() if l =3D=3D '' or l.endswith(':'): @@ -304,9 +304,9 @@ class QemuBinaryInfo(object): # there's no way to query DeviceClass::user_creatable using QM= P, # so use 'info qdm': self.no_user_devs =3D set([d['name'] for d in infoQDM(vm, ) if= d['no-user']]) - self.machines =3D list(m['name'] for m in vm.command('query-ma= chines')) + self.machines =3D list(m['name'] for m in vm.cmd('query-machin= es')) self.user_devs =3D self.alldevs.difference(self.no_user_devs) - self.kvm_available =3D vm.command('query-kvm')['enabled'] + self.kvm_available =3D vm.cmd('query-kvm')['enabled'] finally: vm.shutdown() =20 diff --git a/scripts/render_block_graph.py b/scripts/render_block_graph.py index 8f731a5cfe..3e1a2e3fa7 100755 --- a/scripts/render_block_graph.py +++ b/scripts/render_block_graph.py @@ -43,13 +43,13 @@ def render_block_graph(qmp, filename, format=3D'png'): representation in @format into "@filename.@format" ''' =20 - bds_nodes =3D qmp.command('query-named-block-nodes') + bds_nodes =3D qmp.cmd('query-named-block-nodes') bds_nodes =3D {n['node-name']: n for n in bds_nodes} =20 - job_nodes =3D qmp.command('query-block-jobs') + job_nodes =3D qmp.cmd('query-block-jobs') job_nodes =3D {n['device']: n for n in job_nodes} =20 - block_graph =3D qmp.command('x-debug-query-block-graph') + block_graph =3D qmp.cmd('x-debug-query-block-graph') =20 graph =3D Digraph(comment=3D'Block Nodes Graph') graph.format =3D format @@ -94,7 +94,7 @@ class LibvirtGuest(): def __init__(self, name): self.name =3D name =20 - def command(self, cmd): + def cmd(self, cmd): # only supports qmp commands without parameters m =3D {'execute': cmd} ar =3D ['virsh', 'qemu-monitor-command', self.name, json.dumps(m)] diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado= _qemu/__init__.py index 0589534f28..d71e989db6 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -408,8 +408,8 @@ class LinuxSSHMixIn: =20 def ssh_connect(self, username, credential, credential_is_key=3DTrue): self.ssh_logger =3D logging.getLogger('ssh') - res =3D self.vm.command('human-monitor-command', - command_line=3D'info usernet') + res =3D self.vm.cmd('human-monitor-command', + command_line=3D'info usernet') port =3D get_info_usernet_hostfwd_port(res) self.assertIsNotNone(port) self.assertGreater(port, 0) diff --git a/tests/avocado/cpu_queries.py b/tests/avocado/cpu_queries.py index cf69f69b11..86c2d5c92d 100644 --- a/tests/avocado/cpu_queries.py +++ b/tests/avocado/cpu_queries.py @@ -23,12 +23,13 @@ def test(self): self.vm.add_args('-S') self.vm.launch() =20 - cpus =3D self.vm.command('query-cpu-definitions') + cpus =3D self.vm.cmd('query-cpu-definitions') for c in cpus: self.log.info("Checking CPU: %s", c) self.assertNotIn('', c['unavailable-features'], c['name']) =20 for c in cpus: model =3D {'name': c['name']} - e =3D self.vm.command('query-cpu-model-expansion', model=3Dmod= el, type=3D'full') + e =3D self.vm.cmd('query-cpu-model-expansion', model=3Dmodel, + type=3D'full') self.assertEquals(e['model']['name'], c['name']) diff --git a/tests/avocado/hotplug_cpu.py b/tests/avocado/hotplug_cpu.py index 6374bf1b54..292bb43e4d 100644 --- a/tests/avocado/hotplug_cpu.py +++ b/tests/avocado/hotplug_cpu.py @@ -29,9 +29,9 @@ def test(self): with self.assertRaises(AssertionError): self.ssh_command('test -e /sys/devices/system/cpu/cpu1') =20 - self.vm.command('device_add', - driver=3D'Haswell-x86_64-cpu', - socket_id=3D0, - core_id=3D1, - thread_id=3D0) + self.vm.cmd('device_add', + driver=3D'Haswell-x86_64-cpu', + socket_id=3D0, + core_id=3D1, + thread_id=3D0) self.ssh_command('test -e /sys/devices/system/cpu/cpu1') diff --git a/tests/avocado/info_usernet.py b/tests/avocado/info_usernet.py index fdc4d90c42..e1aa7a6e0a 100644 --- a/tests/avocado/info_usernet.py +++ b/tests/avocado/info_usernet.py @@ -22,8 +22,8 @@ def test_hostfwd(self): self.require_netdev('user') self.vm.add_args('-netdev', 'user,id=3Dvnet,hostfwd=3D:127.0.0.1:0= -:22') self.vm.launch() - res =3D self.vm.command('human-monitor-command', - command_line=3D'info usernet') + res =3D self.vm.cmd('human-monitor-command', + command_line=3D'info usernet') port =3D get_info_usernet_hostfwd_port(res) self.assertIsNotNone(port, ('"info usernet" output content does not seem= to ' diff --git a/tests/avocado/machine_arm_integratorcp.py b/tests/avocado/mach= ine_arm_integratorcp.py index 1ffe1073ef..87f5cf3953 100644 --- a/tests/avocado/machine_arm_integratorcp.py +++ b/tests/avocado/machine_arm_integratorcp.py @@ -81,9 +81,9 @@ def test_framebuffer_tux_logo(self): self.boot_integratorcp() framebuffer_ready =3D 'Console: switching to colour frame buffer d= evice' wait_for_console_pattern(self, framebuffer_ready) - self.vm.command('human-monitor-command', command_line=3D'stop') - self.vm.command('human-monitor-command', - command_line=3D'screendump %s' % screendump_path) + self.vm.cmd('human-monitor-command', command_line=3D'stop') + self.vm.cmd('human-monitor-command', + command_line=3D'screendump %s' % screendump_path) logger =3D logging.getLogger('framebuffer') =20 cpu_count =3D 1 diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed= .py index f691ee3fb8..df31b2a8a8 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -181,8 +181,8 @@ def test_arm_ast2500_evb_buildroot(self): 'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d'); exec_command_and_wait_for_pattern(self, 'cat /sys/class/hwmon/hwmon1/temp1_input', '0= ') - self.vm.command('qom-set', path=3D'/machine/peripheral/tmp-test', - property=3D'temperature', value=3D18000); + self.vm.cmd('qom-set', path=3D'/machine/peripheral/tmp-test', + property=3D'temperature', value=3D18000); exec_command_and_wait_for_pattern(self, 'cat /sys/class/hwmon/hwmon1/temp1_input', '1= 8000') =20 @@ -213,8 +213,8 @@ def test_arm_ast2600_evb_buildroot(self): 'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d'); exec_command_and_wait_for_pattern(self, 'cat /sys/class/hwmon/hwmon0/temp1_input', '0= ') - self.vm.command('qom-set', path=3D'/machine/peripheral/tmp-test', - property=3D'temperature', value=3D18000); + self.vm.cmd('qom-set', path=3D'/machine/peripheral/tmp-test', + property=3D'temperature', value=3D18000); exec_command_and_wait_for_pattern(self, 'cat /sys/class/hwmon/hwmon0/temp1_input', '1= 8000') =20 @@ -360,8 +360,8 @@ def test_arm_ast2600_evb_sdk(self): 'i2c i2c-5: new_device: Instantiated device lm75 at 0x4d'); self.ssh_command_output_contains( 'cat /sys/class/hwmon/hwmon19/temp1_input', '= 0') - self.vm.command('qom-set', path=3D'/machine/peripheral/tmp-test', - property=3D'temperature', value=3D18000); + self.vm.cmd('qom-set', path=3D'/machine/peripheral/tmp-test', + property=3D'temperature', value=3D18000); self.ssh_command_output_contains( 'cat /sys/class/hwmon/hwmon19/temp1_input', '= 18000') =20 diff --git a/tests/avocado/machine_m68k_nextcube.py b/tests/avocado/machine= _m68k_nextcube.py index 6790e7d9cd..d6da2fbb01 100644 --- a/tests/avocado/machine_m68k_nextcube.py +++ b/tests/avocado/machine_m68k_nextcube.py @@ -43,8 +43,8 @@ def check_bootrom_framebuffer(self, screenshot_path): # 'displaysurface_create 1120x832' trace-event. time.sleep(2) =20 - self.vm.command('human-monitor-command', - command_line=3D'screendump %s' % screenshot_path) + self.vm.cmd('human-monitor-command', + command_line=3D'screendump %s' % screenshot_path) =20 @skipUnless(PIL_AVAILABLE, 'Python PIL not installed') def test_bootrom_framebuffer_size(self): diff --git a/tests/avocado/machine_mips_malta.py b/tests/avocado/machine_mi= ps_malta.py index 92233451c5..9bd54518bf 100644 --- a/tests/avocado/machine_mips_malta.py +++ b/tests/avocado/machine_mips_malta.py @@ -71,9 +71,9 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_count): framebuffer_ready =3D 'Console: switching to colour frame buffer d= evice' wait_for_console_pattern(self, framebuffer_ready, failure_message=3D'Kernel panic - not syn= cing') - self.vm.command('human-monitor-command', command_line=3D'stop') - self.vm.command('human-monitor-command', - command_line=3D'screendump %s' % screendump_path) + self.vm.cmd('human-monitor-command', command_line=3D'stop') + self.vm.cmd('human-monitor-command', + command_line=3D'screendump %s' % screendump_path) logger =3D logging.getLogger('framebuffer') =20 match_threshold =3D 0.95 diff --git a/tests/avocado/machine_s390_ccw_virtio.py b/tests/avocado/machi= ne_s390_ccw_virtio.py index e7a2a20ba6..e1f493bc44 100644 --- a/tests/avocado/machine_s390_ccw_virtio.py +++ b/tests/avocado/machine_s390_ccw_virtio.py @@ -107,10 +107,10 @@ def test_s390x_devices(self): 'dd if=3D/dev/hwrng of=3D/dev/null bs=3D1k count= =3D10', '10+0 records out') self.clear_guest_dmesg() - self.vm.command('device_del', id=3D'rn1') + self.vm.cmd('device_del', id=3D'rn1') self.wait_for_crw_reports() self.clear_guest_dmesg() - self.vm.command('device_del', id=3D'rn2') + self.vm.cmd('device_del', id=3D'rn2') self.wait_for_crw_reports() exec_command_and_wait_for_pattern(self, 'dd if=3D/dev/hwrng of=3D/dev/null bs=3D1k count= =3D10', @@ -132,8 +132,8 @@ def test_s390x_devices(self): '0x0000000c') # add another device self.clear_guest_dmesg() - self.vm.command('device_add', driver=3D'virtio-net-ccw', - devno=3D'fe.0.4711', id=3D'net_4711') + self.vm.cmd('device_add', driver=3D'virtio-net-ccw', + devno=3D'fe.0.4711', id=3D'net_4711') self.wait_for_crw_reports() exec_command_and_wait_for_pattern(self, 'for i in 1 2 3 4 5 6 7 ; = do ' 'if [ -e /sys/bus/ccw/devices/*4711 ]; then break; fi = ;' @@ -141,7 +141,7 @@ def test_s390x_devices(self): '0.0.4711') # and detach it again self.clear_guest_dmesg() - self.vm.command('device_del', id=3D'net_4711') + self.vm.cmd('device_del', id=3D'net_4711') self.vm.event_wait(name=3D'DEVICE_DELETED', match=3D{'data': {'device': 'net_4711'}}) self.wait_for_crw_reports() @@ -151,10 +151,10 @@ def test_s390x_devices(self): # test the virtio-balloon device exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo', 'MemTotal: 115640 kB') - self.vm.command('human-monitor-command', command_line=3D'balloon 9= 6') + self.vm.cmd('human-monitor-command', command_line=3D'balloon 96') exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo', 'MemTotal: 82872 kB') - self.vm.command('human-monitor-command', command_line=3D'balloon 1= 28') + self.vm.cmd('human-monitor-command', command_line=3D'balloon 128') exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo', 'MemTotal: 115640 kB') =20 @@ -245,7 +245,7 @@ def test_s390x_fedora(self): '12+0 records out') with tempfile.NamedTemporaryFile(suffix=3D'.ppm', prefix=3D'qemu-scrdump-') as = ppmfile: - self.vm.command('screendump', filename=3Dppmfile.name) + self.vm.cmd('screendump', filename=3Dppmfile.name) ppmfile.seek(0) line =3D ppmfile.readline() self.assertEqual(line, b"P6\n") @@ -261,16 +261,16 @@ def test_s390x_fedora(self): # Hot-plug a virtio-crypto device and see whether it gets accepted self.log.info("Test hot-plug virtio-crypto device") self.clear_guest_dmesg() - self.vm.command('object-add', qom_type=3D'cryptodev-backend-builti= n', - id=3D'cbe0') - self.vm.command('device_add', driver=3D'virtio-crypto-ccw', id=3D'= crypdev0', - cryptodev=3D'cbe0', devno=3D'fe.0.2342') + self.vm.cmd('object-add', qom_type=3D'cryptodev-backend-builtin', + id=3D'cbe0') + self.vm.cmd('device_add', driver=3D'virtio-crypto-ccw', id=3D'cryp= dev0', + cryptodev=3D'cbe0', devno=3D'fe.0.2342') exec_command_and_wait_for_pattern(self, 'while ! (dmesg -c | grep Accelerator.device) ; do' ' sleep 1 ; done', 'Accelerator device is ready') exec_command_and_wait_for_pattern(self, 'lscss', '0.0.2342') - self.vm.command('device_del', id=3D'crypdev0') - self.vm.command('object-del', id=3D'cbe0') + self.vm.cmd('device_del', id=3D'crypdev0') + self.vm.cmd('object-del', id=3D'cbe0') exec_command_and_wait_for_pattern(self, 'while ! (dmesg -c | grep Start.virtcrypto_remove)= ; do' ' sleep 1 ; done', 'Start virtcrypto_remove.') diff --git a/tests/avocado/migration.py b/tests/avocado/migration.py index fdc1d234fb..09b62f813e 100644 --- a/tests/avocado/migration.py +++ b/tests/avocado/migration.py @@ -30,7 +30,7 @@ class MigrationTest(QemuSystemTest): =20 @staticmethod def migration_finished(vm): - return vm.command('query-migrate')['status'] in ('completed', 'fai= led') + return vm.cmd('query-migrate')['status'] in ('completed', 'failed') =20 def assert_migration(self, src_vm, dst_vm): wait.wait_for(self.migration_finished, @@ -41,10 +41,10 @@ def assert_migration(self, src_vm, dst_vm): timeout=3Dself.timeout, step=3D0.1, args=3D(dst_vm,)) - self.assertEqual(src_vm.command('query-migrate')['status'], 'compl= eted') - self.assertEqual(dst_vm.command('query-migrate')['status'], 'compl= eted') - self.assertEqual(dst_vm.command('query-status')['status'], 'runnin= g') - self.assertEqual(src_vm.command('query-status')['status'],'postmig= rate') + self.assertEqual(src_vm.cmd('query-migrate')['status'], 'completed= ') + self.assertEqual(dst_vm.cmd('query-migrate')['status'], 'completed= ') + self.assertEqual(dst_vm.cmd('query-status')['status'], 'running') + self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate= ') =20 def do_migrate(self, dest_uri, src_uri=3DNone): dest_vm =3D self.get_vm('-incoming', dest_uri) diff --git a/tests/avocado/pc_cpu_hotplug_props.py b/tests/avocado/pc_cpu_h= otplug_props.py index 52b878188e..b56f51d02a 100644 --- a/tests/avocado/pc_cpu_hotplug_props.py +++ b/tests/avocado/pc_cpu_hotplug_props.py @@ -32,4 +32,4 @@ def test_no_die_id(self): self.vm.add_args('-smp', '1,sockets=3D2,cores=3D2,threads=3D2,maxc= pus=3D8') self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=3D1,core-= id=3D0,thread-id=3D0') self.vm.launch() - self.assertEquals(len(self.vm.command('query-cpus-fast')), 2) + self.assertEquals(len(self.vm.cmd('query-cpus-fast')), 2) diff --git a/tests/avocado/version.py b/tests/avocado/version.py index dd775955eb..93ffdf3d97 100644 --- a/tests/avocado/version.py +++ b/tests/avocado/version.py @@ -20,6 +20,6 @@ class Version(QemuSystemTest): def test_qmp_human_info_version(self): self.vm.add_args('-nodefaults') self.vm.launch() - res =3D self.vm.command('human-monitor-command', - command_line=3D'info version') + res =3D self.vm.cmd('human-monitor-command', + command_line=3D'info version') self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)') diff --git a/tests/avocado/virtio_check_params.py b/tests/avocado/virtio_ch= eck_params.py index 4093da8a67..f4314ef824 100644 --- a/tests/avocado/virtio_check_params.py +++ b/tests/avocado/virtio_check_params.py @@ -51,8 +51,8 @@ def query_virtqueue(self, vm, dev_type_name): error =3D None props =3D None =20 - output =3D vm.command('human-monitor-command', - command_line =3D 'info qtree') + output =3D vm.cmd('human-monitor-command', + command_line =3D 'info qtree') props_list =3D DEV_TYPES[dev_type_name].values(); pattern =3D self.make_pattern(props_list) res =3D re.findall(pattern, output) @@ -121,7 +121,7 @@ def test_machine_types(self): # collect all machine types except 'none', 'isapc', 'microvm' with QEMUMachine(self.qemu_bin) as vm: vm.launch() - machines =3D [m['name'] for m in vm.command('query-machines')] + machines =3D [m['name'] for m in vm.cmd('query-machines')] vm.shutdown() machines.remove('none') machines.remove('isapc') diff --git a/tests/avocado/virtio_version.py b/tests/avocado/virtio_version= .py index c84e48813a..afe5e828b5 100644 --- a/tests/avocado/virtio_version.py +++ b/tests/avocado/virtio_version.py @@ -48,7 +48,8 @@ def pci_modern_device_id(virtio_devid): return virtio_devid + 0x1040 =20 def devtype_implements(vm, devtype, implements): - return devtype in [d['name'] for d in vm.command('qom-list-types', imp= lements=3Dimplements)] + return devtype in [d['name'] for d in + vm.cmd('qom-list-types', implements=3Dimplements)] =20 def get_pci_interfaces(vm, devtype): interfaces =3D ('pci-express-device', 'conventional-pci-device') @@ -78,7 +79,7 @@ def run_device(self, devtype, opts=3DNone, machine=3D'pc'= ): vm.add_args('-S') vm.launch() =20 - pcibuses =3D vm.command('query-pci') + pcibuses =3D vm.cmd('query-pci') alldevs =3D [dev for bus in pcibuses for dev in bus['devices']] devfortest =3D [dev for dev in alldevs if dev['qdev_id'] =3D=3D 'devfortest'] diff --git a/tests/avocado/x86_cpu_model_versions.py b/tests/avocado/x86_cp= u_model_versions.py index a6edf74c1c..9e07b8a55d 100644 --- a/tests/avocado/x86_cpu_model_versions.py +++ b/tests/avocado/x86_cpu_model_versions.py @@ -84,7 +84,8 @@ def test_4_0_alias_compatibility(self): # with older QEMU versions that didn't have the versioned CPU model self.vm.add_args('-S') self.vm.launch() - cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) + cpus =3D dict((m['name'], m) for m in + self.vm.cmd('query-cpu-definitions')) =20 self.assertFalse(cpus['Cascadelake-Server']['static'], 'unversioned Cascadelake-Server CPU model must no= t be static') @@ -115,7 +116,8 @@ def test_4_1_alias(self): self.vm.add_args('-S') self.vm.launch() =20 - cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) + cpus =3D dict((m['name'], m) for m in + self.vm.cmd('query-cpu-definitions')) =20 self.assertFalse(cpus['Cascadelake-Server']['static'], 'unversioned Cascadelake-Server CPU model must no= t be static') @@ -220,7 +222,8 @@ def test_none_alias(self): self.vm.add_args('-S') self.vm.launch() =20 - cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) + cpus =3D dict((m['name'], m) for m in + self.vm.cmd('query-cpu-definitions')) =20 self.assertFalse(cpus['Cascadelake-Server']['static'], 'unversioned Cascadelake-Server CPU model must no= t be static') @@ -246,8 +249,8 @@ class CascadelakeArchCapabilities(avocado_qemu.QemuSyst= emTest): :avocado: tags=3Darch:x86_64 """ def get_cpu_prop(self, prop): - cpu_path =3D self.vm.command('query-cpus-fast')[0].get('qom-path') - return self.vm.command('qom-get', path=3Dcpu_path, property=3Dprop) + cpu_path =3D self.vm.cmd('query-cpus-fast')[0].get('qom-path') + return self.vm.cmd('qom-get', path=3Dcpu_path, property=3Dprop) =20 def test_4_1(self): """ diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestper= f/engine.py index e69d16a62c..da96ca034a 100644 --- a/tests/migration/guestperf/engine.py +++ b/tests/migration/guestperf/engine.py @@ -77,7 +77,7 @@ def _cpu_timing(self, pid): return TimingRecord(pid, now, 1000 * (stime + utime) / jiffies= _per_sec) =20 def _migrate_progress(self, vm): - info =3D vm.command("query-migrate") + info =3D vm.cmd("query-migrate") =20 if "ram" not in info: info["ram"] =3D {} @@ -109,7 +109,7 @@ def _migrate(self, hardware, scenario, src, dst, connec= t_uri): src_vcpu_time =3D [] src_pid =3D src.get_pid() =20 - vcpus =3D src.command("query-cpus-fast") + vcpus =3D src.cmd("query-cpus-fast") src_threads =3D [] for vcpu in vcpus: src_threads.append(vcpu["thread-id"]) @@ -128,82 +128,82 @@ def _migrate(self, hardware, scenario, src, dst, conn= ect_uri): if self._verbose: print("Starting migration") if scenario._auto_converge: - resp =3D src.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "auto-converge", - "state": True } - ]) - resp =3D src.command("migrate-set-parameters", - cpu_throttle_increment=3Dscenario._auto_con= verge_step) + resp =3D src.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "auto-converge", + "state": True } + ]) + resp =3D src.cmd("migrate-set-parameters", + cpu_throttle_increment=3Dscenario._auto_converg= e_step) =20 if scenario._post_copy: - resp =3D src.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "postcopy-ram", - "state": True } - ]) - resp =3D dst.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "postcopy-ram", - "state": True } - ]) + resp =3D src.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "postcopy-ram", + "state": True } + ]) + resp =3D dst.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "postcopy-ram", + "state": True } + ]) =20 - resp =3D src.command("migrate-set-parameters", - max_bandwidth=3Dscenario._bandwidth * 1024 * 10= 24) + resp =3D src.cmd("migrate-set-parameters", + max_bandwidth=3Dscenario._bandwidth * 1024 * 1024) =20 - resp =3D src.command("migrate-set-parameters", - downtime_limit=3Dscenario._downtime) + resp =3D src.cmd("migrate-set-parameters", + downtime_limit=3Dscenario._downtime) =20 if scenario._compression_mt: - resp =3D src.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "compress", - "state": True } - ]) - resp =3D src.command("migrate-set-parameters", - compress_threads=3Dscenario._compression_mt= _threads) - resp =3D dst.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "compress", - "state": True } - ]) - resp =3D dst.command("migrate-set-parameters", - decompress_threads=3Dscenario._compression_= mt_threads) + resp =3D src.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "compress", + "state": True } + ]) + resp =3D src.cmd("migrate-set-parameters", + compress_threads=3Dscenario._compression_mt_thr= eads) + resp =3D dst.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "compress", + "state": True } + ]) + resp =3D dst.cmd("migrate-set-parameters", + decompress_threads=3Dscenario._compression_mt_t= hreads) =20 if scenario._compression_xbzrle: - resp =3D src.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "xbzrle", - "state": True } - ]) - resp =3D dst.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "xbzrle", - "state": True } - ]) - resp =3D src.command("migrate-set-parameters", - xbzrle_cache_size=3D( - hardware._mem * - 1024 * 1024 * 1024 / 100 * - scenario._compression_xbzrle_cache)) + resp =3D src.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "xbzrle", + "state": True } + ]) + resp =3D dst.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "xbzrle", + "state": True } + ]) + resp =3D src.cmd("migrate-set-parameters", + xbzrle_cache_size=3D( + hardware._mem * + 1024 * 1024 * 1024 / 100 * + scenario._compression_xbzrle_cache)) =20 if scenario._multifd: - resp =3D src.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "multifd", - "state": True } - ]) - resp =3D src.command("migrate-set-parameters", - multifd_channels=3Dscenario._multifd_channe= ls) - resp =3D dst.command("migrate-set-capabilities", - capabilities =3D [ - { "capability": "multifd", - "state": True } - ]) - resp =3D dst.command("migrate-set-parameters", - multifd_channels=3Dscenario._multifd_channe= ls) + resp =3D src.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "multifd", + "state": True } + ]) + resp =3D src.cmd("migrate-set-parameters", + multifd_channels=3Dscenario._multifd_channels) + resp =3D dst.cmd("migrate-set-capabilities", + capabilities =3D [ + { "capability": "multifd", + "state": True } + ]) + resp =3D dst.cmd("migrate-set-parameters", + multifd_channels=3Dscenario._multifd_channels) =20 - resp =3D src.command("migrate", uri=3Dconnect_uri) + resp =3D src.cmd("migrate", uri=3Dconnect_uri) =20 post_copy =3D False paused =3D False @@ -228,7 +228,7 @@ def _migrate(self, hardware, scenario, src, dst, connec= t_uri): =20 if progress._status in ("completed", "failed", "cancelled"): if progress._status =3D=3D "completed" and paused: - dst.command("cont") + dst.cmd("cont") if progress_history[-1] !=3D progress: progress_history.append(progress) =20 @@ -256,13 +256,13 @@ def _migrate(self, hardware, scenario, src, dst, conn= ect_uri): if progress._ram._iterations > scenario._max_iters: if self._verbose: print("No completion after %d iterations over RAM" % s= cenario._max_iters) - src.command("migrate_cancel") + src.cmd("migrate_cancel") continue =20 if time.time() > (start + scenario._max_time): if self._verbose: print("No completion after %d seconds" % scenario._max= _time) - src.command("migrate_cancel") + src.cmd("migrate_cancel") continue =20 if (scenario._post_copy and @@ -270,7 +270,7 @@ def _migrate(self, hardware, scenario, src, dst, connec= t_uri): not post_copy): if self._verbose: print("Switching to post-copy after %d iterations" % s= cenario._post_copy_iters) - resp =3D src.command("migrate-start-postcopy") + resp =3D src.cmd("migrate-start-postcopy") post_copy =3D True =20 if (scenario._pause and @@ -278,7 +278,7 @@ def _migrate(self, hardware, scenario, src, dst, connec= t_uri): not paused): if self._verbose: print("Pausing VM after %d iterations" % scenario._pau= se_iters) - resp =3D src.command("stop") + resp =3D src.cmd("stop") paused =3D True =20 def _is_ppc64le(self): diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 index d7e67f4a05..f34af6cef7 100755 --- a/tests/qemu-iotests/256 +++ b/tests/qemu-iotests/256 @@ -40,25 +40,25 @@ with iotests.FilePath('img0') as img0_path, \ 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': 0, - })) + log(vm.cmd('blockdev-create', job_id=3D'job1', + options=3D{ + 'driver': 'file', + 'filename': filepath, + 'size': 0, + })) 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, - })) + log(vm.cmd('blockdev-add', driver=3D'file', + node_name=3Dnodename, filename=3Dfilepath)) + log(vm.cmd('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)) + log(vm.cmd('blockdev-add', driver=3Diotests.imgfmt, + node_name=3Dname, + file=3Dnodename)) =20 log('--- Preparing images & VM ---\n') vm.add_object('iothread,id=3Diothread0') diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index e7e7a2317e..7d3720b8e5 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -160,26 +160,26 @@ class Drive: file_node_name =3D "file_{}".format(basename) vm =3D self.vm =20 - log(vm.command('blockdev-create', job_id=3D'bdc-file-job', - options=3D{ - 'driver': 'file', - 'filename': self.path, - 'size': 0, - })) + log(vm.cmd('blockdev-create', job_id=3D'bdc-file-job', + options=3D{ + 'driver': 'file', + 'filename': self.path, + 'size': 0, + })) vm.run_job('bdc-file-job') - log(vm.command('blockdev-add', driver=3D'file', - node_name=3Dfile_node_name, filename=3Dself.path)) + log(vm.cmd('blockdev-add', driver=3D'file', + node_name=3Dfile_node_name, filename=3Dself.path)) =20 - log(vm.command('blockdev-create', job_id=3D'bdc-fmt-job', - options=3D{ - 'driver': fmt, - 'file': file_node_name, - 'size': size, - })) + log(vm.cmd('blockdev-create', job_id=3D'bdc-fmt-job', + options=3D{ + 'driver': fmt, + 'file': file_node_name, + 'size': size, + })) vm.run_job('bdc-fmt-job') - log(vm.command('blockdev-add', driver=3Dfmt, - node_name=3Dname, - file=3Dfile_node_name)) + log(vm.cmd('blockdev-add', driver=3Dfmt, + node_name=3Dname, + file=3Dfile_node_name)) self.fmt =3D fmt self.size =3D size self.node =3D name --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224333; cv=none; d=zohomail.com; s=zohoarc; b=VjDLwarCr9VstWttBPh/PhTpLh1W/l5apuLIl74hoscMVHocqLBI79/FjSlXfIgpcfikEsndYzGQv4LF4oVMK0+iJ2w1BkrDeSZs5fbBp1dtoKMeaiP8XJxO1LwhQObmJRBXqUdf0OwH9f/IZz0ot0iF7OC77qVxMv2qy0juwqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224333; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uuDhxM4tw3ZrDHOQvof7Nf1mZEUGdYjBg+ik6qdLhOo=; b=Az6fbsTG4O5DK0Zm81abQXMF6Za3OYxHEwSBuTzWEIOCAw5LbO8Uyw17qExH8xVZbTDcCC7aeORo7XyZJBnPTWUcSLJqnqfSG8z+VLiyR5rdbvGzUZ6IfNcEO8MJzCx1P+rha5f/fpLuGsd8jbzDBeUy3Qq077NIf3p13jm0JRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224332986161.87363540230012; Fri, 13 Oct 2023 12:12:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYj-0007YS-Mp; Fri, 13 Oct 2023 15:10:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYL-0006zF-GC for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY6-0001v4-Dl for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:29 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551--GPUsllrMQu8pBWWL4nzeg-1; Fri, 13 Oct 2023 15:10:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 462D53813BE0; Fri, 13 Oct 2023 19:10:04 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F2CB40C6CA0; Fri, 13 Oct 2023 19:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uuDhxM4tw3ZrDHOQvof7Nf1mZEUGdYjBg+ik6qdLhOo=; b=KaSzuhcnj7hJtdX3p40jl8Wtp2RyU8kYxuuDEjYeQec5MV+FMypScpkNjqU5vHW49XTone JHqQnH1glHY6XkIdpyFYl/1pTfD/TUEAlhU99CD/cYdl/3AzJXZRuuZmi9IopM5yGmf6wG HcngtEG7nQkGkVeg9d5XjYyKh20WVqg= X-MC-Unique: -GPUsllrMQu8pBWWL4nzeg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 16/25] python/machine.py: upgrade vm.cmd() method Date: Fri, 13 Oct 2023 15:09:31 -0400 Message-ID: <20231013190941.3699288-17-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224333823100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy The method is not popular in iotests, we prefer use vm.qmp() and then check success by hand. But that's not optimal. To simplify movement to vm.cmd() let's support same interface improvements like in vm.qmp(). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-7-vsementsov@yandex-team.ru Signed-off-by: John Snow --- python/qemu/machine/machine.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index eae193eb00..31cb9d617d 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -708,13 +708,23 @@ def qmp(self, cmd: str, return ret =20 def cmd(self, cmd: str, - conv_keys: bool =3D True, + args_dict: Optional[Dict[str, object]] =3D None, + conv_keys: Optional[bool] =3D None, **args: Any) -> QMPReturnValue: """ Invoke a QMP command. On success return the response dict. On failure raise an exception. """ + if args_dict is not None: + assert not args + assert conv_keys is None + args =3D args_dict + conv_keys =3D False + + if conv_keys is None: + conv_keys =3D True + qmp_args =3D self._qmp_args(conv_keys, args) ret =3D self._qmp.cmd(cmd, **qmp_args) if cmd =3D=3D 'quit': --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224619; cv=none; d=zohomail.com; s=zohoarc; b=ZRNYSg0GYGJPQuxdp/Xf4NG7ryM4lhn2qHcnrLHKeMg7GzHSJ8GxljjmsaElUKZJoD1ckiwTiXcIdx9NhFe4YSXBEmgm0YgqlY6Q3TceRpYKx532dtD8na92kfVDjSQsSEzaDZ7iuGs6P7aBSWdh1fZNuz35NELql7yrScBLLto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224619; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k4pDy5yigXAGZndabx5fdFH2aTq3nNUlcYK9vjXYh24=; b=PPeOHTX4IbYIqOdtf86AvtYjXyzTf6xb0+gFakSkfftNbg6cDcoWlGycxcmBIVvMAPZzQ19D7noJA/XPPjvODi+W2ailT+/tQGs4nN1Jem//7+XCVehAuLCvA8NWQUxtaFi1ccyHdLtV2qyo9JwKY0XNFKPp3NHIYZmAUZUCXQ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224619376553.9010202029024; Fri, 13 Oct 2023 12:16:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYO-00076i-H9; Fri, 13 Oct 2023 15:10:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYE-0006nL-65 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY3-0001ss-8z for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-686-IL-wlz9zMDyIhucIn2noLQ-1; Fri, 13 Oct 2023 15:10:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 88303946DC6; Fri, 13 Oct 2023 19:10:05 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5448440C6CA1; Fri, 13 Oct 2023 19:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k4pDy5yigXAGZndabx5fdFH2aTq3nNUlcYK9vjXYh24=; b=HZavqoYQVL1nWdsxSDzVkj3z6q9O69ff8cYDM9bGqfQB/T3DRDDiYsH4t7vi0S39QR+yFg SNFt0hFvUJ3MPop21Y3dn7lZWRdeL79zWhEhjqE5mrYpoJW6tYeIUyn9XDbq5MEiL/KzCT pWICy9z1NYUSyTwmfUP3NjMQ/SPxK6c= X-MC-Unique: IL-wlz9zMDyIhucIn2noLQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 17/25] iotests: QemuStorageDaemon: add cmd() method like in QEMUMachine. Date: Fri, 13 Oct 2023 15:09:32 -0400 Message-ID: <20231013190941.3699288-18-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224621155100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Add similar method for consistency. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-8-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 0c061d8986..ee7b6ddeff 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -38,7 +38,7 @@ from contextlib import contextmanager =20 from qemu.machine import qtest -from qemu.qmp.legacy import QMPMessage, QEMUMonitorProtocol +from qemu.qmp.legacy import QMPMessage, QMPReturnValue, QEMUMonitorProtocol from qemu.utils import VerboseProcessError =20 # Use this logger for logging messages directly from the iotests module @@ -466,6 +466,11 @@ def get_qmp(self) -> QEMUMonitorProtocol: assert self._qmp is not None return self._qmp =20 + def cmd(self, cmd: str, args: Optional[Dict[str, object]] =3D None) \ + -> QMPReturnValue: + assert self._qmp is not None + return self._qmp.cmd(cmd, **(args or {})) + def stop(self, kill_signal=3D15): self._p.send_signal(kill_signal) self._p.wait() --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224619; cv=none; d=zohomail.com; s=zohoarc; b=JpDb0C7csy1ujZmW6IFoQqgKxEvVuz+PWx/BLqTRngu2X/b9lwte8N4nFw5bV78demEHrwt//jJcg98T8Sf1ridN/kVATsWOv+iAheUrbnRpuNFkdL1Zez/IrNA1x6gOMpq/iJuw+MOSrb4a9H21xlsIHxVYWbpWWUfEH0AN+yM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224619; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TtNimDUsefImovHXVp8syBkyrwupdL7YbGpeWdTSkQQ=; b=aMemfYOld9mRo5QpnAaqBGuvEO3DocWrliVSQSTNj70SxZl3WBm6exiKh5e0hAq4r8iA9WxASPER5snQEfhPoOmGKy6ayOXeUZGfstEHnNQpaHFV41QVvCZcn3hhUxwyz7lBWRtqD2XQ8DPavcfF66vnYkPGtnWLofjdfdO+i6Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224619936194.67835776726633; Fri, 13 Oct 2023 12:16:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYK-0006ws-3V; Fri, 13 Oct 2023 15:10:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYI-0006uZ-Er for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY5-0001tW-2X for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:25 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-18-agokJHyGOXWSNSIbC45TNw-1; Fri, 13 Oct 2023 15:10:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C69063813BE3; Fri, 13 Oct 2023 19:10:06 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 955AF40C6CA0; Fri, 13 Oct 2023 19:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TtNimDUsefImovHXVp8syBkyrwupdL7YbGpeWdTSkQQ=; b=OVXAYIcoGhuIt60RUv0JKLS/G+gLTZxMCQH9weeUw1CAtF6zU6AGvuYOV0f2tv1VDl1fOR bGYxja+SiUKS+oz8b9d8s8K/V77Y3M2FhV6a5L8Zw22mtdBTx3NQWbYIbR1S5egEpGXZ8E EU8W8qIdpATX205wXdHRce3A3+CR8y0= X-MC-Unique: agokJHyGOXWSNSIbC45TNw-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 18/25] iotests: add some missed checks of qmp result Date: Fri, 13 Oct 2023 15:09:33 -0400 Message-ID: <20231013190941.3699288-19-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224621164100004 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-9-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/qemu-iotests/041 | 1 + tests/qemu-iotests/151 | 1 + tests/qemu-iotests/152 | 2 ++ tests/qemu-iotests/tests/migrate-bitmaps-test | 2 ++ 4 files changed, 6 insertions(+) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 8429958bf0..4d7a829b65 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -1087,6 +1087,7 @@ class TestRepairQuorum(iotests.QMPTestCase): result =3D self.vm.qmp('blockdev-snapshot-sync', node_name=3D'img1= ', snapshot_file=3Dquorum_snapshot_file, snapshot_node_name=3D"snap1"); + self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D"img1", diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index b4d1bc2553..668d0c1e9c 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -159,6 +159,7 @@ class TestActiveMirror(iotests.QMPTestCase): sync=3D'full', copy_mode=3D'write-blocking', speed=3D1) + self.assert_qmp(result, 'return', {}) =20 self.vm.hmp_qemu_io('source', 'break write_aio A') self.vm.hmp_qemu_io('source', 'aio_write 0 1M') # 1 diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index 4e179c340f..b73a0d08a2 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -43,6 +43,7 @@ class TestUnaligned(iotests.QMPTestCase): def test_unaligned(self): result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', granularity=3D65536, target=3Dtarget_img) + self.assert_qmp(result, 'return', {}) self.complete_and_wait() self.vm.shutdown() self.assertEqual(iotests.image_size(test_img), iotests.image_size(= target_img), @@ -51,6 +52,7 @@ class TestUnaligned(iotests.QMPTestCase): def test_unaligned_with_update(self): result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', granularity=3D65536, target=3Dtarget_img) + self.assert_qmp(result, 'return', {}) self.wait_ready() self.vm.hmp_qemu_io('drive0', 'write 0 512') self.complete_and_wait(wait_ready=3DFalse) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index 59f3357580..8668caae1e 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -101,6 +101,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): sha256 =3D get_bitmap_hash(self.vm_a) =20 result =3D self.vm_a.qmp('migrate', uri=3Dmig_cmd) + self.assert_qmp(result, 'return', {}) while True: event =3D self.vm_a.event_wait('MIGRATION') if event['data']['status'] =3D=3D 'completed': @@ -176,6 +177,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) =20 result =3D self.vm_a.qmp('migrate', uri=3Dmig_cmd) + self.assert_qmp(result, 'return', {}) while True: event =3D self.vm_a.event_wait('MIGRATION') if event['data']['status'] =3D=3D 'completed': --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224431; cv=none; d=zohomail.com; s=zohoarc; b=TKnEyvBikkhfoT/750HSoS4530i7ylF6ss74ZuI+zDe739+5sy9gXcPGmJsGn0p6SDFlZLH12XujRllNjMQPlM1CSh4jJR+BqSJW2sNAp1aoBWHK8l8wozVkhfvxgBT4E5nDrhRdLxo35ejkWILLSp2Yxnw0PDplA147/pLNVQw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224431; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fRbQdUoUUQhlqnazahcRbiRmsy6tNXpHFEKPBYJkfGM=; b=Ad2H1SemUuuYMJXWD39rOaW8oaF1Wg9wKBfxVDC3rARN8h+eLxIbEITv9/55GwU0hDx+u0rxDbgvDqW3cIDfkmueqB2DubWzbCVHlo5tP9WmPWeU7Lo/pULBuuxzClD3MWiz51CEbDIh2AXJEvo73vTpWepAKMoDnTQpn/7N7UQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224431267168.23976723846283; Fri, 13 Oct 2023 12:13:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYM-00071X-EQ; Fri, 13 Oct 2023 15:10:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYK-0006xJ-9H for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNY5-0001tI-4K for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:28 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-rH71-VLmP0inEv2-a89V9w-1; Fri, 13 Oct 2023 15:10:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F1AB85A5BA; Fri, 13 Oct 2023 19:10:08 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id D495040C6CA0; Fri, 13 Oct 2023 19:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fRbQdUoUUQhlqnazahcRbiRmsy6tNXpHFEKPBYJkfGM=; b=C35rhV/9tYX+fGmS7ejOM1osjwUPHF5kXEb9tWRYBNfblKCmoGM81zxMZK492rUrVboU28 Tr7b1c3Nav50ZjLBnUmowIANwLOMUdUYHPRPkoExcS1IpXxnkOMBEEKpaluguulccWmCz4 XAc4QdQ2S4uS2w6JjeHPaC0VIKtlKc8= X-MC-Unique: rH71-VLmP0inEv2-a89V9w-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 19/25] iotests: refactor some common qmp result checks into generic pattern Date: Fri, 13 Oct 2023 15:09:34 -0400 Message-ID: <20231013190941.3699288-20-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224432428100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy To simplify further conversion. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-10-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/qemu-iotests/040 | 3 ++- tests/qemu-iotests/147 | 3 ++- tests/qemu-iotests/155 | 4 ++-- tests/qemu-iotests/218 | 4 ++-- tests/qemu-iotests/296 | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index 5601a4873c..e61e7f2433 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -62,9 +62,10 @@ class ImageCommitTestCase(iotests.QMPTestCase): self.assert_no_active_block_jobs() if node_names: result =3D self.vm.qmp('block-commit', device=3D'drive0', top_= node=3Dtop, base_node=3Dbase) + self.assert_qmp(result, 'return', {}) else: result =3D self.vm.qmp('block-commit', device=3D'drive0', top= =3Dtop, base=3Dbase) - self.assert_qmp(result, 'return', {}) + self.assert_qmp(result, 'return', {}) self.wait_for_complete(need_ready) =20 def run_default_commit_test(self): diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 47dfa62e6b..770b73e2f4 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -159,10 +159,11 @@ class BuiltinNBD(NBDBlockdevAddBase): =20 if export_name is None: result =3D self.server.qmp('nbd-server-add', device=3D'nbd-exp= ort') + self.assert_qmp(result, 'return', {}) else: result =3D self.server.qmp('nbd-server-add', device=3D'nbd-exp= ort', name=3Dexport_name) - self.assert_qmp(result, 'return', {}) + self.assert_qmp(result, 'return', {}) =20 if export_name2 is not None: result =3D self.server.qmp('nbd-server-add', device=3D'nbd-exp= ort', diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index eadda52615..d3e1b7401e 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -181,6 +181,7 @@ class MirrorBaseClass(BaseClass): result =3D self.vm.qmp(self.cmd, job_id=3D'mirror-job', device= =3D'source', sync=3Dsync, target=3D'target', auto_finalize=3DFalse) + self.assert_qmp(result, 'return', {}) else: if self.existing: mode =3D 'existing' @@ -190,8 +191,7 @@ class MirrorBaseClass(BaseClass): sync=3Dsync, target=3Dtarget_img, format=3Diotests.imgfmt, mode=3Dmode, node_name=3D'target', auto_finalize=3DFal= se) - - self.assert_qmp(result, 'return', {}) + self.assert_qmp(result, 'return', {}) =20 self.vm.run_job('mirror-job', auto_finalize=3DFalse, pre_finalize=3Dself.openBacking, auto_dismiss=3DTr= ue) diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218 index 6320c4cb56..5e74c55b6a 100755 --- a/tests/qemu-iotests/218 +++ b/tests/qemu-iotests/218 @@ -61,14 +61,14 @@ def start_mirror(vm, speed=3DNone, buf_size=3DNone): sync=3D'full', speed=3Dspeed, buf_size=3Dbuf_size) + assert ret['return'] =3D=3D {} else: ret =3D vm.qmp('blockdev-mirror', job_id=3D'mirror', device=3D'source', target=3D'target', sync=3D'full') - - assert ret['return'] =3D=3D {} + assert ret['return'] =3D=3D {} =20 =20 log('') diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296 index 0d21b740a7..19a674c5ae 100755 --- a/tests/qemu-iotests/296 +++ b/tests/qemu-iotests/296 @@ -133,9 +133,10 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): =20 if reOpen: result =3D vm.qmp(command, options=3D[opts]) + self.assert_qmp(result, 'return', {}) else: result =3D vm.qmp(command, **opts) - self.assert_qmp(result, 'return', {}) + self.assert_qmp(result, 'return', {}) =20 =20 ######################################################################= ##### --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224689; cv=none; d=zohomail.com; s=zohoarc; b=Vdk9kTRIutknmVkxB99qnfD+kNg1Cb1X02hruJcIhBX6Ur6dOb60J57cJL2EGflZmjUPcAO5sMeK8cPjihHvRbqz048Kk5yhkqMeWAf95X9GtH1i3smk6utvSW7lCm0TcQHN8WB1t0n8Y0ctKKNuFq51jE+GNkSsubbH4su+WmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224689; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=53951AoCRNqJfPwSZJq6G6UHINEJn70d5VTn2T0IpB0=; b=Egi6zpNBcxNZVvTmgVBe3DAmVtOX+8J8pzVLG3BxF+w8qzjGOjiciwxgmqV8dBvOSbxiA4cMH1u4r3JwG8QZeHZrMS18GtMDKzSW7QEUuM6aARImliGqbPNSFLUiepbORT1gaKpSUKdNQ+0dgcN5ks+KfTAQbpHY+2HexTSk6IM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224689727897.577697234784; Fri, 13 Oct 2023 12:18:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYn-0007yi-6s; Fri, 13 Oct 2023 15:10:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYS-0007Gg-AM for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYB-0001w7-TR for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-6CwphJhfNxugoiuqchw5fA-1; Fri, 13 Oct 2023 15:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 568571029F40; Fri, 13 Oct 2023 19:10:09 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2285F40C6F79; Fri, 13 Oct 2023 19:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=53951AoCRNqJfPwSZJq6G6UHINEJn70d5VTn2T0IpB0=; b=BVWPend0P85sCpLyilJwWo8RgQEnmw+25CkX2gpiS/UZtiLWdwGJf0y3FBmQJOABlJU5dD UCE2+kYd9bUluwsbo7YYgXoQfnb5xz8C+zBw6X0jzqqKmKq3ywj7z/eeKF66ouEArj4eE8 wJkAbTNJaAtgnpeTtlHS7bEcwGGFhLQ= X-MC-Unique: 6CwphJhfNxugoiuqchw5fA-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 20/25] iotests: drop some extra semicolons Date: Fri, 13 Oct 2023 15:09:35 -0400 Message-ID: <20231013190941.3699288-21-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224691390100007 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-11-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/qemu-iotests/041 | 2 +- tests/qemu-iotests/196 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 4d7a829b65..550e4dc391 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -1086,7 +1086,7 @@ class TestRepairQuorum(iotests.QMPTestCase): def test_after_a_quorum_snapshot(self): result =3D self.vm.qmp('blockdev-snapshot-sync', node_name=3D'img1= ', snapshot_file=3Dquorum_snapshot_file, - snapshot_node_name=3D"snap1"); + snapshot_node_name=3D"snap1") self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 index 76509a5ad1..27c1629be3 100755 --- a/tests/qemu-iotests/196 +++ b/tests/qemu-iotests/196 @@ -46,7 +46,7 @@ class TestInvalidateAutoclear(iotests.QMPTestCase): =20 def test_migration(self): result =3D self.vm_a.qmp('migrate', uri=3D'exec:cat>' + migfile) - self.assert_qmp(result, 'return', {}); + self.assert_qmp(result, 'return', {}) self.assertNotEqual(self.vm_a.event_wait("STOP"), None) =20 with open(disk, 'r+b') as f: --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224329; cv=none; d=zohomail.com; s=zohoarc; b=lqUapndDOqgOoCYrbX1oN+vl8hnp3I0IXfAWE9jm4BttznAIH7HxsVBP3qVrer3jTKSqODoB8yJBJL5xc8Mx7IGOQv6Pdp4SIjl+tNMqqskd5cNI7b+/6QQVVX6l4sc5/SoaYQChFjm2DmWeDFZ57ndVleGSzXxk9qA39F9U1Lg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224329; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oa109OK3W3Uo1tZYdj4EWbflCM+wicoxKWR+Wm3G+Zk=; b=GBzNk0AaZUn8A0DUulk8px6jyHw83r5V1M91QcJPrdwaVFDHo5oUtvV7adrRZN426vOEGykWydeUSw6kxjosAenkswoPKt4IPhn0LQFWV9AANMcNrviJ5B138yF8kA3VdnZLdFSzp82oCVzRL4Bq4zylnbXTwLNepxns3rKc9Xk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169722432954831.04315542262816; Fri, 13 Oct 2023 12:12:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYo-00087R-FU; Fri, 13 Oct 2023 15:10:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYV-0007JM-Is for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYI-0001zj-Co for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:39 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-526-tNIi7r6GNDK3D_TeOkP1rQ-1; Fri, 13 Oct 2023 15:10:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B32B3813BDB; Fri, 13 Oct 2023 19:10:10 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65D2740C6CA0; Fri, 13 Oct 2023 19:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oa109OK3W3Uo1tZYdj4EWbflCM+wicoxKWR+Wm3G+Zk=; b=OkAwSEbei0lYyW7532rOElCkkuuk7tPGpngDXg5AnzI73NsWnWIms367JpcytpTQWb/7Y0 26uylJ1157o3M6UJ0H7ZJ027hNPxlRkZ1sZt//CW59tLbl87hXcuCJiWyYygLb9Ldn4ZR+ b68mtyym3nIajJa/v8rZS3uImlyDdns= X-MC-Unique: tNIi7r6GNDK3D_TeOkP1rQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 21/25] iotests: drop some extra ** in qmp() call Date: Fri, 13 Oct 2023 15:09:36 -0400 Message-ID: <20231013190941.3699288-22-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224329876100002 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy qmp() method supports passing dict (if it doesn't need substituting '_' to '-' in keys). So, drop some extra '**' operators. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-12-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/qemu-iotests/040 | 4 +- tests/qemu-iotests/041 | 14 +++--- tests/qemu-iotests/129 | 2 +- tests/qemu-iotests/147 | 2 +- tests/qemu-iotests/155 | 2 +- tests/qemu-iotests/264 | 12 ++--- tests/qemu-iotests/295 | 5 +- tests/qemu-iotests/296 | 15 +++--- tests/qemu-iotests/tests/migrate-bitmaps-test | 4 +- .../tests/mirror-ready-cancel-error | 50 +++++++++---------- 10 files changed, 54 insertions(+), 56 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index e61e7f2433..4b8bf09a5d 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -774,7 +774,7 @@ class TestCommitWithFilters(iotests.QMPTestCase): result =3D self.vm.qmp('object-add', qom_type=3D'throttle-group', = id=3D'tg') self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-add', **{ + result =3D self.vm.qmp('blockdev-add', { 'node-name': 'top-filter', 'driver': 'throttle', 'throttle-group': 'tg', @@ -935,7 +935,7 @@ class TestCommitWithOverriddenBacking(iotests.QMPTestCa= se): self.vm.launch() =20 # Use base_b instead of base_a as the backing of top - result =3D self.vm.qmp('blockdev-add', **{ + result =3D self.vm.qmp('blockdev-add', { 'node-name': 'top', 'driver': iotests.imgfmt, 'file': { diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 550e4dc391..3aef42aec8 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -236,7 +236,7 @@ class TestSingleBlockdev(TestSingleDrive): args =3D {'driver': iotests.imgfmt, 'node-name': self.qmp_target, 'file': { 'filename': target_img, 'driver': 'file' } } - result =3D self.vm.qmp("blockdev-add", **args) + result =3D self.vm.qmp("blockdev-add", args) self.assert_qmp(result, 'return', {}) =20 def test_mirror_to_self(self): @@ -963,7 +963,7 @@ class TestRepairQuorum(iotests.QMPTestCase): #assemble the quorum block device from the individual files args =3D { "driver": "quorum", "node-name": "quorum0", "vote-threshold": 2, "children": [ "img0", "img1", "img2"= ] } - result =3D self.vm.qmp("blockdev-add", **args) + result =3D self.vm.qmp("blockdev-add", args) self.assert_qmp(result, 'return', {}) =20 =20 @@ -1278,7 +1278,7 @@ class TestReplaces(iotests.QMPTestCase): """ Check that we can replace filter nodes. """ - result =3D self.vm.qmp('blockdev-add', **{ + result =3D self.vm.qmp('blockdev-add', { 'driver': 'copy-on-read', 'node-name': 'filter0', 'file': { @@ -1319,7 +1319,7 @@ class TestFilters(iotests.QMPTestCase): self.vm =3D iotests.VM().add_device('virtio-scsi,id=3Dvio-scsi') self.vm.launch() =20 - result =3D self.vm.qmp('blockdev-add', **{ + result =3D self.vm.qmp('blockdev-add', { 'node-name': 'target', 'driver': iotests.imgfmt, 'file': { @@ -1355,7 +1355,7 @@ class TestFilters(iotests.QMPTestCase): os.remove(backing_img) =20 def test_cor(self): - result =3D self.vm.qmp('blockdev-add', **{ + result =3D self.vm.qmp('blockdev-add', { 'node-name': 'filter', 'driver': 'copy-on-read', 'file': self.filterless_chain @@ -1384,7 +1384,7 @@ class TestFilters(iotests.QMPTestCase): assert target_map[1]['depth'] =3D=3D 0 =20 def test_implicit_mirror_filter(self): - result =3D self.vm.qmp('blockdev-add', **self.filterless_chain) + result =3D self.vm.qmp('blockdev-add', self.filterless_chain) self.assert_qmp(result, 'return', {}) =20 # We need this so we can query from above the mirror node @@ -1418,7 +1418,7 @@ class TestFilters(iotests.QMPTestCase): def test_explicit_mirror_filter(self): # Same test as above, but this time we give the mirror filter # a node-name so it will not be invisible - result =3D self.vm.qmp('blockdev-add', **self.filterless_chain) + result =3D self.vm.qmp('blockdev-add', self.filterless_chain) self.assert_qmp(result, 'return', {}) =20 # We need this so we can query from above the mirror node diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 index c75ec62ecf..e1536ee3c3 100755 --- a/tests/qemu-iotests/129 +++ b/tests/qemu-iotests/129 @@ -87,7 +87,7 @@ class TestStopWithBlockJob(iotests.QMPTestCase): iotests.qemu_img('create', '-f', iotests.imgfmt, self.overlay_img, '1G') =20 - result =3D self.vm.qmp('blockdev-add', **{ + result =3D self.vm.qmp('blockdev-add', { 'node-name': 'overlay', 'driver': iotests.imgfmt, 'file': { diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 770b73e2f4..08111c5108 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -58,7 +58,7 @@ class NBDBlockdevAddBase(iotests.QMPTestCase): def client_test(self, filename, address, export=3DNone, node_name=3D'nbd-blockdev', delete=3DTrue): bao =3D self.blockdev_add_options(address, export, node_name) - result =3D self.vm.qmp('blockdev-add', **bao) + result =3D self.vm.qmp('blockdev-add', bao) self.assert_qmp(result, 'return', {}) =20 found =3D False diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index d3e1b7401e..0c073fd61b 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -110,7 +110,7 @@ class BaseClass(iotests.QMPTestCase): elif self.target_blockdev_backing: options['backing'] =3D self.target_blockdev_backing =20 - result =3D self.vm.qmp('blockdev-add', **options) + result =3D self.vm.qmp('blockdev-add', options) self.assert_qmp(result, 'return', {}) =20 def tearDown(self): diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index 289381e315..d44deb673a 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -49,12 +49,12 @@ class TestNbdReconnect(iotests.QMPTestCase): assert job in ('blockdev-backup', 'blockdev-mirror') with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): result =3D self.vm.qmp('blockdev-add', - **{'node_name': 'backup0', - 'driver': 'raw', - 'file': {'driver': 'nbd', - 'server': {'type': 'unix', - 'path': nbd_sock}, - 'reconnect-delay': 10}}) + {'node-name': 'backup0', + 'driver': 'raw', + 'file': {'driver': 'nbd', + 'server': {'type': 'unix', + 'path': nbd_sock}, + 'reconnect-delay': 10}}) self.assert_qmp(result, 'return', {}) result =3D self.vm.qmp(job, device=3D'drive0', sync=3D'full', target=3D'backup0', diff --git a/tests/qemu-iotests/295 b/tests/qemu-iotests/295 index 270ad3999f..8ebe31054c 100755 --- a/tests/qemu-iotests/295 +++ b/tests/qemu-iotests/295 @@ -102,8 +102,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): } } =20 - result =3D self.vm.qmp('blockdev-add', ** - { + result =3D self.vm.qmp('blockdev-add', { 'driver': iotests.imgfmt, 'node-name': id, 'read-only': read_only, @@ -120,7 +119,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): =20 # close the encrypted block device def closeImageQmp(self, id): - result =3D self.vm.qmp('blockdev-del', **{ 'node-name': id }) + result =3D self.vm.qmp('blockdev-del', {'node-name': id}) self.assert_qmp(result, 'return', {}) =20 ######################################################################= ##### diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296 index 19a674c5ae..47d2526b72 100755 --- a/tests/qemu-iotests/296 +++ b/tests/qemu-iotests/296 @@ -42,7 +42,7 @@ class Secret: return [ "secret,id=3D" + self._id + ",data=3D" + self._secret] =20 def to_qmp_object(self): - return { "qom_type" : "secret", "id": self.id(), + return { "qom-type" : "secret", "id": self.id(), "data": self.secret() } =20 ##########################################################################= ###### @@ -61,9 +61,9 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): # create the secrets and load 'em into the VMs self.secrets =3D [ Secret(i) for i in range(0, 4) ] for secret in self.secrets: - result =3D self.vm1.qmp("object-add", **secret.to_qmp_object()) + result =3D self.vm1.qmp("object-add", secret.to_qmp_object()) self.assert_qmp(result, 'return', {}) - result =3D self.vm2.qmp("object-add", **secret.to_qmp_object()) + result =3D self.vm2.qmp("object-add", secret.to_qmp_object()) self.assert_qmp(result, 'return', {}) =20 # test case shutdown @@ -135,15 +135,14 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): result =3D vm.qmp(command, options=3D[opts]) self.assert_qmp(result, 'return', {}) else: - result =3D vm.qmp(command, **opts) + result =3D vm.qmp(command, opts) self.assert_qmp(result, 'return', {}) =20 =20 ######################################################################= ##### # add virtio-blk consumer for a block device def addImageUser(self, vm, id, disk_id, share_rw=3DFalse): - result =3D vm.qmp('device_add', ** - { + result =3D vm.qmp('device_add', { 'driver': 'virtio-blk', 'id': id, 'drive': disk_id, @@ -155,7 +154,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): =20 # close the encrypted block device def closeImageQmp(self, vm, id): - result =3D vm.qmp('blockdev-del', **{ 'node-name': id }) + result =3D vm.qmp('blockdev-del', {'node-name': id}) self.assert_qmp(result, 'return', {}) =20 ######################################################################= ##### @@ -174,7 +173,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): }, } =20 - result =3D vm.qmp('x-blockdev-amend', **args) + result =3D vm.qmp('x-blockdev-amend', args) iotests.log(result) # Run the job only if it was created event =3D ('JOB_STATUS_CHANGE', diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index 8668caae1e..eebb256485 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -67,7 +67,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if persistent: params['persistent'] =3D True =20 - result =3D vm.qmp('block-dirty-bitmap-add', **params) + result =3D vm.qmp('block-dirty-bitmap-add', params) self.assert_qmp(result, 'return', {}) =20 def check_bitmap(self, vm, sha256): @@ -256,7 +256,7 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestCa= se): self.vm =3D iotests.VM() self.vm.launch() =20 - result =3D self.vm.qmp('blockdev-add', **blockdev) + result =3D self.vm.qmp('blockdev-add', blockdev) self.assert_qmp(result, 'return', {}) =20 # Check that the bitmaps are there diff --git a/tests/qemu-iotests/tests/mirror-ready-cancel-error b/tests/qem= u-iotests/tests/mirror-ready-cancel-error index 01217459b9..a59e245659 100755 --- a/tests/qemu-iotests/tests/mirror-ready-cancel-error +++ b/tests/qemu-iotests/tests/mirror-ready-cancel-error @@ -49,12 +49,12 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): =20 def add_blockdevs(self, once: bool) -> None: res =3D self.vm.qmp('blockdev-add', - **{'node-name': 'source', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': source - }}) + {'node-name': 'source', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': source + }}) self.assert_qmp(res, 'return', {}) =20 # blkdebug notes: @@ -63,25 +63,25 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): # when the job is about to complete, and we want that one to # fail. res =3D self.vm.qmp('blockdev-add', - **{'node-name': 'target', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'blkdebug', - 'image': { - 'driver': 'file', - 'filename': target - }, - 'set-state': [{ - 'event': 'flush_to_disk', - 'state': 1, - 'new_state': 2 - }], - 'inject-error': [{ - 'event': 'flush_to_disk', - 'once': once, - 'immediately': True, - 'state': 2 - }]}}) + {'node-name': 'target', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'blkdebug', + 'image': { + 'driver': 'file', + 'filename': target + }, + 'set-state': [{ + 'event': 'flush_to_disk', + 'state': 1, + 'new_state': 2 + }], + 'inject-error': [{ + 'event': 'flush_to_disk', + 'once': once, + 'immediately': True, + 'state': 2 + }]}}) self.assert_qmp(res, 'return', {}) =20 def start_mirror(self) -> None: --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224350; cv=none; d=zohomail.com; s=zohoarc; b=kPgT5Um7gOWg/iVR0oeqV8S0va0RYpni0y8Wh6Lt0UzwQa9DIkbB6j7P3cRBTIaBfT2shtiNaRhJd9zBp/bamJ17hkIvMf7AECmfCzlYd8MqXMYKd83Lah6qQGNXuqFhopWuW4TsEs58MGwZJRjdy78OTUmL3bWq2KMlPZLe8Go= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224350; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TQTYOTWid1Fw+cf9QBy9KAEHE/HDVmmzcztVlOI0G7g=; b=aekOyOdGNQiyBj9WH+5F0RLppqYb8GgP01pLt8ee1euvrKh8aviKjF3ExfYNVwkPtIgPD7KdCXul/paYnzSfQ42/Jh4uCxjfCDs97V2NVxU8q+ByPsNoxAlxRuxQ4Q4cWsHNs2wHN9BMLdAoKWeWoEXpJsJYJA61CQzhOZxdmTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224350691986.1709561044073; Fri, 13 Oct 2023 12:12:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYj-0007Xp-I6; Fri, 13 Oct 2023 15:10:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYQ-0007D8-Ic for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYB-0001we-HJ for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:34 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-689-AOwaVW6NOKiQVa8kAEaogQ-1; Fri, 13 Oct 2023 15:10:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE2D21C00D1F; Fri, 13 Oct 2023 19:10:11 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A80F040C6CA0; Fri, 13 Oct 2023 19:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TQTYOTWid1Fw+cf9QBy9KAEHE/HDVmmzcztVlOI0G7g=; b=QW/2kXwJTIj3rccfe0ZyEHj3PKOE6NckSK3Mb7QHK7u783VNv/Fwdk6r2y5+jYlW+/afkf PeJYpQFVN/UfqSjyUoZfsWHcvjhGVrdK9OqR6TEcFasGCy9W+ekqACbqeuyZk979GI2oXf owN4fQw6J8h6IxAB7laBy2ylz705grs= X-MC-Unique: AOwaVW6NOKiQVa8kAEaogQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 22/25] iotests.py: pause_job(): drop return value Date: Fri, 13 Oct 2023 15:09:37 -0400 Message-ID: <20231013190941.3699288-23-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224351917100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy The returned value is unused. It's simple to check by command git grep -B 3 '\.pause_job(' Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-13-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ee7b6ddeff..f43814e802 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1338,8 +1338,7 @@ def pause_job(self, job_id=3D'job0', wait=3DTrue): result =3D self.vm.qmp('block-job-pause', device=3Djob_id) self.assert_qmp(result, 'return', {}) if wait: - return self.pause_wait(job_id) - return result + self.pause_wait(job_id) =20 def case_skip(self, reason): '''Skip this test case''' --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224687; cv=none; d=zohomail.com; s=zohoarc; b=VE8Ef7sXa2F5uglZHNqGhFrbP1P0VDnjvNBi7FZsrQPHkX60dBsVEU6y79ZiBkqrSyuZRIb43PPU4L1to2c2SHLimCPnJe/ujUj1ZdyhPR+4UkzMgpRyt0vf8G5NLCJQioHqUlnxumkJvSackJAmpFFima85Atz1QnG7p363Bzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224687; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1+ZZC3bykVxdgOH9/pQEMomsenatIinVGwwEBZIBiPg=; b=auiy18QOPIBhbsZ93OI6KqNWpqYz6Dl36I/AlthBWzNreaNsUwWP5GEgrgJDA4uILbNphLTTXw4f4k6Bpae8CcFdwKmWFOVtEhGouD5MGuw2myRZOzibZVQPHeLDFjAT8d86IdE6X763xvPjQ34jouVaTxt8DIGfOq7MKWzxlIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224687354307.6914913629719; Fri, 13 Oct 2023 12:18:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYn-000811-K5; Fri, 13 Oct 2023 15:10:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYU-0007Hn-Vg for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYC-0001xI-U3 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:37 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-495-DJNftSlSMzu147xcnQjrFA-1; Fri, 13 Oct 2023 15:10:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 39424805BC3; Fri, 13 Oct 2023 19:10:13 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC16040C6CA0; Fri, 13 Oct 2023 19:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1+ZZC3bykVxdgOH9/pQEMomsenatIinVGwwEBZIBiPg=; b=gqkMR5HhbnOmDX0yV+bgxhMDN79NM3Cj1mI8vWus7wc5pCQWAgqMEc+veC28ATWQ9ORqei MiO06gkeW81IHVpTE2nSQFsnvAUd/ps19kqpJl3yuVqY0+ZJ4h8k3wvGaKXKJYYLBP2lBK 7wv0iXT9gWFf/hY0x25VY1mFGjM3jrY= X-MC-Unique: DJNftSlSMzu147xcnQjrFA-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 23/25] tests/vm/basevm.py: use cmd() instead of qmp() Date: Fri, 13 Oct 2023 15:09:38 -0400 Message-ID: <20231013190941.3699288-24-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224689365100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We don't expect failure here and need 'result' object. cmd() is better in this case. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-14-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/vm/basevm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index a97e23b0ce..8aef4cff96 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -312,8 +312,8 @@ def boot(self, img, extra_args=3D[]): self._guest =3D guest # Init console so we can start consuming the chars. self.console_init() - usernet_info =3D guest.qmp("human-monitor-command", - command_line=3D"info usernet").get("retur= n") + usernet_info =3D guest.cmd("human-monitor-command", + command_line=3D"info usernet") self.ssh_port =3D get_info_usernet_hostfwd_port(usernet_info) if not self.ssh_port: raise Exception("Cannot find ssh port from 'info usernet':\n%s= " % \ --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224722; cv=none; d=zohomail.com; s=zohoarc; b=UK7jcm/2Omzc9jU/cO6iWPaqhdd9QOgKbaAIpWHVkrw7IUm6vh3RqkMxBkkxnKnILr9l+8wH7o/Tjbd0RGNorseXLImdURHEcRYhtww4oYvKS+d3UkUF46GDN2PG/5HVHWRkFnOmu7l/Dwvt+yBgis0iuV7dosN+L5xfh+TgToo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224722; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l3ZfV/fIoupB5gtPZYjLu0l1bdDmtHuAyzmyVWMACA0=; b=PNG/IcWADGaGdSjsMNoQDjE2cd2S3eLZJko47bUhmsIpTk2c3dJ9Kt5bBq8PqIztlEDjjrSp1SvTmB6G9+rEJvt9KpshOmn7XFXOVrWMFH4RLTy8UGsjoYKC0NJ+msnWNhVkVA+jMVwsHQparJ9mcNse6u4uOjF/Q7A8e3bvlbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697224722645737.7426506856516; Fri, 13 Oct 2023 12:18:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYj-0007Xo-HL; Fri, 13 Oct 2023 15:10:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYS-0007G0-1X for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYB-0001xQ-PV for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:35 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-67-EgbJ9dRYO66VQWyj2jZQ9w-1; Fri, 13 Oct 2023 15:10:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9064E281294C; Fri, 13 Oct 2023 19:10:14 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4437140C6CA0; Fri, 13 Oct 2023 19:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l3ZfV/fIoupB5gtPZYjLu0l1bdDmtHuAyzmyVWMACA0=; b=GRTWXk+Mpp9Bo9lVWdv4PsZ+UINx7iKrO8cbJOu/gwM1i+vC0zhFUOKrV7Q4TRsTSRM510 JOwlGLLDPnh2h3bdEZc30+sPW0j4Df6di/S5u0KMb7BFnGdEmOzGH8bKU/byNY53OtfoXH ud0BnyAmGKdahRvbSUZ0b9vqoI+MD44= X-MC-Unique: EgbJ9dRYO66VQWyj2jZQ9w-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 24/25] scripts: add python_qmp_updater.py Date: Fri, 13 Oct 2023 15:09:39 -0400 Message-ID: <20231013190941.3699288-25-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224723527100007 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy A script, to update the pattern result =3D self.vm.qmp(...) self.assert_qmp(result, 'return', {}) (and some similar ones) into self.vm.cmd(...) Used in the next commit "python: use vm.cmd() instead of vm.qmp() where appropriate" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-15-vsementsov@yandex-team.ru Signed-off-by: John Snow --- scripts/python_qmp_updater.py | 136 ++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100755 scripts/python_qmp_updater.py diff --git a/scripts/python_qmp_updater.py b/scripts/python_qmp_updater.py new file mode 100755 index 0000000000..494a169812 --- /dev/null +++ b/scripts/python_qmp_updater.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +# +# Intended usage: +# +# git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py +# + +import re +import sys +from typing import Optional + +start_reg =3D re.compile(r'^(?P *)(?P\w+) =3D (?P.*).qmp= \(', + flags=3Dre.MULTILINE) + +success_reg_templ =3D re.sub('\n *', '', r""" + (\n*{padding}(?P\#.*$))? + \n*{padding} + ( + self.assert_qmp\({res},\ 'return',\ {{}}\) + | + assert\ {res}\['return'\]\ =3D=3D\ {{}} + | + assert\ {res}\ =3D=3D\ {{'return':\ {{}}}} + | + self.assertEqual\({res}\['return'\],\ {{}}\) + )""") + +some_check_templ =3D re.sub('\n *', '', r""" + (\n*{padding}(?P\#.*$))? + \s*self.assert_qmp\({res},""") + + +def tmatch(template: str, text: str, + padding: str, res: str) -> Optional[re.Match[str]]: + return re.match(template.format(padding=3Dpadding, res=3Dres), text, + flags=3Dre.MULTILINE) + + +def find_closing_brace(text: str, start: int) -> int: + """ + Having '(' at text[start] search for pairing ')' and return its index. + """ + assert text[start] =3D=3D '(' + + height =3D 1 + + for i in range(start + 1, len(text)): + if text[i] =3D=3D '(': + height +=3D 1 + elif text[i] =3D=3D ')': + height -=3D 1 + if height =3D=3D 0: + return i + + raise ValueError + + +def update(text: str) -> str: + result =3D '' + + while True: + m =3D start_reg.search(text) + if m is None: + result +=3D text + break + + result +=3D text[:m.start()] + + args_ind =3D m.end() + args_end =3D find_closing_brace(text, args_ind - 1) + + all_args =3D text[args_ind:args_end].split(',', 1) + + name =3D all_args[0] + args =3D None if len(all_args) =3D=3D 1 else all_args[1] + + unchanged_call =3D text[m.start():args_end+1] + text =3D text[args_end+1:] + + padding, res, vm =3D m.group('padding', 'res', 'vm') + + m =3D tmatch(success_reg_templ, text, padding, res) + + if m is None: + result +=3D unchanged_call + + if ('query-' not in name and + 'x-debug-block-dirty-bitmap-sha256' not in name and + not tmatch(some_check_templ, text, padding, res)): + print(unchanged_call + text[:200] + '...\n\n') + + continue + + if m.group('comment'): + result +=3D f'{padding}{m.group("comment")}\n' + + result +=3D f'{padding}{vm}.cmd({name}' + + if args: + result +=3D ',' + + if '\n' in args: + m_args =3D re.search('(?P *).*$', args) + assert m_args is not None + + cur_padding =3D len(m_args.group('pad')) + expected =3D len(f'{padding}{res} =3D {vm}.qmp(') + drop =3D len(f'{res} =3D ') + if cur_padding =3D=3D expected - 1: + # tolerate this bad style + drop -=3D 1 + elif cur_padding < expected - 1: + # assume nothing to do + drop =3D 0 + + if drop: + args =3D re.sub('\n' + ' ' * drop, '\n', args) + + result +=3D args + + result +=3D ')' + + text =3D text[m.end():] + + return result + + +for fname in sys.argv[1:]: + print(fname) + with open(fname) as f: + t =3D f.read() + + t =3D update(t) + + with open(fname, 'w') as f: + f.write(t) --=20 2.41.0 From nobody Wed Nov 27 17:49:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697224319; cv=none; d=zohomail.com; s=zohoarc; b=Q1Af8uUwupGoCZHVwBJKZkXixFdshDQesnEnb2ociYtGG5rGy/AgV474Jb/uFbcsPLsDmGrcGYEBIw83C82UgpN9tB570lWr0lxKz2rhi7PUolmCNKN3on0RX3Ly2Oq0DZai6oX6PbnznjeNII/0rvyizwE1Vj+UW4+Tqx/IxBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697224319; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=63oAWUDdJrQU5xMahSBgjJIxGvqOwtRogPzcH0MHJqE=; b=P46Hvh9r3Iq513Zj+VjEAL3feSb7VVwbXDclNbYGpDCb72c+AZN7+a1Hr9tLM++NbOBXuvQs3ZiFPMX2GUUebt9T05rx73Aafo7bPLOoyokC2tYU49/WFOTnGiBYwOAXBDit+WkL/CD0QIS7C/c+G3rTVYEaY+b+rYnkCk+NuxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169722431992693.37220883924988; Fri, 13 Oct 2023 12:11:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrNYp-0008EP-QK; Fri, 13 Oct 2023 15:10:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYc-0007TT-76 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrNYI-0001zW-PS for qemu-devel@nongnu.org; Fri, 13 Oct 2023 15:10:46 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-170-RRlSd562Mrq-u6RZqwn-cQ-1; Fri, 13 Oct 2023 15:10:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 223503813BD4; Fri, 13 Oct 2023 19:10:16 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A473C40C6F79; Fri, 13 Oct 2023 19:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697224225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=63oAWUDdJrQU5xMahSBgjJIxGvqOwtRogPzcH0MHJqE=; b=KEyre8uRx6sfnnK7EtmhAKiOqiGPS3oktISt4Jeu0PmpWfeKOt0rl23gDwBypEL89OCbOQ zHJsLI+BLfdRFwntL0kPQeoEXu3VHkgjoBsBMSxHJfmruOALzrAaBdybJL5c3K1vY10p2b cQQ1c8c6EAJ5MkPd1wod50p6/obqYF4= X-MC-Unique: RRlSd562Mrq-u6RZqwn-cQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Kevin Wolf , Christian Borntraeger , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Vladimir Sementsov-Ogievskiy , Ani Sinha , Thomas Huth , Beraldo Leal , qemu-s390x@nongnu.org, Peter Xu , Peter Maydell , Markus Armbruster , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , Eric Blake , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Fabiano Rosas , qemu-block@nongnu.org, Eduardo Habkost , Juan Quintela , Leonardo Bras , Joel Stanley , Paolo Bonzini , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Halil Pasic , Cleber Rosa Subject: [PULL 25/25] python: use vm.cmd() instead of vm.qmp() where appropriate Date: Fri, 13 Oct 2023 15:09:40 -0400 Message-ID: <20231013190941.3699288-26-jsnow@redhat.com> In-Reply-To: <20231013190941.3699288-1-jsnow@redhat.com> References: <20231013190941.3699288-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697224322126100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy In many cases we just want an effect of qmp command and want to raise on failure. Use vm.cmd() method which does exactly this. The commit is generated by command git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py And then, fix self.assertRaises to expect ExecuteError exception in tests/qemu-iotests/124 Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20231006154125.1068348-16-vsementsov@yandex-team.ru Signed-off-by: John Snow --- tests/avocado/vnc.py | 16 +- tests/qemu-iotests/030 | 168 +++---- tests/qemu-iotests/040 | 172 +++---- tests/qemu-iotests/041 | 471 ++++++++---------- tests/qemu-iotests/045 | 15 +- tests/qemu-iotests/055 | 62 +-- tests/qemu-iotests/056 | 77 ++- tests/qemu-iotests/093 | 42 +- tests/qemu-iotests/118 | 223 ++++----- tests/qemu-iotests/124 | 102 ++-- tests/qemu-iotests/129 | 14 +- tests/qemu-iotests/132 | 5 +- tests/qemu-iotests/139 | 45 +- tests/qemu-iotests/147 | 31 +- tests/qemu-iotests/151 | 104 ++-- tests/qemu-iotests/152 | 10 +- tests/qemu-iotests/155 | 55 +- tests/qemu-iotests/165 | 8 +- tests/qemu-iotests/196 | 3 +- tests/qemu-iotests/205 | 6 +- tests/qemu-iotests/218 | 95 ++-- tests/qemu-iotests/245 | 245 ++++----- tests/qemu-iotests/264 | 31 +- tests/qemu-iotests/281 | 21 +- tests/qemu-iotests/295 | 15 +- tests/qemu-iotests/296 | 15 +- tests/qemu-iotests/298 | 13 +- tests/qemu-iotests/300 | 54 +- tests/qemu-iotests/iotests.py | 9 +- .../tests/backing-file-invalidation | 11 +- tests/qemu-iotests/tests/copy-before-write | 15 +- .../tests/export-incoming-iothread | 6 +- .../qemu-iotests/tests/graph-changes-while-io | 18 +- tests/qemu-iotests/tests/image-fleecing | 3 +- .../tests/migrate-bitmaps-postcopy-test | 31 +- tests/qemu-iotests/tests/migrate-bitmaps-test | 47 +- .../qemu-iotests/tests/migrate-during-backup | 37 +- .../qemu-iotests/tests/migration-permissions | 9 +- .../tests/mirror-ready-cancel-error | 74 ++- tests/qemu-iotests/tests/mirror-top-perms | 16 +- tests/qemu-iotests/tests/nbd-multiconn | 12 +- tests/qemu-iotests/tests/reopen-file | 3 +- .../qemu-iotests/tests/stream-error-on-reset | 6 +- .../qemu-iotests/tests/stream-under-throttle | 7 +- 44 files changed, 974 insertions(+), 1448 deletions(-) diff --git a/tests/avocado/vnc.py b/tests/avocado/vnc.py index aeeefc70be..862c8996a8 100644 --- a/tests/avocado/vnc.py +++ b/tests/avocado/vnc.py @@ -88,9 +88,8 @@ def test_change_password(self): self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password=3Don') self.vm.launch() self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled']) - set_password_response =3D self.vm.qmp('change-vnc-password', - password=3D'new_password') - self.assertEqual(set_password_response['return'], {}) + self.vm.cmd('change-vnc-password', + password=3D'new_password') =20 def test_change_listen(self): a, b, c =3D find_free_ports(3) @@ -105,12 +104,11 @@ def test_change_listen(self): self.assertFalse(check_connect(b)) self.assertFalse(check_connect(c)) =20 - res =3D self.vm.qmp('display-update', type=3D'vnc', - addresses=3D[{'type': 'inet', 'host': VNC_ADDR, - 'port': str(b)}, - {'type': 'inet', 'host': VNC_ADDR, - 'port': str(c)}]) - self.assertEqual(res['return'], {}) + self.vm.cmd('display-update', type=3D'vnc', + addresses=3D[{'type': 'inet', 'host': VNC_ADDR, + 'port': str(b)}, + {'type': 'inet', 'host': VNC_ADDR, + 'port': str(c)}]) self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], st= r(b)) self.assertFalse(check_connect(a)) self.assertTrue(check_connect(b)) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 98595d47fe..0e6a39d103 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -56,8 +56,7 @@ class TestSingleDrive(iotests.QMPTestCase): def test_stream(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 self.wait_until_completed() =20 @@ -77,8 +76,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', mid_img).std= out, 'image file map matches backing file before streaming') =20 - result =3D self.vm.qmp('block-stream', device=3D'mid', job_id=3D's= tream-mid') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'mid', job_id=3D'stream-mid') =20 self.wait_until_completed(drive=3D'stream-mid') =20 @@ -94,8 +92,7 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 self.pause_job('drive0', wait=3DFalse) self.vm.resume_drive('drive0') @@ -108,8 +105,7 @@ class TestSingleDrive(iotests.QMPTestCase): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/offset', offset) =20 - result =3D self.vm.qmp('block-job-resume', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 self.wait_until_completed() =20 @@ -129,8 +125,7 @@ class TestSingleDrive(iotests.QMPTestCase): '-f', iotests.imgfmt, '-rU', '-c', 'map', test_img).stdout =20 # This is a no-op: no data should ever be copied from the base ima= ge - result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Dm= id_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', base=3Dmid_img) =20 self.wait_until_completed() =20 @@ -144,8 +139,7 @@ class TestSingleDrive(iotests.QMPTestCase): def test_stream_partial(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Db= acking_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', base=3Dbacking_img) =20 self.wait_until_completed() =20 @@ -172,24 +166,22 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_img('create', '-f', iotests.imgfmt, ro_top_path, str(self.image_len)) =20 - result =3D self.vm.qmp('blockdev-add', - node_name=3D'ro-top', - driver=3Diotests.imgfmt, - read_only=3DTrue, - file=3D{ - 'driver': 'file', - 'filename': ro_top_path, - 'read-only': True - }, - backing=3D'mid') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'ro-top', + driver=3Diotests.imgfmt, + read_only=3DTrue, + file=3D{ + 'driver': 'file', + 'filename': ro_top_path, + 'read-only': True + }, + backing=3D'mid') =20 result =3D self.vm.qmp('block-stream', job_id=3D'stream', device=3D'ro-top', base_node=3D'base') self.assert_qmp(result, 'error/desc', 'Block node is read-only= ') =20 - result =3D self.vm.qmp('blockdev-del', node_name=3D'ro-top') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'ro-top') =20 =20 class TestParallelOps(iotests.QMPTestCase): @@ -254,10 +246,9 @@ class TestParallelOps(iotests.QMPTestCase): node_name =3D 'node%d' % i job_id =3D 'stream-%s' % node_name pending_jobs.append(job_id) - result =3D self.vm.qmp('block-stream', device=3Dnode_name, - job_id=3Djob_id, bottom=3Df'node{i-1}', - speed=3D1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3Dnode_name, + job_id=3Djob_id, bottom=3Df'node{i-1}', + speed=3D1024) =20 # Do this in reverse: After unthrottling them, some jobs may finish # before we have unthrottled all of them. This will drain their @@ -269,8 +260,7 @@ class TestParallelOps(iotests.QMPTestCase): # Starting from the top (i.e. in reverse) does not have this probl= em: # When a job finishes, the ones below it are not advanced. for job in reversed(pending_jobs): - result =3D self.vm.qmp('block-job-set-speed', device=3Djob, sp= eed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3Djob, speed=3D0) =20 # Wait for all jobs to be finished. while len(pending_jobs) > 0: @@ -297,10 +287,9 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Set a speed limit to make sure that this job blocks the rest - result =3D self.vm.qmp('block-stream', device=3D'node4', - job_id=3D'stream-node4', base=3Dself.imgs[1], - filter_node_name=3D'stream-filter', speed=3D1= 024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'node4', + job_id=3D'stream-node4', base=3Dself.imgs[1], + filter_node_name=3D'stream-filter', speed=3D1024*1024) =20 result =3D self.vm.qmp('block-stream', device=3D'node5', job_id=3D= 'stream-node5', base=3Dself.imgs[2]) self.assert_qmp(result, 'error/desc', @@ -328,8 +317,7 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_qmp(result, 'error/desc', "Node 'node2' is busy: block device is in use by block job: st= ream") =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'stream-nod= e4', speed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'stream-node4', speed= =3D0) =20 self.wait_until_completed(drive=3D'stream-node4') self.assert_no_active_block_jobs() @@ -341,8 +329,7 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Set a speed limit to make sure that this job blocks the rest - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dse= lf.imgs[5], base=3Dself.imgs[3], job_id=3D'commit-node3', speed=3D1024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', top=3Dself.imgs[5],= base=3Dself.imgs[3], job_id=3D'commit-node3', speed=3D1024*1024) =20 result =3D self.vm.qmp('block-stream', device=3D'node3', job_id=3D= 'stream-node3') self.assert_qmp(result, 'error/desc', @@ -365,8 +352,7 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_qmp(result, 'error/desc', "Node 'drive0' is busy: block device is in use by block job: c= ommit") =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'commit-nod= e3', speed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'commit-node3', speed= =3D0) =20 self.wait_until_completed(drive=3D'commit-node3') =20 @@ -377,23 +363,20 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Set a speed limit to make sure that this job blocks the rest - result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Ds= elf.imgs[3], job_id=3D'commit-drive0', speed=3D1024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', base=3Dself.imgs[3]= , job_id=3D'commit-drive0', speed=3D1024*1024) =20 result =3D self.vm.qmp('block-stream', device=3D'node5', base=3Dse= lf.imgs[3], job_id=3D'stream-node6') self.assert_qmp(result, 'error/desc', "Node 'node5' is busy: block device is in use by block job: co= mmit") =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'commit-dri= ve0', speed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'commit-drive0', speed= =3D0) =20 event =3D self.vm.event_wait(name=3D'BLOCK_JOB_READY') self.assert_qmp(event, 'data/device', 'commit-drive0') self.assert_qmp(event, 'data/type', 'commit') self.assert_qmp_absent(event, 'data/error') =20 - result =3D self.vm.qmp('block-job-complete', device=3D'commit-driv= e0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3D'commit-drive0') =20 self.wait_until_completed(drive=3D'commit-drive0') =20 @@ -404,18 +387,16 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Commit from node2 into node0 - result =3D self.vm.qmp('block-commit', device=3D'drive0', - top=3Dself.imgs[2], base=3Dself.imgs[0], - filter_node_name=3D'commit-filter', speed=3D1= 024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', + top=3Dself.imgs[2], base=3Dself.imgs[0], + filter_node_name=3D'commit-filter', speed=3D1024*1024) =20 # Stream from node2 into node4 result =3D self.vm.qmp('block-stream', device=3D'node4', base_node= =3D'node2', job_id=3D'node4') self.assert_qmp(result, 'error/desc', "Cannot freeze 'backing' link to 'commit-filter'") =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D0) =20 self.wait_until_completed() self.assert_no_active_block_jobs() @@ -428,18 +409,15 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Commit from node2 into node0 - result =3D self.vm.qmp('block-commit', device=3D'drive0', - top_node=3D'node2', base_node=3D'node0', - filter_node_name=3D'commit-filter', speed=3D1= 024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', + top_node=3D'node2', base_node=3D'node0', + filter_node_name=3D'commit-filter', speed=3D1024*1024) =20 # Stream from node2 into node4 - result =3D self.vm.qmp('block-stream', device=3D'node4', - base_node=3D'commit-filter', job_id=3D'node4') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'node4', + base_node=3D'commit-filter', job_id=3D'node4') =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D0) =20 self.vm.run_job(job=3D'drive0', auto_dismiss=3DTrue) self.vm.run_job(job=3D'node4', auto_dismiss=3DTrue) @@ -458,12 +436,10 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Stream from node0 into node2 - result =3D self.vm.qmp('block-stream', device=3D'node2', base_node= =3D'node0', job_id=3D'node2') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'node2', base_node=3D'node0',= job_id=3D'node2') =20 # Commit from the active layer into node3 - result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Ds= elf.imgs[3]) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', base=3Dself.imgs[3]) =20 # Wait for all jobs to be finished. pending_jobs =3D ['node2', 'drive0'] @@ -490,16 +466,13 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Stream from node0 into node4 - result =3D self.vm.qmp('block-stream', device=3D'node4', base_node= =3D'node0', job_id=3D'node4', speed=3D1024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'node4', base_node=3D'node0',= job_id=3D'node4', speed=3D1024*1024) =20 # Commit from the active layer into node5 - result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Ds= elf.imgs[5], speed=3D1024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', base=3Dself.imgs[5]= , speed=3D1024*1024) =20 for job in ['drive0', 'node4']: - result =3D self.vm.qmp('block-job-set-speed', device=3Djob, sp= eed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3Djob, speed=3D0) =20 # Wait for all jobs to be finished. pending_jobs =3D ['node4', 'drive0'] @@ -549,8 +522,7 @@ class TestParallelOps(iotests.QMPTestCase): "'base' and 'base-node' cannot be specified at the same time") =20 # Success: the base node is a backing file of the top node - result =3D self.vm.qmp('block-stream', device=3D'node4', base_node= =3D'node2', job_id=3D'stream') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'node4', base_node=3D'node2',= job_id=3D'stream') =20 self.wait_until_completed(drive=3D'stream') =20 @@ -606,8 +578,7 @@ class TestQuorum(iotests.QMPTestCase): =20 self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'node0', job_id=3D= 'stream-node0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'node0', job_id=3D'stream-nod= e0') =20 self.wait_until_completed(drive=3D'stream-node0') =20 @@ -636,8 +607,7 @@ class TestSmallerBackingFile(iotests.QMPTestCase): def test_stream(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 self.wait_until_completed() =20 @@ -694,8 +664,7 @@ class TestEIO(TestErrors): def test_report(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 completed =3D False error =3D False @@ -722,8 +691,7 @@ class TestEIO(TestErrors): def test_ignore(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'ignore') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', on_error=3D'ignore') =20 error =3D False completed =3D False @@ -756,8 +724,7 @@ class TestEIO(TestErrors): def test_stop(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'stop') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', on_error=3D'stop') =20 error =3D False completed =3D False @@ -779,8 +746,7 @@ class TestEIO(TestErrors): self.assert_qmp(result, 'return[0]/offset', self.STREA= M_BUFFER_SIZE) self.assert_qmp(result, 'return[0]/io-status', 'failed= ') =20 - result =3D self.vm.qmp('block-job-resume', device=3D'd= rive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 result =3D self.vm.qmp('query-block-jobs') if result =3D=3D {'return': []}: @@ -806,8 +772,7 @@ class TestEIO(TestErrors): def test_enospc(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'enospc') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', on_error=3D'enospc') =20 completed =3D False error =3D False @@ -852,8 +817,7 @@ class TestENOSPC(TestErrors): def test_enospc(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'enospc') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', on_error=3D'enospc') =20 error =3D False completed =3D False @@ -875,8 +839,7 @@ class TestENOSPC(TestErrors): self.assert_qmp(result, 'return[0]/offset', self.STREA= M_BUFFER_SIZE) self.assert_qmp(result, 'return[0]/io-status', 'nospac= e') =20 - result =3D self.vm.qmp('block-job-resume', device=3D'd= rive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 result =3D self.vm.qmp('query-block-jobs') if result =3D=3D {'return': []}: @@ -921,8 +884,7 @@ class TestStreamStop(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 time.sleep(0.1) events =3D self.vm.get_qmp_events(wait=3DFalse) @@ -955,11 +917,9 @@ class TestSetSpeed(iotests.QMPTestCase): def perf_test_throughput(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D8 * 1024 * 1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D8 * = 1024 * 1024) =20 self.wait_until_completed() =20 @@ -969,16 +929,14 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 # Default speed is 0 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') self.assert_qmp(result, 'return[0]/speed', 0) =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D8 * 1024 * 1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D8 * = 1024 * 1024) =20 # Ensure the speed we set was accepted result =3D self.vm.qmp('query-block-jobs') @@ -989,8 +947,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.vm.pause_drive('drive0') =20 # Check setting speed in block-stream works - result =3D self.vm.qmp('block-stream', device=3D'drive0', speed=3D= 4 * 1024 * 1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0', speed=3D4 * 1024 * = 1024) =20 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') @@ -1007,8 +964,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp('block-stream', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', device=3D'drive0') =20 result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D-1) self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a= non-negative value") diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index 4b8bf09a5d..5c18e413ec 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -61,17 +61,14 @@ class ImageCommitTestCase(iotests.QMPTestCase): def run_commit_test(self, top, base, need_ready=3DFalse, node_names=3D= False): self.assert_no_active_block_jobs() if node_names: - result =3D self.vm.qmp('block-commit', device=3D'drive0', top_= node=3Dtop, base_node=3Dbase) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', top_node=3Dtop,= base_node=3Dbase) else: - result =3D self.vm.qmp('block-commit', device=3D'drive0', top= =3Dtop, base=3Dbase) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', top=3Dtop, base= =3Dbase) self.wait_for_complete(need_ready) =20 def run_default_commit_test(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0') self.wait_for_complete() =20 class TestSingleDrive(ImageCommitTestCase): @@ -118,38 +115,30 @@ class TestSingleDrive(ImageCommitTestCase): =20 @iotests.skip_if_unsupported(['throttle']) def test_commit_with_filter_and_quit(self): - result =3D self.vm.qmp('object-add', qom_type=3D'throttle-group', = id=3D'tg') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', qom_type=3D'throttle-group', id=3D'tg') =20 # Add a filter outside of the backing chain - result =3D self.vm.qmp('blockdev-add', driver=3D'throttle', node_n= ame=3D'filter', throttle_group=3D'tg', file=3D'mid') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', driver=3D'throttle', node_name=3D'filt= er', throttle_group=3D'tg', file=3D'mid') =20 - result =3D self.vm.qmp('block-commit', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0') =20 # Quit immediately, thus forcing a simultaneous cancel of the # block job and a bdrv_drain_all() - result =3D self.vm.qmp('quit') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('quit') =20 # Same as above, but this time we add the filter after starting the job @iotests.skip_if_unsupported(['throttle']) def test_commit_plus_filter_and_quit(self): - result =3D self.vm.qmp('object-add', qom_type=3D'throttle-group', = id=3D'tg') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', qom_type=3D'throttle-group', id=3D'tg') =20 - result =3D self.vm.qmp('block-commit', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0') =20 # Add a filter outside of the backing chain - result =3D self.vm.qmp('blockdev-add', driver=3D'throttle', node_n= ame=3D'filter', throttle_group=3D'tg', file=3D'mid') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', driver=3D'throttle', node_name=3D'filt= er', throttle_group=3D'tg', file=3D'mid') =20 # Quit immediately, thus forcing a simultaneous cancel of the # block job and a bdrv_drain_all() - result =3D self.vm.qmp('quit') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('quit') =20 def test_device_not_found(self): result =3D self.vm.qmp('block-commit', device=3D'nonexistent', top= =3D'%s' % mid_img) @@ -226,8 +215,7 @@ class TestSingleDrive(ImageCommitTestCase): def test_top_node_in_wrong_chain(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('blockdev-add', driver=3D'null-co', node_na= me=3D'null') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', driver=3D'null-co', node_name=3D'null') =20 result =3D self.vm.qmp('block-commit', device=3D'drive0', top_node= =3D'null', base_node=3D'base') self.assert_qmp(result, 'error/class', 'GenericError') @@ -240,11 +228,9 @@ class TestSingleDrive(ImageCommitTestCase): return =20 self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dmi= d_img, - base=3Dbacking_img, speed=3D(self.image_len /= / 4)) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('device_del', id=3D'scsi0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', top=3Dmid_img, + base=3Dbacking_img, speed=3D(self.image_len // 4)) + self.vm.cmd('device_del', id=3D'scsi0') =20 cancelled =3D False deleted =3D False @@ -270,9 +256,8 @@ class TestSingleDrive(ImageCommitTestCase): return =20 self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dmi= d_img, - base=3Dbacking_img, speed=3D(self.image_len /= / 4)) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', top=3Dmid_img, + base=3Dbacking_img, speed=3D(self.image_len // 4)) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/file', test_img) @@ -407,8 +392,7 @@ class TestSetSpeed(ImageCommitTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dmi= d_img, speed=3D1024 * 1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0', top=3Dmid_img, spee= d=3D1024 * 1024) =20 # Ensure the speed we set was accepted result =3D self.vm.qmp('query-block-jobs') @@ -481,8 +465,7 @@ class TestErrorHandling(iotests.QMPTestCase): os.remove(backing_img) =20 def blockdev_add(self, **kwargs): - result =3D self.vm.qmp('blockdev-add', **kwargs) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', **kwargs) =20 def add_block_nodes(self, base_debug=3DNone, mid_debug=3DNone, top_deb= ug=3DNone): self.blockdev_add(node_name=3D'base-file', driver=3D'file', @@ -528,11 +511,9 @@ class TestErrorHandling(iotests.QMPTestCase): completed =3D True elif ev['event'] =3D=3D 'BLOCK_JOB_ERROR': if error_pauses_job: - result =3D self.vm.qmp('block-job-resume', device=3D'j= ob0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'job0') elif ev['event'] =3D=3D 'BLOCK_JOB_READY': - result =3D self.vm.qmp('block-job-complete', device=3D'job= 0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3D'job0') else: self.fail("Unexpected event: %s" % ev) log.append(iotests.filter_qmp_event(ev)) @@ -595,11 +576,10 @@ class TestErrorHandling(iotests.QMPTestCase): self.add_block_nodes(top_debug=3Dtop_debug, mid_debug=3Dmid_debug, base_debug=3Dbase_debug) =20 - result =3D self.vm.qmp('block-commit', job_id=3D'job0', device=3D'= top-fmt', - top_node=3D'top-fmt' if active else 'mid-fmt', - base_node=3D'mid-fmt' if active else 'base-fm= t', - on_error=3Don_error) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', job_id=3D'job0', device=3D'top-fmt', + top_node=3D'top-fmt' if active else 'mid-fmt', + base_node=3D'mid-fmt' if active else 'base-fmt', + on_error=3Don_error) =20 def testActiveReadErrorReport(self): self.prepare_and_start_job('report', top_event=3D'read_aio') @@ -771,10 +751,9 @@ class TestCommitWithFilters(iotests.QMPTestCase): self.vm =3D iotests.VM().add_device('virtio-scsi,id=3Dvio-scsi') self.vm.launch() =20 - result =3D self.vm.qmp('object-add', qom_type=3D'throttle-group', = id=3D'tg') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', qom_type=3D'throttle-group', id=3D'tg') =20 - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'top-filter', 'driver': 'throttle', 'throttle-group': 'tg', @@ -816,7 +795,6 @@ class TestCommitWithFilters(iotests.QMPTestCase): } } }) - self.assert_qmp(result, 'return', {}) =20 def tearDown(self): self.vm.shutdown() @@ -833,13 +811,12 @@ class TestCommitWithFilters(iotests.QMPTestCase): return self.vm.node_info(node)['image']['filename'] =20 def test_filterless_commit(self): - result =3D self.vm.qmp('block-commit', - job_id=3D'commit', - device=3D'top-filter', - top_node=3D'cow-2', - base_node=3D'cow-1', - backing_file=3Dself.img1) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', + job_id=3D'commit', + device=3D'top-filter', + top_node=3D'cow-2', + base_node=3D'cow-1', + backing_file=3Dself.img1) self.wait_until_completed(drive=3D'commit') =20 self.assertIsNotNone(self.vm.node_info('cow-3')) @@ -850,13 +827,12 @@ class TestCommitWithFilters(iotests.QMPTestCase): self.pattern_files[2] =3D self.img1 =20 def test_commit_through_filter(self): - result =3D self.vm.qmp('block-commit', - job_id=3D'commit', - device=3D'top-filter', - top_node=3D'cow-1', - base_node=3D'cow-0', - backing_file=3Dself.img0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', + job_id=3D'commit', + device=3D'top-filter', + top_node=3D'cow-1', + base_node=3D'cow-0', + backing_file=3Dself.img0) self.wait_until_completed(drive=3D'commit') =20 self.assertIsNotNone(self.vm.node_info('cow-2')) @@ -871,9 +847,8 @@ class TestCommitWithFilters(iotests.QMPTestCase): # Add a device, so the commit job finds a parent it can change # to point to the base node (so we can test that top-filter is # dropped from the graph) - result =3D self.vm.qmp('device_add', id=3D'drv0', driver=3D'scsi-h= d', - bus=3D'vio-scsi.0', drive=3D'top-filter') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', id=3D'drv0', driver=3D'scsi-hd', + bus=3D'vio-scsi.0', drive=3D'top-filter') =20 # Try to release our reference to top-filter; that should not # work because drv0 uses it @@ -881,16 +856,14 @@ class TestCommitWithFilters(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') self.assert_qmp(result, 'error/desc', 'Node top-filter is in use') =20 - result =3D self.vm.qmp('block-commit', - job_id=3D'commit', - device=3D'top-filter', - base_node=3D'cow-2') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', + job_id=3D'commit', + device=3D'top-filter', + base_node=3D'cow-2') self.complete_and_wait(drive=3D'commit') =20 # Try to release our reference to top-filter again - result =3D self.vm.qmp('blockdev-del', node_name=3D'top-filter') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'top-filter') =20 self.assertIsNone(self.vm.node_info('top-filter')) self.assertIsNone(self.vm.node_info('cow-3')) @@ -905,12 +878,11 @@ class TestCommitWithFilters(iotests.QMPTestCase): self.pattern_files[3] =3D self.img2 =20 def test_filtered_active_commit_without_filter(self): - result =3D self.vm.qmp('block-commit', - job_id=3D'commit', - device=3D'top-filter', - top_node=3D'cow-3', - base_node=3D'cow-2') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', + job_id=3D'commit', + device=3D'top-filter', + top_node=3D'cow-3', + base_node=3D'cow-2') self.complete_and_wait(drive=3D'commit') =20 self.assertIsNotNone(self.vm.node_info('top-filter')) @@ -935,23 +907,22 @@ class TestCommitWithOverriddenBacking(iotests.QMPTest= Case): self.vm.launch() =20 # Use base_b instead of base_a as the backing of top - result =3D self.vm.qmp('blockdev-add', { - 'node-name': 'top', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': self.img_top - }, - 'backing': { - 'node-name': 'base', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': self.img_base_b - } - } - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', { + 'node-name': 'top', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': self.img_top + }, + 'backing': { + 'node-name': 'base', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': self.img_base_b + } + } + }) =20 def tearDown(self): self.vm.shutdown() @@ -971,11 +942,10 @@ class TestCommitWithOverriddenBacking(iotests.QMPTest= Case): def test_commit_to_b(self): # Try committing to base_b (which should work, since that is # actually top's backing image) - result =3D self.vm.qmp('block-commit', - job_id=3D'commit', - device=3D'top', - base=3Dself.img_base_b) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', + job_id=3D'commit', + device=3D'top', + base=3Dself.img_base_b) =20 self.vm.event_wait('BLOCK_JOB_READY') self.vm.qmp('block-job-complete', device=3D'commit') diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 3aef42aec8..98d17b1388 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -65,9 +65,8 @@ class TestSingleDrive(iotests.QMPTestCase): def test_complete(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + target=3Dself.qmp_target) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -79,9 +78,8 @@ class TestSingleDrive(iotests.QMPTestCase): def test_cancel(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + target=3Dself.qmp_target) =20 self.cancel_and_wait(force=3DTrue) result =3D self.vm.qmp('query-block') @@ -90,9 +88,8 @@ class TestSingleDrive(iotests.QMPTestCase): def test_cancel_after_ready(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + target=3Dself.qmp_target) =20 self.wait_ready_and_cancel() result =3D self.vm.qmp('query-block') @@ -104,9 +101,8 @@ class TestSingleDrive(iotests.QMPTestCase): def test_pause(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + target=3Dself.qmp_target) =20 self.pause_job('drive0') =20 @@ -117,8 +113,7 @@ class TestSingleDrive(iotests.QMPTestCase): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/offset', offset) =20 - result =3D self.vm.qmp('block-job-resume', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 self.complete_and_wait() self.vm.shutdown() @@ -129,9 +124,8 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # A small buffer is rounded up automatically - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - buf_size=3D4096, target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + buf_size=3D4096, target=3Dself.qmp_target) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -145,9 +139,8 @@ class TestSingleDrive(iotests.QMPTestCase): =20 qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D%d,= size=3D%d' % (self.image_len, self.image_len), target_img) - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - buf_size=3D65536, mode=3D'existing', target= =3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + buf_size=3D65536, mode=3D'existing', target=3Dself.qmp= _target) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -162,9 +155,8 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D%d,= backing_file=3D%s' % (self.image_len, backing_img), '-F', 'raw', target_img) - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - mode=3D'existing', target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dself.qmp_target) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -178,9 +170,8 @@ class TestSingleDrive(iotests.QMPTestCase): def test_implicit_node(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', - target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, device=3D'drive0', sync=3D'full', + target=3Dself.qmp_target) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/file', test_img) @@ -236,8 +227,7 @@ class TestSingleBlockdev(TestSingleDrive): args =3D {'driver': iotests.imgfmt, 'node-name': self.qmp_target, 'file': { 'filename': target_img, 'driver': 'file' } } - result =3D self.vm.qmp("blockdev-add", args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("blockdev-add", args) =20 def test_mirror_to_self(self): result =3D self.vm.qmp(self.qmp_cmd, job_id=3D'job0', @@ -254,10 +244,9 @@ class TestSingleBlockdev(TestSingleDrive): result =3D self.vm.qmp('block_resize', node_name=3Dnode, size= =3D65536) self.assert_qmp(result, 'error/class', 'GenericError') =20 - result =3D self.vm.qmp(self.qmp_cmd, job_id=3D'job0', device=3D'dr= ive0', - sync=3D'full', target=3Dself.qmp_target, - auto_finalize=3DFalse, auto_dismiss=3DFalse) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, job_id=3D'job0', device=3D'drive0', + sync=3D'full', target=3Dself.qmp_target, + auto_finalize=3DFalse, auto_dismiss=3DFalse) =20 result =3D self.vm.run_job('job0', auto_finalize=3DFalse, pre_finalize=3Dpre_finalize) @@ -270,14 +259,12 @@ class TestSingleBlockdev(TestSingleDrive): self.do_test_resize(None, self.qmp_target) =20 def do_test_target_size(self, size): - result =3D self.vm.qmp('block_resize', node_name=3Dself.qmp_target, - size=3Dsize) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block_resize', node_name=3Dself.qmp_target, + size=3Dsize) =20 - result =3D self.vm.qmp(self.qmp_cmd, job_id=3D'job0', - device=3D'drive0', sync=3D'full', auto_dismis= s=3DFalse, - target=3Dself.qmp_target) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.qmp_cmd, job_id=3D'job0', + device=3D'drive0', sync=3D'full', auto_dismiss=3DFalse, + target=3Dself.qmp_target) =20 result =3D self.vm.run_job('job0') self.assertEqual(result, 'Source and target image have different s= izes') @@ -337,9 +324,8 @@ class TestMirrorNoBacking(iotests.QMPTestCase): =20 qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s' % backing_img, '-F', 'raw', tar= get_img) - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dtarget_img) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -353,9 +339,8 @@ class TestMirrorNoBacking(iotests.QMPTestCase): =20 qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s' % backing_img, '-F', 'raw', tar= get_img) - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dtarget_img) =20 self.wait_ready_and_cancel() result =3D self.vm.qmp('query-block') @@ -374,9 +359,8 @@ class TestMirrorNoBacking(iotests.QMPTestCase): % (TestMirrorNoBacking.image_len, target_backing_i= mg), '-F', iotests.imgfmt, target_img) =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dtarget_img) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -409,9 +393,8 @@ class TestMirrorResized(iotests.QMPTestCase): def test_complete_top(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= top', - target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'top', + target=3Dtarget_img) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -423,9 +406,8 @@ class TestMirrorResized(iotests.QMPTestCase): def test_complete_full(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') @@ -488,9 +470,8 @@ new_state =3D "1" def test_report_read(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img) =20 completed =3D False error =3D False @@ -516,9 +497,8 @@ new_state =3D "1" def test_ignore_read(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, on_source_error=3D'ignor= e') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img, on_source_error=3D'ignore') =20 event =3D self.vm.get_qmp_event(wait=3DTrue) while event['event'] =3D=3D 'JOB_STATUS_CHANGE': @@ -541,10 +521,9 @@ new_state =3D "1" qemu_img('create', '-f', iotests.imgfmt, '-ocluster_size=3D131072,backing_file=3D%s' %(backing_img= ), '-F', 'raw', target_img) - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= top', - on_source_error=3D'ignore', - mode=3D'existing', target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'top', + on_source_error=3D'ignore', + mode=3D'existing', target=3Dtarget_img) =20 event =3D self.vm.get_qmp_event(wait=3DTrue) while event['event'] =3D=3D 'JOB_STATUS_CHANGE': @@ -568,9 +547,8 @@ new_state =3D "1" def test_stop_read(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, on_source_error=3D'stop') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img, on_source_error=3D'stop') =20 error =3D False ready =3D False @@ -590,8 +568,7 @@ new_state =3D "1" self.assert_qmp(result, 'return[0]/status', 'paused') self.assert_qmp(result, 'return[0]/io-status', 'failed= ') =20 - result =3D self.vm.qmp('block-job-resume', device=3D'd= rive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') error =3D True elif event['event'] =3D=3D 'BLOCK_JOB_READY': self.assertTrue(error, 'job completed unexpectedly') @@ -656,9 +633,8 @@ new_state =3D "1" def test_report_write(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dself.target_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dself.target_img) =20 completed =3D False error =3D False @@ -682,10 +658,9 @@ new_state =3D "1" def test_ignore_write(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dself.target_img, - on_target_error=3D'ignore') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dself.target_img, + on_target_error=3D'ignore') =20 event =3D self.vm.event_wait(name=3D'BLOCK_JOB_ERROR') self.assertEqual(event['event'], 'BLOCK_JOB_ERROR') @@ -698,10 +673,9 @@ new_state =3D "1" def test_stop_write(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dself.target_img, - on_target_error=3D'stop') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + mode=3D'existing', target=3Dself.target_img, + on_target_error=3D'stop') =20 error =3D False ready =3D False @@ -721,8 +695,7 @@ new_state =3D "1" self.assert_qmp(result, 'return[0]/status', 'paused') self.assert_qmp(result, 'return[0]/io-status', 'failed= ') =20 - result =3D self.vm.qmp('block-job-resume', device=3D'd= rive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 result =3D self.vm.qmp('query-block-jobs') self.assertIn(result['return'][0]['status'], ['running= ', 'ready']) @@ -755,17 +728,15 @@ class TestSetSpeed(iotests.QMPTestCase): def test_set_speed(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img) =20 # Default speed is 0 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') self.assert_qmp(result, 'return[0]/speed', 0) =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D8 * 1024 * 1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D8 * = 1024 * 1024) =20 # Ensure the speed we set was accepted result =3D self.vm.qmp('query-block-jobs') @@ -775,9 +746,8 @@ class TestSetSpeed(iotests.QMPTestCase): self.wait_ready_and_cancel() =20 # Check setting speed in drive-mirror works - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, speed=3D4*1024*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img, speed=3D4*1024*1024) =20 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') @@ -794,9 +764,8 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img) =20 result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D-1) self.assert_qmp(result, 'error/class', 'GenericError') @@ -811,13 +780,12 @@ class TestUnbackedSource(iotests.QMPTestCase): str(TestUnbackedSource.image_len)) self.vm =3D iotests.VM() self.vm.launch() - result =3D self.vm.qmp('blockdev-add', node_name=3D'drive0', - driver=3Diotests.imgfmt, - file=3D{ - 'driver': 'file', - 'filename': test_img, - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', node_name=3D'drive0', + driver=3Diotests.imgfmt, + file=3D{ + 'driver': 'file', + 'filename': test_img, + }) =20 def tearDown(self): self.vm.shutdown() @@ -826,28 +794,25 @@ class TestUnbackedSource(iotests.QMPTestCase): =20 def test_absolute_paths_full(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('drive-mirror', job_id=3D'drive0', device= =3D'drive0', - sync=3D'full', target=3Dtarget_img, - mode=3D'absolute-paths') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'drive0', device=3D'drive0', + sync=3D'full', target=3Dtarget_img, + mode=3D'absolute-paths') self.complete_and_wait() self.assert_no_active_block_jobs() =20 def test_absolute_paths_top(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('drive-mirror', job_id=3D'drive0', device= =3D'drive0', - sync=3D'top', target=3Dtarget_img, - mode=3D'absolute-paths') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'drive0', device=3D'drive0', + sync=3D'top', target=3Dtarget_img, + mode=3D'absolute-paths') self.complete_and_wait() self.assert_no_active_block_jobs() =20 def test_absolute_paths_none(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('drive-mirror', job_id=3D'drive0', device= =3D'drive0', - sync=3D'none', target=3Dtarget_img, - mode=3D'absolute-paths') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'drive0', device=3D'drive0', + sync=3D'none', target=3Dtarget_img, + mode=3D'absolute-paths') self.complete_and_wait() self.assert_no_active_block_jobs() =20 @@ -857,14 +822,12 @@ class TestUnbackedSource(iotests.QMPTestCase): qemu_io('-c', 'write -P 42 0 64k', target_img) =20 self.assert_no_active_block_jobs() - result =3D self.vm.qmp('drive-mirror', job_id=3D'drive0', device= =3D'drive0', - sync=3D'full', target=3Dtarget_img, mode=3D'e= xisting') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'drive0', device=3D'drive0', + sync=3D'full', target=3Dtarget_img, mode=3D'existing') self.complete_and_wait() self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('blockdev-del', node_name=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'drive0') =20 self.assertTrue(iotests.compare_images(test_img, target_img), 'target image does not match source after mirrorin= g') @@ -874,26 +837,22 @@ class TestUnbackedSource(iotests.QMPTestCase): str(self.image_len)) qemu_io('-c', 'write -P 42 0 64k', target_img) =20 - result =3D self.vm.qmp('blockdev-add', node_name=3D'target', - driver=3Diotests.imgfmt, - file=3D{ - 'driver': 'file', - 'filename': target_img, - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', node_name=3D'target', + driver=3Diotests.imgfmt, + file=3D{ + 'driver': 'file', + 'filename': target_img, + }) =20 self.assert_no_active_block_jobs() - result =3D self.vm.qmp('blockdev-mirror', job_id=3D'drive0', devic= e=3D'drive0', - sync=3D'full', target=3D'target') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', job_id=3D'drive0', device=3D'drive0= ', + sync=3D'full', target=3D'target') self.complete_and_wait() self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('blockdev-del', node_name=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'drive0') =20 - result =3D self.vm.qmp('blockdev-del', node_name=3D'target') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'target') =20 self.assertTrue(iotests.compare_images(test_img, target_img), 'target image does not match source after mirrorin= g') @@ -918,10 +877,9 @@ class TestGranularity(iotests.QMPTestCase): =20 def test_granularity(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', - sync=3D'full', target=3Dtarget_img, - mode=3D'absolute-paths', granularity=3D8192) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', + sync=3D'full', target=3Dtarget_img, + mode=3D'absolute-paths', granularity=3D8192) =20 event =3D self.vm.get_qmp_event(wait=3D60.0) while event['event'] =3D=3D 'JOB_STATUS_CHANGE': @@ -963,8 +921,7 @@ class TestRepairQuorum(iotests.QMPTestCase): #assemble the quorum block device from the individual files args =3D { "driver": "quorum", "node-name": "quorum0", "vote-threshold": 2, "children": [ "img0", "img1", "img2"= ] } - result =3D self.vm.qmp("blockdev-add", args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("blockdev-add", args) =20 =20 def tearDown(self): @@ -978,10 +935,9 @@ class TestRepairQuorum(iotests.QMPTestCase): pass =20 def test_complete(self): - result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', - sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'job0', device=3D'quorum0', + sync=3D'full', node_name=3D"repair0", replaces=3D"img1= ", + target=3Dquorum_repair_img, format=3Diotests.imgfmt) =20 self.complete_and_wait(drive=3D"job0") self.assert_has_block_node("repair0", quorum_repair_img) @@ -991,10 +947,9 @@ class TestRepairQuorum(iotests.QMPTestCase): 'target image does not match source after mirrorin= g') =20 def test_cancel(self): - result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', - sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'job0', device=3D'quorum0', + sync=3D'full', node_name=3D"repair0", replaces=3D"img1= ", + target=3Dquorum_repair_img, format=3Diotests.imgfmt) =20 self.cancel_and_wait(drive=3D"job0", force=3DTrue) # here we check that the last registered quorum file has not been @@ -1002,10 +957,9 @@ class TestRepairQuorum(iotests.QMPTestCase): self.assert_has_block_node(None, quorum_img3) =20 def test_cancel_after_ready(self): - result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', - sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'job0', device=3D'quorum0', + sync=3D'full', node_name=3D"repair0", replaces=3D"img1= ", + target=3Dquorum_repair_img, format=3Diotests.imgfmt) =20 self.wait_ready_and_cancel(drive=3D"job0") # here we check that the last registered quorum file has not been @@ -1016,10 +970,9 @@ class TestRepairQuorum(iotests.QMPTestCase): 'target image does not match source after mirrorin= g') =20 def test_pause(self): - result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', - sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'job0', device=3D'quorum0', + sync=3D'full', node_name=3D"repair0", replaces=3D"img1= ", + target=3Dquorum_repair_img, format=3Diotests.imgfmt) =20 self.pause_job('job0') =20 @@ -1030,8 +983,7 @@ class TestRepairQuorum(iotests.QMPTestCase): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/offset', offset) =20 - result =3D self.vm.qmp('block-job-resume', device=3D'job0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'job0') =20 self.complete_and_wait(drive=3D"job0") self.vm.shutdown() @@ -1084,20 +1036,18 @@ class TestRepairQuorum(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_after_a_quorum_snapshot(self): - result =3D self.vm.qmp('blockdev-snapshot-sync', node_name=3D'img1= ', - snapshot_file=3Dquorum_snapshot_file, - snapshot_node_name=3D"snap1") - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-snapshot-sync', node_name=3D'img1', + snapshot_file=3Dquorum_snapshot_file, + snapshot_node_name=3D"snap1") =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D"img1", target=3Dquorum_repair_img, format=3Diotests.= imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 - result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', - sync=3D'full', node_name=3D'repair0', replace= s=3D"snap1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'job0', device=3D'quorum0', + sync=3D'full', node_name=3D'repair0', replaces=3D"snap= 1", + target=3Dquorum_repair_img, format=3Diotests.imgfmt) =20 self.complete_and_wait('job0') self.assert_has_block_node("repair0", quorum_repair_img) @@ -1108,15 +1058,13 @@ class TestRepairQuorum(iotests.QMPTestCase): Check that we cannot replace a Quorum child when it has other parents. """ - result =3D self.vm.qmp('nbd-server-start', - addr=3D{ - 'type': 'unix', - 'data': {'path': nbd_sock_path} - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-start', + addr=3D{ + 'type': 'unix', + 'data': {'path': nbd_sock_path} + }) =20 - result =3D self.vm.qmp('nbd-server-add', device=3D'img1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-add', device=3D'img1') =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'mirror', device= =3D'quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D'img1', @@ -1131,20 +1079,17 @@ class TestRepairQuorum(iotests.QMPTestCase): The same as test_with_other_parent(), but add the NBD server only when the mirror job is already running. """ - result =3D self.vm.qmp('nbd-server-start', - addr=3D{ - 'type': 'unix', - 'data': {'path': nbd_sock_path} - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-start', + addr=3D{ + 'type': 'unix', + 'data': {'path': nbd_sock_path} + }) =20 - result =3D self.vm.qmp('drive-mirror', job_id=3D'mirror', device= =3D'quorum0', - sync=3D'full', node_name=3D'repair0', replace= s=3D'img1', - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', job_id=3D'mirror', device=3D'quorum0', + sync=3D'full', node_name=3D'repair0', replaces=3D'img1= ', + target=3Dquorum_repair_img, format=3Diotests.imgfmt) =20 - result =3D self.vm.qmp('nbd-server-add', device=3D'img1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-add', device=3D'img1') =20 # The full error message goes to stderr, we will check it later self.complete_and_wait('mirror', @@ -1200,9 +1145,8 @@ class TestOrphanedSource(iotests.QMPTestCase): def test_success(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('blockdev-mirror', job_id=3D'job', device= =3D'src', - sync=3D'full', target=3D'dest') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', job_id=3D'job', device=3D'src', + sync=3D'full', target=3D'dest') =20 self.complete_and_wait('job') =20 @@ -1218,27 +1162,24 @@ class TestOrphanedSource(iotests.QMPTestCase): =20 # Unshare consistent-read on the target # (The mirror job does not care) - result =3D self.vm.qmp('blockdev-add', - driver=3D'blkdebug', - node_name=3D'dest-perm', - image=3D'dest', - unshare_child_perms=3D['consistent-read']) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + driver=3D'blkdebug', + node_name=3D'dest-perm', + image=3D'dest', + unshare_child_perms=3D['consistent-read']) =20 - result =3D self.vm.qmp('blockdev-mirror', job_id=3D'job', device= =3D'src', - sync=3D'full', target=3D'dest', - filter_node_name=3D'mirror-filter') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', job_id=3D'job', device=3D'src', + sync=3D'full', target=3D'dest', + filter_node_name=3D'mirror-filter') =20 # Require consistent-read on the source # (We can only add this node once the job has started, or it # will complain that it does not want to run on non-root nodes) - result =3D self.vm.qmp('blockdev-add', - driver=3D'blkdebug', - node_name=3D'src-perm', - image=3D'src', - take_child_perms=3D['consistent-read']) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + driver=3D'blkdebug', + node_name=3D'src-perm', + image=3D'src', + take_child_perms=3D['consistent-read']) =20 # While completing, mirror will attempt to replace src by # dest, which must fail because src-perm requires @@ -1278,26 +1219,23 @@ class TestReplaces(iotests.QMPTestCase): """ Check that we can replace filter nodes. """ - result =3D self.vm.qmp('blockdev-add', { - 'driver': 'copy-on-read', - 'node-name': 'filter0', - 'file': { - 'driver': 'copy-on-read', - 'node-name': 'filter1', - 'file': { - 'driver': 'null-co' - } - } - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', { + 'driver': 'copy-on-read', + 'node-name': 'filter0', + 'file': { + 'driver': 'copy-on-read', + 'node-name': 'filter1', + 'file': { + 'driver': 'null-co' + } + } + }) =20 - result =3D self.vm.qmp('blockdev-add', - node_name=3D'target', driver=3D'null-co') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'target', driver=3D'null-co') =20 - result =3D self.vm.qmp('blockdev-mirror', job_id=3D'mirror', devic= e=3D'filter0', - target=3D'target', sync=3D'full', replaces=3D= 'filter1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', job_id=3D'mirror', device=3D'filter= 0', + target=3D'target', sync=3D'full', replaces=3D'filter1') =20 self.complete_and_wait('mirror') =20 @@ -1319,16 +1257,15 @@ class TestFilters(iotests.QMPTestCase): self.vm =3D iotests.VM().add_device('virtio-scsi,id=3Dvio-scsi') self.vm.launch() =20 - result =3D self.vm.qmp('blockdev-add', { - 'node-name': 'target', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': target_img - }, - 'backing': None - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', { + 'node-name': 'target', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': target_img + }, + 'backing': None + }) =20 self.filterless_chain =3D { 'node-name': 'source', @@ -1355,19 +1292,17 @@ class TestFilters(iotests.QMPTestCase): os.remove(backing_img) =20 def test_cor(self): - result =3D self.vm.qmp('blockdev-add', { - 'node-name': 'filter', - 'driver': 'copy-on-read', - 'file': self.filterless_chain - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', { + 'node-name': 'filter', + 'driver': 'copy-on-read', + 'file': self.filterless_chain + }) =20 - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'filter', - target=3D'target', - sync=3D'top') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'filter', + target=3D'target', + sync=3D'top') =20 self.complete_and_wait('mirror') =20 @@ -1384,23 +1319,20 @@ class TestFilters(iotests.QMPTestCase): assert target_map[1]['depth'] =3D=3D 0 =20 def test_implicit_mirror_filter(self): - result =3D self.vm.qmp('blockdev-add', self.filterless_chain) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', self.filterless_chain) =20 # We need this so we can query from above the mirror node - result =3D self.vm.qmp('device_add', - driver=3D'scsi-hd', - id=3D'virtio', - bus=3D'vio-scsi.0', - drive=3D'source') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', + driver=3D'scsi-hd', + id=3D'virtio', + bus=3D'vio-scsi.0', + drive=3D'source') =20 - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'source', - target=3D'target', - sync=3D'top') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + sync=3D'top') =20 # The mirror filter is now an implicit node, so it should be # invisible when querying the backing chain @@ -1418,24 +1350,21 @@ class TestFilters(iotests.QMPTestCase): def test_explicit_mirror_filter(self): # Same test as above, but this time we give the mirror filter # a node-name so it will not be invisible - result =3D self.vm.qmp('blockdev-add', self.filterless_chain) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', self.filterless_chain) =20 # We need this so we can query from above the mirror node - result =3D self.vm.qmp('device_add', - driver=3D'scsi-hd', - id=3D'virtio', - bus=3D'vio-scsi.0', - drive=3D'source') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', + driver=3D'scsi-hd', + id=3D'virtio', + bus=3D'vio-scsi.0', + drive=3D'source') =20 - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'source', - target=3D'target', - sync=3D'top', - filter_node_name=3D'mirror-filter') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + sync=3D'top', + filter_node_name=3D'mirror-filter') =20 # With a node-name given to it, the mirror filter should now # be visible diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index 45eb239baa..a341f21cd7 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -77,8 +77,7 @@ class TestFdSets(iotests.QMPTestCase): self.vm.shutdown() =20 def test_remove_fdset(self): - result =3D self.vm.qmp('remove-fd', fdset_id=3D2) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('remove-fd', fdset_id=3D2) result =3D self.vm.qmp('query-fdsets') self.assert_qmp(result, 'return[0]/fdset-id', 1) self.assert_qmp(result, 'return[1]/fdset-id', 0) @@ -90,8 +89,7 @@ class TestFdSets(iotests.QMPTestCase): def test_remove_fd(self): result =3D self.vm.qmp('query-fdsets') fd_image3 =3D result['return'][0]['fds'][0]['fd'] - result =3D self.vm.qmp('remove-fd', fdset_id=3D2, fd=3Dfd_image3) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('remove-fd', fdset_id=3D2, fd=3Dfd_image3) result =3D self.vm.qmp('query-fdsets') self.assert_qmp(result, 'return[0]/fdset-id', 2) self.assert_qmp(result, 'return[1]/fdset-id', 1) @@ -151,8 +149,7 @@ class TestSCMFd(iotests.QMPTestCase): =20 def test_getfd(self): self._send_fd_by_SCM() - result =3D self.vm.qmp('getfd', fdname=3D'image0:r') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('getfd', fdname=3D'image0:r') =20 def test_getfd_invalid_fdname(self): self._send_fd_by_SCM() @@ -163,10 +160,8 @@ class TestSCMFd(iotests.QMPTestCase): =20 def test_closefd(self): self._send_fd_by_SCM() - result =3D self.vm.qmp('getfd', fdname=3D'image0:r') - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('closefd', fdname=3D'image0:r') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('getfd', fdname=3D'image0:r') + self.vm.cmd('closefd', fdname=3D'image0:r') =20 def test_closefd_fd_not_found(self): fdname =3D 'image0:r' diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index 5d6b607051..d8372b5598 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -69,8 +69,7 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', target=3Dtarget, sy= nc=3D'full') - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', target=3Dtarget, sync=3D'full') =20 event =3D self.cancel_and_wait(resume=3DTrue) self.assert_qmp(event, 'data/type', 'backup') @@ -85,9 +84,8 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', - target=3Dtarget, sync=3D'full') - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', + target=3Dtarget, sync=3D'full') =20 self.pause_job('drive0', wait=3DFalse) self.vm.resume_drive('drive0') @@ -100,8 +98,7 @@ class TestSingleDrive(iotests.QMPTestCase): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/offset', offset) =20 - result =3D self.vm.qmp('block-job-resume', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 self.wait_until_completed() =20 @@ -123,10 +120,9 @@ class TestSingleDrive(iotests.QMPTestCase): result =3D self.vm.qmp('block_resize', node_name=3Dnode, size= =3D65536) self.assert_qmp(result, 'error/class', 'GenericError') =20 - result =3D self.vm.qmp('blockdev-backup', job_id=3D'job0', device= =3D'drive0', - target=3D'drive1', sync=3D'full', auto_finali= ze=3DFalse, - auto_dismiss=3DFalse) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-backup', job_id=3D'job0', device=3D'drive0', + target=3D'drive1', sync=3D'full', auto_finalize=3DFals= e, + auto_dismiss=3DFalse) =20 self.vm.run_job('job0', auto_finalize=3DFalse, pre_finalize=3Dpre_= finalize) =20 @@ -137,8 +133,7 @@ class TestSingleDrive(iotests.QMPTestCase): self.do_test_resize_blockdev_backup('drive1', 'target') =20 def do_test_target_size(self, size): - result =3D self.vm.qmp('block_resize', device=3D'drive1', size=3Ds= ize) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block_resize', device=3D'drive1', size=3Dsize) =20 result =3D self.vm.qmp('blockdev-backup', job_id=3D'job0', device= =3D'drive0', target=3D'drive1', sync=3D'full') @@ -219,16 +214,14 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', target=3Dtarget, sy= nc=3D'full') - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', target=3Dtarget, sync=3D'full') =20 # Default speed is 0 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') self.assert_qmp(result, 'return[0]/speed', 0) =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D8 * 1024 * 1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D8 * = 1024 * 1024) =20 # Ensure the speed we set was accepted result =3D self.vm.qmp('query-block-jobs') @@ -240,9 +233,8 @@ class TestSetSpeed(iotests.QMPTestCase): =20 # Check setting speed option works self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', - target=3Dtarget, sync=3D'full', speed=3D4*102= 4*1024) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', + target=3Dtarget, sync=3D'full', speed=3D4*1024*1024) =20 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') @@ -267,9 +259,8 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', - target=3Dtarget, sync=3D'full') - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', + target=3Dtarget, sync=3D'full') =20 result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D-1) self.assert_qmp(result, 'error/class', 'GenericError') @@ -306,7 +297,7 @@ class TestSingleTransaction(iotests.QMPTestCase): def do_test_cancel(self, cmd, target): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('transaction', actions=3D[{ + self.vm.cmd('transaction', actions=3D[{ 'type': cmd, 'data': { 'device': 'drive0', 'target': target, @@ -315,8 +306,6 @@ class TestSingleTransaction(iotests.QMPTestCase): } ]) =20 - self.assert_qmp(result, 'return', {}) - event =3D self.cancel_and_wait() self.assert_qmp(event, 'data/type', 'backup') =20 @@ -329,7 +318,7 @@ class TestSingleTransaction(iotests.QMPTestCase): def do_test_pause(self, cmd, target, image): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('transaction', actions=3D[{ + self.vm.cmd('transaction', actions=3D[{ 'type': cmd, 'data': { 'device': 'drive0', 'target': target, @@ -337,12 +326,10 @@ class TestSingleTransaction(iotests.QMPTestCase): 'speed': 64 * 1024 }, } ]) - self.assert_qmp(result, 'return', {}) =20 self.pause_job('drive0', wait=3DFalse) =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D0) =20 self.pause_wait('drive0') =20 @@ -353,8 +340,7 @@ class TestSingleTransaction(iotests.QMPTestCase): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/offset', offset) =20 - result =3D self.vm.qmp('block-job-resume', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 self.wait_until_completed() =20 @@ -519,8 +505,7 @@ class TestCompressedToQcow2(iotests.QMPTestCase): =20 self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp(cmd, device=3D'drive0', sync=3D'full', comp= ress=3DTrue, **args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', sync=3D'full', compress=3DTrue= , **args) =20 self.wait_until_completed() =20 @@ -545,8 +530,7 @@ class TestCompressedToQcow2(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', sync=3D'full', comp= ress=3DTrue, **args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', sync=3D'full', compress=3DTrue= , **args) =20 event =3D self.cancel_and_wait(resume=3DTrue) self.assert_qmp(event, 'data/type', 'backup') @@ -568,8 +552,7 @@ class TestCompressedToQcow2(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp(cmd, device=3D'drive0', sync=3D'full', comp= ress=3DTrue, **args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, device=3D'drive0', sync=3D'full', compress=3DTrue= , **args) =20 self.pause_job('drive0', wait=3DFalse) self.vm.resume_drive('drive0') @@ -582,8 +565,7 @@ class TestCompressedToQcow2(iotests.QMPTestCase): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/offset', offset) =20 - result =3D self.vm.qmp('block-job-resume', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') =20 self.wait_until_completed() =20 diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index bef865eec4..808ea6b48a 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -75,9 +75,8 @@ class TestSyncModesNoneAndTop(iotests.QMPTestCase): =20 def test_complete_top(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('drive-backup', device=3D'drive0', sync=3D'= top', - format=3Diotests.imgfmt, target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-backup', device=3D'drive0', sync=3D'top', + format=3Diotests.imgfmt, target=3Dtarget_img) =20 self.wait_until_completed(check_offset=3DFalse) =20 @@ -89,9 +88,8 @@ class TestSyncModesNoneAndTop(iotests.QMPTestCase): def test_cancel_sync_none(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('drive-backup', device=3D'drive0', - sync=3D'none', target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-backup', device=3D'drive0', + sync=3D'none', target=3Dtarget_img) time.sleep(1) self.vm.hmp_qemu_io('drive0', 'write -P0x5e 0 512') self.vm.hmp_qemu_io('drive0', 'aio_flush') @@ -115,18 +113,15 @@ class TestBeforeWriteNotifier(iotests.QMPTestCase): =20 def test_before_write_notifier(self): self.vm.pause_drive("drive0") - result =3D self.vm.qmp('drive-backup', device=3D'drive0', - sync=3D'full', target=3Dtarget_img, - format=3D"file", speed=3D1) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('block-job-pause', device=3D"drive0") - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-backup', device=3D'drive0', + sync=3D'full', target=3Dtarget_img, + format=3D"file", speed=3D1) + self.vm.cmd('block-job-pause', device=3D"drive0") # Speed is low enough that this must be an uncopied range, which w= ill # trigger the before write notifier self.vm.hmp_qemu_io('drive0', 'aio_write -P 1 512512 512') self.vm.resume_drive("drive0") - result =3D self.vm.qmp('block-job-resume', device=3D"drive0") - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-resume', device=3D"drive0") event =3D self.cancel_and_wait() self.assert_qmp(event, 'data/type', 'backup') =20 @@ -191,8 +186,7 @@ class BackupTest(iotests.QMPTestCase): self.qmp_backup_and_wait(device=3D'drive0', format=3Diotests.imgfm= t, sync=3D'full', target=3Dself.ref_img, auto_dismiss=3DFalse) - res =3D self.vm.qmp('block-job-dismiss', id=3D'drive0') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-dismiss', id=3D'drive0') =20 # Now to the test backup: We simulate the following guest # writes: @@ -211,11 +205,9 @@ class BackupTest(iotests.QMPTestCase): ('66', '1M', '1M')]) =20 # Let the job complete - res =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', spee= d=3D0) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D0) self.qmp_backup_wait('drive0') - res =3D self.vm.qmp('block-job-dismiss', id=3D'drive0') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-dismiss', id=3D'drive0') =20 self.assertTrue(iotests.compare_images(self.ref_img, self.dest_img= ), 'target image does not match reference image') @@ -237,8 +229,7 @@ class BackupTest(iotests.QMPTestCase): auto_dismiss=3DFalse) res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return[0]/status', 'concluded') - res =3D self.vm.qmp('block-job-dismiss', id=3D'drive0') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-dismiss', id=3D'drive0') res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return', []) =20 @@ -263,8 +254,7 @@ class BackupTest(iotests.QMPTestCase): auto_dismiss=3DFalse) self.assertEqual(res, False) # OK, dismiss the zombie. - res =3D self.vm.qmp('block-job-dismiss', id=3D'drive0') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-dismiss', id=3D'drive0') res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return', []) # Ensure it's really gone. @@ -281,23 +271,22 @@ class BackupTest(iotests.QMPTestCase): ('0x55', '8M', '352k'), ('0x78', '15872k', '1M'))) # Add destination node via blkdebug - res =3D self.vm.qmp('blockdev-add', - node_name=3D'target0', - driver=3Diotests.imgfmt, - file=3D{ - 'driver': 'blkdebug', - 'image': { - 'driver': 'file', - 'filename': self.dest_img - }, - 'inject-error': [{ - 'event': 'write_aio', - 'errno': 5, - 'immediately': False, - 'once': True - }], - }) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'target0', + driver=3Diotests.imgfmt, + file=3D{ + 'driver': 'blkdebug', + 'image': { + 'driver': 'file', + 'filename': self.dest_img + }, + 'inject-error': [{ + 'event': 'write_aio', + 'errno': 5, + 'immediately': False, + 'once': True + }], + }) =20 res =3D self.qmp_backup(cmd=3D'blockdev-backup', device=3D'drive0', target=3D'target0', @@ -323,8 +312,7 @@ class BackupTest(iotests.QMPTestCase): res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return[0]/status', 'paused') # OK, unstick job and move forward. - res =3D self.vm.qmp('block-job-resume', device=3D'drive0') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-resume', device=3D'drive0') # And now we need to wait for it to conclude; res =3D self.qmp_backup_wait(device=3D'drive0') self.assertTrue(res) @@ -332,8 +320,7 @@ class BackupTest(iotests.QMPTestCase): # Job should now be languishing: res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return[0]/status', 'concluded') - res =3D self.vm.qmp('block-job-dismiss', id=3D'drive0') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-dismiss', id=3D'drive0') res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return', []) =20 diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 93274dc8cb..4f9e224e8a 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -55,8 +55,7 @@ class ThrottleTestCase(iotests.QMPTestCase): # Set the I/O throttling parameters to all drives for i in range(0, ndrives): params['device'] =3D 'drive%d' % i - result =3D self.vm.qmp("block_set_io_throttle", conv_keys=3DFa= lse, **params) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("block_set_io_throttle", conv_keys=3DFalse, **para= ms) =20 def do_test_throttle(self, ndrives, seconds, params, first_drive =3D 0= ): def check_limit(limit, num): @@ -253,8 +252,7 @@ class ThrottleTestCase(iotests.QMPTestCase): # drive1 remains in the group with a throttled request. params['bps_rd'] =3D 0 params['device'] =3D 'drive0' - result =3D self.vm.qmp("block_set_io_throttle", conv_keys=3DFalse,= **params) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("block_set_io_throttle", conv_keys=3DFalse, **params) =20 # Removing the I/O limits from drive0 drains its two pending reque= sts. # The read request in drive1 is still throttled. @@ -286,8 +284,7 @@ class ThrottleTestGroupNames(iotests.QMPTestCase): =20 def set_io_throttle(self, device, params): params["device"] =3D device - result =3D self.vm.qmp("block_set_io_throttle", conv_keys=3DFalse,= **params) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("block_set_io_throttle", conv_keys=3DFalse, **params) =20 def verify_name(self, device, name): result =3D self.vm.qmp("query-block") @@ -379,23 +376,19 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): =20 def test_removable_media(self): # Add a couple of dummy nodes named cd0 and cd1 - result =3D self.vm.qmp("blockdev-add", driver=3D"null-co", - read_zeroes=3DTrue, node_name=3D"cd0") - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp("blockdev-add", driver=3D"null-co", - read_zeroes=3DTrue, node_name=3D"cd1") - self.assert_qmp(result, 'return', {}) + self.vm.cmd("blockdev-add", driver=3D"null-co", + read_zeroes=3DTrue, node_name=3D"cd0") + self.vm.cmd("blockdev-add", driver=3D"null-co", + read_zeroes=3DTrue, node_name=3D"cd1") =20 # Attach a CD drive with cd0 inserted - result =3D self.vm.qmp("device_add", driver=3D"scsi-cd", - id=3D"dev0", drive=3D"cd0") - self.assert_qmp(result, 'return', {}) + self.vm.cmd("device_add", driver=3D"scsi-cd", + id=3D"dev0", drive=3D"cd0") =20 # Set I/O limits args =3D { "id": "dev0", "iops": 100, "iops_rd": 0, "iops_wr": 0, "bps": 50, "bps_rd": 0, "bps_wr": 0 } - result =3D self.vm.qmp("block_set_io_throttle", conv_keys=3DFalse,= **args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("block_set_io_throttle", conv_keys=3DFalse, **args) =20 # Check that the I/O limits have been set result =3D self.vm.qmp("query-block") @@ -403,12 +396,9 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): self.assert_qmp(result, 'return[0]/inserted/bps', 50) =20 # Now eject cd0 and insert cd1 - result =3D self.vm.qmp("blockdev-open-tray", id=3D'dev0') - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp("blockdev-remove-medium", id=3D'dev0') - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp("blockdev-insert-medium", id=3D'dev0', node= _name=3D'cd1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd("blockdev-open-tray", id=3D'dev0') + self.vm.cmd("blockdev-remove-medium", id=3D'dev0') + self.vm.cmd("blockdev-insert-medium", id=3D'dev0', node_name=3D'cd= 1') =20 # Check that the I/O limits are still the same result =3D self.vm.qmp("query-block") @@ -416,16 +406,14 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): self.assert_qmp(result, 'return[0]/inserted/bps', 50) =20 # Eject cd1 - result =3D self.vm.qmp("blockdev-remove-medium", id=3D'dev0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd("blockdev-remove-medium", id=3D'dev0') =20 # Check that we can't set limits if the device has no medium result =3D self.vm.qmp("block_set_io_throttle", conv_keys=3DFalse,= **args) self.assert_qmp(result, 'error/class', 'GenericError') =20 # Remove the CD drive - result =3D self.vm.qmp("device_del", id=3D'dev0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd("device_del", id=3D'dev0') =20 =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index cae52ffa5e..10dc47459f 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -74,11 +74,9 @@ class ChangeBaseClass(iotests.QMPTestCase): class GeneralChangeTestsBaseClass(ChangeBaseClass): =20 def test_blockdev_change_medium(self): - result =3D self.vm.qmp('blockdev-change-medium', - id=3Dself.device_name, filename=3Dnew_img, - format=3Diotests.imgfmt) - - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', + id=3Dself.device_name, filename=3Dnew_img, + format=3Diotests.imgfmt) =20 self.wait_for_open() self.wait_for_close() @@ -89,8 +87,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) =20 def test_eject(self): - result =3D self.vm.qmp('eject', id=3Dself.device_name, force=3DTru= e) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('eject', id=3Dself.device_name, force=3DTrue) =20 self.wait_for_open() =20 @@ -100,8 +97,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp_absent(result, 'return[0]/inserted') =20 def test_tray_eject_change(self): - result =3D self.vm.qmp('eject', id=3Dself.device_name, force=3DTru= e) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('eject', id=3Dself.device_name, force=3DTrue) =20 self.wait_for_open() =20 @@ -110,9 +106,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp(result, 'return[0]/tray_open', True) self.assert_qmp_absent(result, 'return[0]/inserted') =20 - result =3D self.vm.qmp('blockdev-change-medium', id=3Dself.device_= name, - filename=3Dnew_img, format=3Diotests.imgfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', id=3Dself.device_name, + filename=3Dnew_img, format=3Diotests.imgfmt) =20 self.wait_for_close() =20 @@ -122,9 +117,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) =20 def test_tray_open_close(self): - result =3D self.vm.qmp('blockdev-open-tray', - id=3Dself.device_name, force=3DTrue) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-open-tray', + id=3Dself.device_name, force=3DTrue) =20 self.wait_for_open() =20 @@ -136,8 +130,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): else: self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) =20 - result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device_nam= e) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-close-tray', id=3Dself.device_name) =20 if self.has_real_tray or not self.was_empty: self.wait_for_close() @@ -151,8 +144,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) =20 def test_tray_eject_close(self): - result =3D self.vm.qmp('eject', id=3Dself.device_name, force=3DTru= e) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('eject', id=3Dself.device_name, force=3DTrue) =20 self.wait_for_open() =20 @@ -161,8 +153,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp(result, 'return[0]/tray_open', True) self.assert_qmp_absent(result, 'return[0]/inserted') =20 - result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device_nam= e) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-close-tray', id=3Dself.device_name) =20 self.wait_for_close() =20 @@ -172,9 +163,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp_absent(result, 'return[0]/inserted') =20 def test_tray_open_change(self): - result =3D self.vm.qmp('blockdev-open-tray', id=3Dself.device_name, - force=3DTrue) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-open-tray', id=3Dself.device_name, + force=3DTrue) =20 self.wait_for_open() =20 @@ -186,10 +176,9 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): else: self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) =20 - result =3D self.vm.qmp('blockdev-change-medium', id=3Dself.device_= name, - filename=3Dnew_img, - format=3Diotests.im= gfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt) =20 self.wait_for_close() =20 @@ -199,17 +188,15 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) =20 def test_cycle(self, read_only_node=3DFalse): - result =3D self.vm.qmp('blockdev-add', - node_name=3D'new', - driver=3Diotests.imgfmt, - read_only=3Dread_only_node, - file=3D{'filename': new_img, - 'driver': 'file'}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'new', + driver=3Diotests.imgfmt, + read_only=3Dread_only_node, + file=3D{'filename': new_img, + 'driver': 'file'}) =20 - result =3D self.vm.qmp('blockdev-open-tray', - id=3Dself.device_name, force=3DTrue) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-open-tray', + id=3Dself.device_name, force=3DTrue) =20 self.wait_for_open() =20 @@ -221,26 +208,23 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): else: self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) =20 - result =3D self.vm.qmp('blockdev-remove-medium', - id=3Dself.device_name) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-remove-medium', + id=3Dself.device_name) =20 result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', True) self.assert_qmp_absent(result, 'return[0]/inserted') =20 - result =3D self.vm.qmp('blockdev-insert-medium', - id=3Dself.device_name, node_name=3D'new') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-insert-medium', + id=3Dself.device_name, node_name=3D'new') =20 result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', True) self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) =20 - result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device_nam= e) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-close-tray', id=3Dself.device_name) =20 self.wait_for_close() =20 @@ -253,9 +237,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): self.test_cycle(True) =20 def test_close_on_closed(self): - result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device_nam= e) # Should be a no-op - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-close-tray', id=3Dself.device_name) self.assertEqual(self.vm.get_qmp_events(wait=3DFalse), []) =20 def test_remove_on_closed(self): @@ -269,12 +252,11 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): if not self.has_real_tray: return =20 - result =3D self.vm.qmp('blockdev-add', - node_name=3D'new', - driver=3Diotests.imgfmt, - file=3D{'filename': new_img, - 'driver': 'file'}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'new', + driver=3Diotests.imgfmt, + file=3D{'filename': new_img, + 'driver': 'file'}) =20 result =3D self.vm.qmp('blockdev-insert-medium', id=3Dself.device_= name, node_name=3D'new') @@ -307,15 +289,13 @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass= ): os.remove(new_img) =20 def test_insert_on_filled(self): - result =3D self.vm.qmp('blockdev-add', - node_name=3D'new', - driver=3Diotests.imgfmt, - file=3D{'filename': new_img, - 'driver': 'file'}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'new', + driver=3Diotests.imgfmt, + file=3D{'filename': new_img, + 'driver': 'file'}) =20 - result =3D self.vm.qmp('blockdev-open-tray', id=3Dself.device_name) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-open-tray', id=3Dself.device_name) =20 self.wait_for_open() =20 @@ -344,14 +324,12 @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass): os.remove(new_img) =20 def test_remove_on_empty(self): - result =3D self.vm.qmp('blockdev-open-tray', id=3Dself.device_name) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-open-tray', id=3Dself.device_name) =20 self.wait_for_open() =20 - result =3D self.vm.qmp('blockdev-remove-medium', id=3Dself.device_= name) # Should be a no-op - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-remove-medium', id=3Dself.device_name) =20 # Do this in a function to avoid leaking variables like case into the glob= al # name space (otherwise tests would be run for the abstract base classes) @@ -399,11 +377,10 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', True) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-change-medium', id=3Dself.device_= name, - filename=3Dnew_img, - format=3Diotests.im= gfmt, - read_only_mode=3D'r= etain') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt, + read_only_mode=3D'retain') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) @@ -419,11 +396,10 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', True) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-change-medium', id=3Dself.device_= name, - filename=3Dnew_img, - format=3Diotests.im= gfmt, - read_only_mode=3D'r= etain') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt, + read_only_mode=3D'retain') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) @@ -462,12 +438,11 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', True) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-change-medium', - id=3Dself.device_name, - filename=3Dnew_img, - format=3Diotests.imgfmt, - read_only_mode=3D'read-write') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', + id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt, + read_only_mode=3D'read-write') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) @@ -483,12 +458,11 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', False) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-change-medium', - id=3Dself.device_name, - filename=3Dnew_img, - format=3Diotests.imgfmt, - read_only_mode=3D'read-only') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', + id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt, + read_only_mode=3D'read-only') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) @@ -503,12 +477,11 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', False) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-change-medium', - id=3Dself.device_name, - filename=3Dnew_img, - format=3Diotests.imgfmt, - read_only_mode=3D'read-only') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', + id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt, + read_only_mode=3D'read-only') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) @@ -546,11 +519,10 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', True) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-change-medium', id=3Dself.device_= name, - filename=3Dnew_img, - format=3Diotests.im= gfmt, - read_only_mode=3D'r= etain') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-change-medium', id=3Dself.device_name, + filename=3Dnew_img, + format=3Diotests.imgfmt, + read_only_mode=3D'retain') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) @@ -587,27 +559,24 @@ class TestChangeReadOnly(ChangeBaseClass): self.assert_qmp(result, 'return[0]/inserted/ro', False) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-add', - node_name=3D'new', - driver=3Diotests.imgfmt, - read_only=3DTrue, - file=3D{'filename': new_img, - 'driver': 'file'}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'new', + driver=3Diotests.imgfmt, + read_only=3DTrue, + file=3D{'filename': new_img, + 'driver': 'file'}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) =20 - result =3D self.vm.qmp('blockdev-remove-medium', id=3Dself.device_= name) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-remove-medium', id=3Dself.device_name) =20 result =3D self.vm.qmp('query-block') self.assert_qmp_absent(result, 'return[0]/inserted') =20 - result =3D self.vm.qmp('blockdev-insert-medium', id=3Dself.device_= name, - node_name=3D'new') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-insert-medium', id=3Dself.device_name, + node_name=3D'new') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) @@ -638,22 +607,19 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): =20 # For device-less BBs, calling blockdev-open-tray or blockdev-clos= e-tray # is not necessary - result =3D self.vm.qmp('blockdev-remove-medium', id=3Dself.device_= name) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-remove-medium', id=3Dself.device_name) =20 result =3D self.vm.qmp('query-block') self.assert_qmp_absent(result, 'return[0]/inserted') =20 - result =3D self.vm.qmp('blockdev-add', - node_name=3D'node0', - driver=3Diotests.imgfmt, - file=3D{'filename': old_img, - 'driver': 'file'}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3D'node0', + driver=3Diotests.imgfmt, + file=3D{'filename': old_img, + 'driver': 'file'}) =20 - result =3D self.vm.qmp('blockdev-insert-medium', id=3Dself.device_= name, - node_name=3D'node0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-insert-medium', id=3Dself.device_name, + node_name=3D'node0') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) @@ -670,10 +636,9 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): @iotests.skip_for_formats(('vpc', 'parallels', 'qcow', 'vdi', 'vmdk', = 'raw', 'vhdx')) def test_snapshot_and_commit(self): - result =3D self.vm.qmp('blockdev-snapshot-sync', device=3D'drive0', - snapshot_file=3Dnew= _img, - format=3Diotests.im= gfmt) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-snapshot-sync', device=3D'drive0', + snapshot_file=3Dnew_img, + format=3Diotests.imgfmt) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) @@ -681,16 +646,14 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): 'return[0]/inserted/image/backing-image/filename', old_img) =20 - result =3D self.vm.qmp('block-commit', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'drive0') =20 self.vm.event_wait(name=3D'BLOCK_JOB_READY') =20 result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return[0]/device', 'drive0') =20 - result =3D self.vm.qmp('block-job-complete', device=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3D'drive0') =20 self.vm.event_wait(name=3D'BLOCK_JOB_COMPLETED') =20 diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 845ab5303c..b2f4328e34 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -24,6 +24,7 @@ import os import iotests from iotests import try_remove +from qemu.qmp.qmp_client import ExecuteError =20 =20 def io_write_patterns(img, patterns): @@ -141,8 +142,7 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): =20 =20 def do_qmp_backup(self, error=3D'Input/output error', **kwargs): - res =3D self.vm.qmp('drive-backup', **kwargs) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('drive-backup', **kwargs) return self.wait_qmp_backup(kwargs['device'], error) =20 =20 @@ -201,9 +201,8 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): def add_bitmap(self, name, drive, **kwargs): bitmap =3D Bitmap(name, drive) self.bitmaps.append(bitmap) - result =3D self.vm.qmp('block-dirty-bitmap-add', node=3Ddrive['id'= ], - name=3Dbitmap.name, **kwargs) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-dirty-bitmap-add', node=3Ddrive['id'], + name=3Dbitmap.name, **kwargs) return bitmap =20 =20 @@ -388,13 +387,12 @@ class TestIncrementalBackup(TestIncrementalBackupBase= ): ('0x64', '32736k', '64k'))) bitmap1 =3D self.add_bitmap('bitmap1', drive0) =20 - result =3D self.vm.qmp('transaction', actions=3D[ + self.vm.cmd('transaction', actions=3D[ transaction_bitmap_clear(bitmap0.drive['id'], bitmap0.name), transaction_bitmap_clear(bitmap1.drive['id'], bitmap1.name), transaction_drive_backup(drive0['id'], drive0['backup'], sync=3D'full', format=3Ddrive0['fmt']) ]) - self.assert_qmp(result, 'return', {}) self.wait_until_completed(drive0['id']) self.files.append(drive0['backup']) =20 @@ -417,7 +415,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): ('0xcd', '32M', '124k'))) =20 # Create a blkdebug interface to this img as 'drive1' - result =3D self.vm.qmp('blockdev-add', + self.vm.cmd('blockdev-add', node_name=3Ddrive1['id'], driver=3Ddrive1['fmt'], file=3D{ @@ -440,7 +438,6 @@ class TestIncrementalBackup(TestIncrementalBackupBase): }], } ) - self.assert_qmp(result, 'return', {}) =20 # Create bitmaps and full backups for both drives drive0 =3D self.drives[0] @@ -475,9 +472,8 @@ class TestIncrementalBackup(TestIncrementalBackupBase): format=3Ddrive1['fmt'], mode=3D'exist= ing', bitmap=3Ddr1bm0.name) ] - result =3D self.vm.qmp('transaction', actions=3Dtransaction, - properties=3D{'completion-mode': 'grouped'} ) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('transaction', actions=3Dtransaction, + properties=3D{'completion-mode': 'grouped'} ) =20 # Observe that drive0's backup is cancelled and drive1 completes w= ith # an error. @@ -504,9 +500,8 @@ class TestIncrementalBackup(TestIncrementalBackupBase): target1 =3D self.prepare_backup(dr1bm0) =20 # Re-run the exact same transaction. - result =3D self.vm.qmp('transaction', actions=3Dtransaction, - properties=3D{'completion-mode':'grouped'}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('transaction', actions=3Dtransaction, + properties=3D{'completion-mode':'grouped'}) =20 # Both should complete successfully this time. self.assertTrue(self.wait_qmp_backup(drive0['id'])) @@ -567,7 +562,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): The granularity must always be a power of 2. ''' self.assert_no_active_block_jobs() - self.assertRaises(AssertionError, self.add_bitmap, + self.assertRaises(ExecuteError, self.add_bitmap, 'bitmap0', self.drives[0], granularity=3D64000) =20 @@ -585,9 +580,8 @@ class TestIncrementalBackup(TestIncrementalBackupBase): =20 self.add_bitmap('bitmap0', self.drives[0]) =20 - res =3D self.vm.qmp('block_resize', device=3Dself.drives[0]['id'], - size=3D(65 * 1048576)) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block_resize', device=3Dself.drives[0]['id'], + size=3D(65 * 1048576)) =20 # Dirty the image past the old end self.vm.hmp_qemu_io(self.drives[0]['id'], 'write 64M 64k') @@ -617,7 +611,7 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): ''' =20 drive0 =3D self.drives[0] - result =3D self.vm.qmp('blockdev-add', + self.vm.cmd('blockdev-add', node_name=3Ddrive0['id'], driver=3Ddrive0['fmt'], file=3D{ @@ -640,7 +634,6 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): }], } ) - self.assert_qmp(result, 'return', {}) =20 self.create_anchor_backup(drive0) self.add_bitmap('bitmap0', drive0) @@ -668,29 +661,28 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): drive0 =3D self.drives[0] # NB: The blkdebug script here looks for a "flush, read" pattern. # The flush occurs in hmp_io_writes, and the read during the block= job. - result =3D self.vm.qmp('blockdev-add', - node_name=3Ddrive0['id'], - driver=3Ddrive0['fmt'], - file=3D{ - 'driver': 'blkdebug', - 'image': { - 'driver': 'file', - 'filename': drive0['file'] - }, - 'set-state': [{ - 'event': 'flush_to_disk', - 'state': 1, - 'new_state': 2 - }], - 'inject-error': [{ - 'event': 'read_aio', - 'errno': 5, - 'state': 2, - 'immediately': False, - 'once': True - }], - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + node_name=3Ddrive0['id'], + driver=3Ddrive0['fmt'], + file=3D{ + 'driver': 'blkdebug', + 'image': { + 'driver': 'file', + 'filename': drive0['file'] + }, + 'set-state': [{ + 'event': 'flush_to_disk', + 'state': 1, + 'new_state': 2 + }], + 'inject-error': [{ + 'event': 'read_aio', + 'errno': 5, + 'state': 2, + 'immediately': False, + 'once': True + }], + }) self.create_anchor_backup(drive0) bitmap =3D self.add_bitmap('bitmap0', drive0) =20 @@ -711,16 +703,15 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): # Start backup parent, _ =3D bitmap.last_target() target =3D self.prepare_backup(bitmap, parent) - res =3D self.vm.qmp('drive-backup', - job_id=3Dbitmap.drive['id'], - device=3Dbitmap.drive['id'], - sync=3D'incremental', - bitmap=3Dbitmap.name, - format=3Dbitmap.drive['fmt'], - target=3Dtarget, - mode=3D'existing', - on_source_error=3D'stop') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('drive-backup', + job_id=3Dbitmap.drive['id'], + device=3Dbitmap.drive['id'], + sync=3D'incremental', + bitmap=3Dbitmap.name, + format=3Dbitmap.drive['fmt'], + target=3Dtarget, + mode=3D'existing', + on_source_error=3D'stop') =20 # Wait for the error event =3D self.vm.event_wait(name=3D"BLOCK_JOB_ERROR", @@ -739,8 +730,7 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): })) =20 # Resume and check incremental backup for consistency - res =3D self.vm.qmp('block-job-resume', device=3Dbitmap.drive['id'= ]) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-resume', device=3Dbitmap.drive['id']) self.wait_qmp_backup(bitmap.drive['id']) =20 # Bitmap Status Check diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 index e1536ee3c3..97773cd96d 100755 --- a/tests/qemu-iotests/129 +++ b/tests/qemu-iotests/129 @@ -55,11 +55,9 @@ class TestStopWithBlockJob(iotests.QMPTestCase): def do_test_stop(self, cmd, **args): """Test 'stop' while block job is running on a throttled drive. The 'stop' command shouldn't drain the job""" - result =3D self.vm.qmp(cmd, **args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(cmd, **args) =20 - result =3D self.vm.qmp("stop") - self.assert_qmp(result, 'return', {}) + self.vm.cmd("stop") result =3D self.vm.qmp("query-block-jobs") =20 self.assert_qmp(result, 'return[0]/status', 'running') @@ -87,7 +85,7 @@ class TestStopWithBlockJob(iotests.QMPTestCase): iotests.qemu_img('create', '-f', iotests.imgfmt, self.overlay_img, '1G') =20 - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'overlay', 'driver': iotests.imgfmt, 'file': { @@ -95,11 +93,9 @@ class TestStopWithBlockJob(iotests.QMPTestCase): 'filename': self.overlay_img } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-snapshot', - node=3D'source', overlay=3D'overlay') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-snapshot', + node=3D'source', overlay=3D'overlay') =20 self.do_test_stop('block-commit', device=3D'drive0', top_node=3D's= ource') =20 diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index 367ea08036..12a64b3d95 100755 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -47,9 +47,8 @@ class TestSingleDrive(iotests.QMPTestCase): pass =20 def test_mirror_discard(self): - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + target=3Dtarget_img) self.vm.hmp_qemu_io('drive0', 'discard 0 64k') self.complete_and_wait('drive0') self.vm.shutdown() diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index 178b1ee230..ebb4cd62b6 100755 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -58,8 +58,7 @@ class TestBlockdevDel(iotests.QMPTestCase): 'file': {'driver': 'file', 'node-name': file_node, 'filename': base_img}} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) self.checkBlockDriverState(node) self.checkBlockDriverState(file_node) =20 @@ -73,8 +72,7 @@ class TestBlockdevDel(iotests.QMPTestCase): 'backing': None, 'file': {'driver': 'file', 'filename': new_img}} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) self.checkBlockDriverState(node) =20 # Delete a BlockDriverState @@ -89,17 +87,14 @@ class TestBlockdevDel(iotests.QMPTestCase): =20 # Add a device model def addDeviceModel(self, device, backend, driver =3D 'virtio-blk'): - result =3D self.vm.qmp('device_add', id =3D device, - driver =3D driver, drive =3D backend) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', id =3D device, + driver =3D driver, drive =3D backend) =20 # Delete a device model def delDeviceModel(self, device, is_virtio_blk =3D True): - result =3D self.vm.qmp('device_del', id =3D device) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_del', id =3D device) =20 - result =3D self.vm.qmp('system_reset') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('system_reset') =20 if is_virtio_blk: device_path =3D '/machine/peripheral/%s/virtio-backend' % devi= ce @@ -126,9 +121,8 @@ class TestBlockdevDel(iotests.QMPTestCase): # Insert a BlockDriverState def insertDrive(self, device, node): self.checkBlockDriverState(node) - result =3D self.vm.qmp('blockdev-insert-medium', - id =3D device, node_name =3D node) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-insert-medium', + id =3D device, node_name =3D node) self.checkBlockDriverState(node) =20 # Create a snapshot using 'blockdev-snapshot-sync' @@ -139,8 +133,7 @@ class TestBlockdevDel(iotests.QMPTestCase): 'snapshot-file': new_img, 'snapshot-node-name': overlay, 'format': iotests.imgfmt} - result =3D self.vm.qmp('blockdev-snapshot-sync', conv_keys=3DFalse= , **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-snapshot-sync', conv_keys=3DFalse, **opts) self.checkBlockDriverState(node) self.checkBlockDriverState(overlay) =20 @@ -148,9 +141,8 @@ class TestBlockdevDel(iotests.QMPTestCase): def createSnapshot(self, node, overlay): self.checkBlockDriverState(node) self.checkBlockDriverState(overlay) - result =3D self.vm.qmp('blockdev-snapshot', - node =3D node, overlay =3D overlay) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-snapshot', + node =3D node, overlay =3D overlay) self.checkBlockDriverState(node) self.checkBlockDriverState(overlay) =20 @@ -163,14 +155,12 @@ class TestBlockdevDel(iotests.QMPTestCase): 'node-name': new_node, 'sync': 'top', 'format': iotests.imgfmt} - result =3D self.vm.qmp('drive-mirror', conv_keys=3DFalse, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', conv_keys=3DFalse, **opts) self.checkBlockDriverState(new_node) =20 # Complete an existing block job def completeBlockJob(self, id, node_before, node_after): - result =3D self.vm.qmp('block-job-complete', device=3Did) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3Did) self.wait_until_completed(id) =20 # Add a BlkDebug node @@ -186,8 +176,7 @@ class TestBlockdevDel(iotests.QMPTestCase): opts =3D {'driver': 'blkdebug', 'node-name': debug, 'image': image} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) self.checkBlockDriverState(node) self.checkBlockDriverState(debug) =20 @@ -211,8 +200,7 @@ class TestBlockdevDel(iotests.QMPTestCase): 'node-name': blkverify, 'test': node_0, 'raw': node_1} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) self.checkBlockDriverState(test) self.checkBlockDriverState(raw) self.checkBlockDriverState(blkverify) @@ -235,8 +223,7 @@ class TestBlockdevDel(iotests.QMPTestCase): 'node-name': quorum, 'vote-threshold': 1, 'children': [ child_0, child_1 ]} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) self.checkBlockDriverState(child0) self.checkBlockDriverState(child1) self.checkBlockDriverState(quorum) diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 08111c5108..6d6f077a14 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -58,8 +58,7 @@ class NBDBlockdevAddBase(iotests.QMPTestCase): def client_test(self, filename, address, export=3DNone, node_name=3D'nbd-blockdev', delete=3DTrue): bao =3D self.blockdev_add_options(address, export, node_name) - result =3D self.vm.qmp('blockdev-add', bao) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', bao) =20 found =3D False result =3D self.vm.qmp('query-named-block-nodes') @@ -75,8 +74,7 @@ class NBDBlockdevAddBase(iotests.QMPTestCase): self.assertTrue(found) =20 if delete: - result =3D self.vm.qmp('blockdev-del', node_name=3Dnode_name) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3Dnode_name) =20 =20 class QemuNBD(NBDBlockdevAddBase): @@ -158,17 +156,14 @@ class BuiltinNBD(NBDBlockdevAddBase): self.assert_qmp(result, 'return', {}) =20 if export_name is None: - result =3D self.server.qmp('nbd-server-add', device=3D'nbd-exp= ort') - self.assert_qmp(result, 'return', {}) + self.server.cmd('nbd-server-add', device=3D'nbd-export') else: - result =3D self.server.qmp('nbd-server-add', device=3D'nbd-exp= ort', - name=3Dexport_name) - self.assert_qmp(result, 'return', {}) + self.server.cmd('nbd-server-add', device=3D'nbd-export', + name=3Dexport_name) =20 if export_name2 is not None: - result =3D self.server.qmp('nbd-server-add', device=3D'nbd-exp= ort', - name=3Dexport_name2) - self.assert_qmp(result, 'return', {}) + self.server.cmd('nbd-server-add', device=3D'nbd-export', + name=3Dexport_name2) =20 return True =20 @@ -176,8 +171,7 @@ class BuiltinNBD(NBDBlockdevAddBase): self.assertTrue(self._try_server_up(address, export_name, export_n= ame2)) =20 def _server_down(self): - result =3D self.server.qmp('nbd-server-stop') - self.assert_qmp(result, 'return', {}) + self.server.cmd('nbd-server-stop') =20 def do_test_inet(self, export_name=3DNone): while True: @@ -219,10 +213,8 @@ class BuiltinNBD(NBDBlockdevAddBase): flatten_sock_addr(address), 'exp1', 'node1', Fals= e) self.client_test('nbd://localhost:%i/%s' % (nbd_port, 'exp2'), flatten_sock_addr(address), 'exp2', 'node2', Fals= e) - result =3D self.vm.qmp('blockdev-del', node_name=3D'node1') - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('blockdev-del', node_name=3D'node2') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'node1') + self.vm.cmd('blockdev-del', node_name=3D'node2') self._server_down() =20 def test_inet6(self): @@ -273,8 +265,7 @@ class BuiltinNBD(NBDBlockdevAddBase): result =3D self.vm.send_fd_scm(fd=3Dsockfd.fileno()) self.assertEqual(result, 0, 'Failed to send socket FD') =20 - result =3D self.vm.qmp('getfd', fdname=3D'nbd-fifo') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('getfd', fdname=3D'nbd-fifo') =20 address =3D { 'type': 'fd', 'data': { 'str': 'nbd-fifo' } } diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 668d0c1e9c..f2ff9c5dac 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -79,14 +79,13 @@ class TestActiveMirror(iotests.QMPTestCase): self.vm.hmp_qemu_io('source', 'aio_write -z %i 1M' % offset) =20 # Start the block job - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - filter_node_name=3D'mirror-node', - device=3D'source-node', - target=3D'target-node', - sync=3D'full', - copy_mode=3D'write-blocking') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + filter_node_name=3D'mirror-node', + device=3D'source-node', + target=3D'target-node', + sync=3D'full', + copy_mode=3D'write-blocking') =20 # Start some more requests for offset in range(3 * self.image_len // 8, 5 * self.image_len //= 8, 1024 * 1024): @@ -125,23 +124,21 @@ class TestActiveMirror(iotests.QMPTestCase): result =3D self.vm.hmp_qemu_io('source', 'write -P 1 0 2M') =20 # Start the block job (very slowly) - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - filter_node_name=3D'mirror-node', - device=3D'source-node', - target=3D'target-node', - sync=3D'full', - copy_mode=3D'write-blocking', - buf_size=3D(1048576 // 4), - speed=3D1) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + filter_node_name=3D'mirror-node', + device=3D'source-node', + target=3D'target-node', + sync=3D'full', + copy_mode=3D'write-blocking', + buf_size=3D(1048576 // 4), + speed=3D1) =20 # Start an unaligned request to a dirty area result =3D self.vm.hmp_qemu_io('source', 'write -P 2 %i 1' % (1048= 576 + 42)) =20 # Let the job finish - result =3D self.vm.qmp('block-job-set-speed', device=3D'mirror', s= peed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'mirror', speed=3D0) self.complete_and_wait(drive=3D'mirror') =20 self.potential_writes_in_flight =3D False @@ -151,15 +148,14 @@ class TestActiveMirror(iotests.QMPTestCase): result =3D self.vm.hmp_qemu_io('source', 'write -P 1 0 2M') =20 # Start the block job (very slowly) - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - filter_node_name=3D'mirror-node', - device=3D'source-node', - target=3D'target-node', - sync=3D'full', - copy_mode=3D'write-blocking', - speed=3D1) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + filter_node_name=3D'mirror-node', + device=3D'source-node', + target=3D'target-node', + sync=3D'full', + copy_mode=3D'write-blocking', + speed=3D1) =20 self.vm.hmp_qemu_io('source', 'break write_aio A') self.vm.hmp_qemu_io('source', 'aio_write 0 1M') # 1 @@ -190,8 +186,7 @@ class TestActiveMirror(iotests.QMPTestCase): # After resuming 4, one of 2 and 3 goes first and set in_flight_bi= tmap, # so the other will wait for it. =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'mirror', s= peed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'mirror', speed=3D0) self.complete_and_wait(drive=3D'mirror') =20 self.potential_writes_in_flight =3D False @@ -212,7 +207,7 @@ class TestThrottledWithNbdExportBase(iotests.QMPTestCas= e): self.vm =3D iotests.VM() self.vm.launch() =20 - result =3D self.vm.qmp('object-add', **{ + self.vm.cmd('object-add', **{ 'qom-type': 'throttle-group', 'id': 'thrgr', 'limits': { @@ -220,9 +215,8 @@ class TestThrottledWithNbdExportBase(iotests.QMPTestCas= e): 'iops-total-max': self.iops } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-add', **{ + self.vm.cmd('blockdev-add', **{ 'node-name': 'source-node', 'driver': 'throttle', 'throttle-group': 'thrgr', @@ -234,9 +228,8 @@ class TestThrottledWithNbdExportBase(iotests.QMPTestCas= e): } } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-add', **{ + self.vm.cmd('blockdev-add', **{ 'node-name': 'target-node', 'driver': iotests.imgfmt, 'file': { @@ -244,23 +237,20 @@ class TestThrottledWithNbdExportBase(iotests.QMPTestC= ase): 'filename': target_img } }) - self.assert_qmp(result, 'return', {}) =20 self.nbd_sock =3D iotests.file_path('nbd.sock', base_dir=3Diotests.sock_dir) self.nbd_url =3D f'nbd+unix:///source-node?socket=3D{self.nbd_sock= }' =20 - result =3D self.vm.qmp('nbd-server-start', addr=3D{ + self.vm.cmd('nbd-server-start', addr=3D{ 'type': 'unix', 'data': { 'path': self.nbd_sock } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('block-export-add', id=3D'exp0', type=3D'nb= d', - node_name=3D'source-node', writable=3DTrue) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-export-add', id=3D'exp0', type=3D'nbd', + node_name=3D'source-node', writable=3DTrue) =20 def tearDown(self): # Wait for background requests to settle @@ -313,15 +303,14 @@ class TestLowThrottledWithNbdExport(TestThrottledWith= NbdExportBase): =20 # Launch the mirror job mirror_buf_size =3D 65536 - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - filter_node_name=3D'mirror-node', - device=3D'source-node', - target=3D'target-node', - sync=3D'full', - copy_mode=3D'write-blocking', - buf_size=3Dmirror_buf_size) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + filter_node_name=3D'mirror-node', + device=3D'source-node', + target=3D'target-node', + sync=3D'full', + copy_mode=3D'write-blocking', + buf_size=3Dmirror_buf_size) =20 # We create the external requests via qemu-io processes on the NBD # server. Have their offset start in the middle of the image so t= hey @@ -409,13 +398,12 @@ class TestHighThrottledWithNbdExport(TestThrottledWit= hNbdExportBase): # start blockdev-mirror self.vm.qtest(f'clock_step {1 * 1000 * 1000 * 1000}') =20 - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'source-node', - target=3D'target-node', - sync=3D'full', - copy_mode=3D'write-blocking') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'source-node', + target=3D'target-node', + sync=3D'full', + copy_mode=3D'write-blocking') =20 =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index b73a0d08a2..197bea9e77 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -41,18 +41,16 @@ class TestUnaligned(iotests.QMPTestCase): pass =20 def test_unaligned(self): - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - granularity=3D65536, target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + granularity=3D65536, target=3Dtarget_img) self.complete_and_wait() self.vm.shutdown() self.assertEqual(iotests.image_size(test_img), iotests.image_size(= target_img), "Target size doesn't match source when granularit= y when unaligend") =20 def test_unaligned_with_update(self): - result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - granularity=3D65536, target=3Dtarget_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('drive-mirror', device=3D'drive0', sync=3D'full', + granularity=3D65536, target=3Dtarget_img) self.wait_ready() self.vm.hmp_qemu_io('drive0', 'write 0 512') self.complete_and_wait(wait_ready=3DFalse) diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index 0c073fd61b..38eacb4127 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -110,8 +110,7 @@ class BaseClass(iotests.QMPTestCase): elif self.target_blockdev_backing: options['backing'] =3D self.target_blockdev_backing =20 - result =3D self.vm.qmp('blockdev-add', options) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', options) =20 def tearDown(self): self.vm.shutdown() @@ -178,20 +177,18 @@ class MirrorBaseClass(BaseClass): =20 def runMirror(self, sync): if self.cmd =3D=3D 'blockdev-mirror': - result =3D self.vm.qmp(self.cmd, job_id=3D'mirror-job', device= =3D'source', - sync=3Dsync, target=3D'target', - auto_finalize=3DFalse) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.cmd, job_id=3D'mirror-job', device=3D'source', + sync=3Dsync, target=3D'target', + auto_finalize=3DFalse) else: if self.existing: mode =3D 'existing' else: mode =3D 'absolute-paths' - result =3D self.vm.qmp(self.cmd, job_id=3D'mirror-job', device= =3D'source', - sync=3Dsync, target=3Dtarget_img, - format=3Diotests.imgfmt, mode=3Dmode, - node_name=3D'target', auto_finalize=3DFal= se) - self.assert_qmp(result, 'return', {}) + self.vm.cmd(self.cmd, job_id=3D'mirror-job', device=3D'source', + sync=3Dsync, target=3Dtarget_img, + format=3Diotests.imgfmt, mode=3Dmode, + node_name=3D'target', auto_finalize=3DFalse) =20 self.vm.run_job('mirror-job', auto_finalize=3DFalse, pre_finalize=3Dself.openBacking, auto_dismiss=3DTr= ue) @@ -258,16 +255,14 @@ class TestBlockdevMirrorReopen(MirrorBaseClass): =20 def openBacking(self): if not self.target_open_with_backing: - result =3D self.vm.qmp('blockdev-add', node_name=3D"backing", - driver=3D"null-co") - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('blockdev-reopen', options=3D[{ - 'node-name': "target", - 'driver': iotests.imgfmt, - 'file': "target-file", - 'backing': "backing" - }]) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', node_name=3D"backing", + driver=3D"null-co") + self.vm.cmd('blockdev-reopen', options=3D[{ + 'node-name': "target", + 'driver': iotests.imgfmt, + 'file': "target-file", + 'backing': "backing" + }]) =20 class TestBlockdevMirrorReopenIothread(TestBlockdevMirrorReopen): use_iothread =3D True @@ -281,12 +276,10 @@ class TestBlockdevMirrorSnapshot(MirrorBaseClass): =20 def openBacking(self): if not self.target_open_with_backing: - result =3D self.vm.qmp('blockdev-add', node_name=3D"backing", - driver=3D"null-co") - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('blockdev-snapshot', node=3D"backing", - overlay=3D"target") - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', node_name=3D"backing", + driver=3D"null-co") + self.vm.cmd('blockdev-snapshot', node=3D"backing", + overlay=3D"target") =20 class TestBlockdevMirrorSnapshotIothread(TestBlockdevMirrorSnapshot): use_iothread =3D True @@ -295,14 +288,12 @@ class TestCommit(BaseClass): existing =3D False =20 def testCommit(self): - result =3D self.vm.qmp('block-commit', job_id=3D'commit-job', - device=3D'source', base=3Dback1_img) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', job_id=3D'commit-job', + device=3D'source', base=3Dback1_img) =20 self.vm.event_wait('BLOCK_JOB_READY') =20 - result =3D self.vm.qmp('block-job-complete', device=3D'commit-job') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3D'commit-job') =20 self.vm.event_wait('BLOCK_JOB_COMPLETED') =20 diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index e3ef28e2ee..b24907a62f 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -116,9 +116,8 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): sha256_2 =3D self.getSha256() assert sha256_1 !=3D sha256_2 # Otherwise, it's not very interesti= ng. =20 - result =3D self.vm.qmp('block-dirty-bitmap-clear', node=3D'drive0', - name=3D'bitmap0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-dirty-bitmap-clear', node=3D'drive0', + name=3D'bitmap0') =20 # Start with regions1 =20 @@ -137,7 +136,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): assert sha256_1 =3D=3D self.getSha256() =20 # Reopen to RW - result =3D self.vm.qmp('blockdev-reopen', options=3D[{ + self.vm.cmd('blockdev-reopen', options=3D[{ 'node-name': 'node0', 'driver': iotests.imgfmt, 'file': { @@ -146,7 +145,6 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): }, 'read-only': False }]) - self.assert_qmp(result, 'return', {}) =20 # Check that bitmap is reopened to RW and we can write to it. self.writeRegions(regions2) diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 index 27c1629be3..e5105b1354 100755 --- a/tests/qemu-iotests/196 +++ b/tests/qemu-iotests/196 @@ -45,8 +45,7 @@ class TestInvalidateAutoclear(iotests.QMPTestCase): self.vm_b.add_incoming("exec: cat '" + migfile + "'") =20 def test_migration(self): - result =3D self.vm_a.qmp('migrate', uri=3D'exec:cat>' + migfile) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate', uri=3D'exec:cat>' + migfile) self.assertNotEqual(self.vm_a.event_wait("STOP"), None) =20 with open(disk, 'r+b') as f: diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index 15f798288a..2370e1a138 100755 --- a/tests/qemu-iotests/205 +++ b/tests/qemu-iotests/205 @@ -44,10 +44,8 @@ class TestNbdServerRemove(iotests.QMPTestCase): } } =20 - result =3D self.vm.qmp('nbd-server-start', addr=3Daddress) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('nbd-server-add', device=3D'drive0', name= =3D'exp') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-start', addr=3Daddress) + self.vm.cmd('nbd-server-add', device=3D'drive0', name=3D'exp') =20 def tearDown(self): self.vm.shutdown() diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218 index 5e74c55b6a..81aa68806f 100755 --- a/tests/qemu-iotests/218 +++ b/tests/qemu-iotests/218 @@ -41,34 +41,30 @@ iotests.script_initialize(supported_fmts=3D['qcow2', 'r= aw']) def start_mirror(vm, speed=3DNone, buf_size=3DNone): vm.launch() =20 - ret =3D vm.qmp('blockdev-add', - node_name=3D'source', - driver=3D'null-co', - size=3D1048576) - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-add', + node_name=3D'source', + driver=3D'null-co', + size=3D1048576) =20 - ret =3D vm.qmp('blockdev-add', - node_name=3D'target', - driver=3D'null-co', - size=3D1048576) - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-add', + node_name=3D'target', + driver=3D'null-co', + size=3D1048576) =20 if speed is not None: - ret =3D vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'source', - target=3D'target', - sync=3D'full', - speed=3Dspeed, - buf_size=3Dbuf_size) - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + sync=3D'full', + speed=3Dspeed, + buf_size=3Dbuf_size) else: - ret =3D vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'source', - target=3D'target', - sync=3D'full') - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + sync=3D'full') =20 =20 log('') @@ -150,38 +146,33 @@ with iotests.VM() as vm, \ =20 vm.launch() =20 - ret =3D vm.qmp('object-add', qom_type=3D'throttle-group', id=3D'tg', - limits=3D{'bps-read': 4096}) - assert ret['return'] =3D=3D {} + vm.cmd('object-add', qom_type=3D'throttle-group', id=3D'tg', + limits=3D{'bps-read': 4096}) =20 - ret =3D vm.qmp('blockdev-add', - node_name=3D'source', - driver=3Diotests.imgfmt, - file=3D{ - 'driver': 'file', - 'filename': src_img_path - }) - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-add', + node_name=3D'source', + driver=3Diotests.imgfmt, + file=3D{ + 'driver': 'file', + 'filename': src_img_path + }) =20 - ret =3D vm.qmp('blockdev-add', - node_name=3D'throttled-source', - driver=3D'throttle', - throttle_group=3D'tg', - file=3D'source') - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-add', + node_name=3D'throttled-source', + driver=3D'throttle', + throttle_group=3D'tg', + file=3D'source') =20 - ret =3D vm.qmp('blockdev-add', - node_name=3D'target', - driver=3D'null-co', - size=3D(64 * 1048576)) - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-add', + node_name=3D'target', + driver=3D'null-co', + size=3D(64 * 1048576)) =20 - ret =3D vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'throttled-source', - target=3D'target', - sync=3D'full') - assert ret['return'] =3D=3D {} + vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'throttled-source', + target=3D'target', + sync=3D'full') =20 log(vm.qmp('quit')) =20 diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index 92b28c79be..a934c9d1e6 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -136,8 +136,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): def test_incorrect_parameters_single_file(self): # Open 'hd0' only (no backing files) opts =3D hd_opts(0) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) original_graph =3D self.vm.qmp('query-named-block-nodes') =20 # We can reopen the image passing the same options @@ -171,8 +170,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.check_node_graph(original_graph) =20 # Remove the node - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 # This test opens an image with a backing file and tries to reopen # it with illegal / incorrect parameters. @@ -180,8 +178,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): # Open hd1 omitting the backing options (hd0 will be opened # with the default options) opts =3D hd_opts(1) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) original_graph =3D self.vm.qmp('query-named-block-nodes') =20 # We can't reopen the image passing the same options, 'backing' is= mandatory @@ -213,8 +210,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.check_node_graph(original_graph) =20 # Remove the node - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd1= ') =20 # Reopen an image several times changing some of its options def test_reopen(self): @@ -230,8 +226,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): # Open the hd1 image passing all backing options opts =3D hd_opts(1) opts['backing'] =3D hd_opts(0) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) original_graph =3D self.vm.qmp('query-named-block-nodes') =20 # We can reopen the image passing the same options @@ -306,8 +301,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assert_qmp_absent(self.get_node('hd1'), 'image/backing-image') =20 # Open the 'hd0' image - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **hd_o= pts(0)) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **hd_opts(0)) =20 # Reopen the hd1 image setting 'hd0' as its backing image self.reopen(opts, {'backing': 'hd0'}) @@ -326,10 +320,8 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assert_qmp(result, 'error/desc', "Node 'hd0' is busy: node is= used as backing hd of 'hd1'") =20 # But we can remove both nodes if done in the proper order - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd1') - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd1= ') + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 # Reopen a raw image and see the effect of changing the 'offset' option def test_reopen_raw(self): @@ -345,8 +337,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): qemu_io('-f', 'raw', '-c', 'write -P 0xa1 1M 1M', hd_path[0]) =20 # Open the raw file with QEMU - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Read 1MB from offset 0 self.run_qemu_io("hd0", "read -P 0xa0 0 1M") @@ -362,8 +353,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.run_qemu_io("hd0", "read -P 0xa0 0 1M") =20 # Remove the block device - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 # Omitting an option should reset it to the default value, but if # an option cannot be changed it shouldn't be possible to reset it @@ -377,8 +367,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): 'node-name': 'hd0-file' } } =20 # Open the file with QEMU - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # file.x-check-cache-dropped can be changed... self.reopen(opts, { 'file.x-check-cache-dropped': False }) @@ -394,8 +383,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts, { 'file.locking': 'off' }) =20 # Remove the block device - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 # This test modifies the node graph a few times by changing the # 'backing' option on reopen and verifies that the guest data that @@ -407,8 +395,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): for i in range(3): opts.append(hd_opts(i)) opts[i]['backing'] =3D None - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **= opts[i]) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts[i]) =20 # hd0 self.run_qemu_io("hd0", "read -P 0xa0 0 1M") @@ -499,8 +486,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): for i in range(3): opts.append(hd_opts(i)) opts[i]['backing'] =3D None - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **= opts[i]) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts[i]) =20 # hd1 <- hd0, hd1 <- hd2 self.reopen(opts[0], {'backing': 'hd1'}) @@ -532,8 +518,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): 'node-name': 'bv', 'test': 'hd0', 'raw': 'hd1'} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **bvop= ts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **bvopts) =20 # blkverify doesn't currently allow reopening. TODO: implement this self.reopen(bvopts, {}, "Block format 'blkverify' used by node 'bv= '" + @@ -544,8 +529,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): "Making 'bv' a backing child of 'hd0' would create a c= ycle") =20 # Delete the blkverify node - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'bv') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'bv') =20 # Replace the protocol layer ('file' parameter) of a disk image def test_replace_file(self): @@ -556,16 +540,13 @@ class TestBlockdevReopen(iotests.QMPTestCase): hd0_opts =3D {'driver': 'file', 'node-name': 'hd0-file', 'filename= ': hd_path[0] } hd1_opts =3D {'driver': 'file', 'node-name': 'hd1-file', 'filename= ': hd_path[1] } =20 - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **hd0_= opts) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **hd1_= opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **hd0_opts) + self.vm.cmd('blockdev-add', conv_keys =3D False, **hd1_opts) =20 # Add a raw format layer that uses hd0-file as its protocol layer opts =3D {'driver': 'raw', 'node-name': 'hd', 'file': 'hd0-file'} =20 - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Fill the image with data self.run_qemu_io("hd", "read -P 0 0 10k") @@ -588,21 +569,18 @@ class TestBlockdevReopen(iotests.QMPTestCase): def test_insert_throttle_filter(self): # Add an image to the VM hd0_opts =3D hd_opts(0) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **hd0_= opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **hd0_opts) =20 # Create a throttle-group object opts =3D { 'qom-type': 'throttle-group', 'id': 'group0', 'limits': { 'iops-total': 1000 } } - result =3D self.vm.qmp('object-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', conv_keys =3D False, **opts) =20 # Add a throttle filter with the group that we just created. # The filter is not used by anyone yet opts =3D { 'driver': 'throttle', 'node-name': 'throttle0', 'throttle-group': 'group0', 'file': 'hd0-file' } - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Insert the throttle filter between hd0 and hd0-file self.reopen(hd0_opts, {'file': 'throttle0'}) @@ -615,15 +593,13 @@ class TestBlockdevReopen(iotests.QMPTestCase): def test_insert_compress_filter(self): # Add an image to the VM: hd (raw) -> hd0 (qcow2) -> hd0-file (fil= e) opts =3D {'driver': 'raw', 'node-name': 'hd', 'file': hd_opts(0)} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Add a 'compress' filter filter_opts =3D {'driver': 'compress', 'node-name': 'compress0', 'file': 'hd0'} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **filt= er_opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **filter_opts) =20 # Unmap the beginning of the image (we cannot write compressed # data to an allocated cluster) @@ -659,12 +635,10 @@ class TestBlockdevReopen(iotests.QMPTestCase): def test_swap_files(self): # Add hd0 and hd2 (none of them with backing files) opts0 =3D hd_opts(0) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts= 0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts0) =20 opts2 =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts= 2) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts2) =20 # Write different data to both block devices self.run_qemu_io("hd0", "write -P 0xa0 0 1k") @@ -712,15 +686,13 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(i) # Open all three images without backing file opts['backing'] =3D None - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **= opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 opts =3D {'driver': 'quorum', 'node-name': 'quorum0', 'children': ['hd0', 'hd1', 'hd2'], 'vote-threshold': 2} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Quorum doesn't currently allow reopening. TODO: implement this self.reopen(opts, {}, "Block format 'quorum' used by node 'quorum0= '" + @@ -732,14 +704,12 @@ class TestBlockdevReopen(iotests.QMPTestCase): "Making 'quorum0' a backing child of 'hd0' would creat= e a cycle") =20 # Delete quorum0 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'quorum0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'quo= rum0') =20 # Delete hd0, hd1 and hd2 for i in range(3): - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, - node_name =3D 'hd%d' % i) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, + node_name =3D 'hd%d' % i) =20 ###################### ###### blkdebug ###### @@ -748,8 +718,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): 'node-name': 'bd', 'config': '/dev/null', 'image': hd_opts(0)} - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # blkdebug allows reopening if we keep the same options self.reopen(opts) @@ -762,16 +731,14 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts, {}, "Option 'config' cannot be reset to its defa= ult value") =20 # Delete the blkdebug node - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'bd') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'bd') =20 ################## ###### null ###### ################## opts =3D {'driver': 'null-co', 'node-name': 'root', 'size': 1024} =20 - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # 1 << 30 is the default value, but we cannot change it explicitly self.reopen(opts, {'size': (1 << 30)}, "Cannot change the option '= size'") @@ -780,16 +747,14 @@ class TestBlockdevReopen(iotests.QMPTestCase): del opts['size'] self.reopen(opts, {}, "Option 'size' cannot be reset to its defaul= t value") =20 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'root') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'roo= t') =20 ################## ###### file ###### ################## opts =3D hd_opts(0) opts['file']['locking'] =3D 'on' - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # 'locking' cannot be changed del opts['file']['locking'] @@ -803,27 +768,23 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts, {'locking': 'off'}, "Cannot change the option 'l= ocking'") self.reopen(opts, {}, "Option 'locking' cannot be reset to its def= ault value") =20 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 ###################### ###### throttle ###### ###################### opts =3D { 'qom-type': 'throttle-group', 'id': 'group0', 'limits': { 'iops-total': 1000 } } - result =3D self.vm.qmp('object-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', conv_keys =3D False, **opts) =20 opts =3D { 'qom-type': 'throttle-group', 'id': 'group1', 'limits': { 'iops-total': 2000 } } - result =3D self.vm.qmp('object-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', conv_keys =3D False, **opts) =20 # Add a throttle filter with group =3D group0 opts =3D { 'driver': 'throttle', 'node-name': 'throttle0', 'throttle-group': 'group0', 'file': hd_opts(0) } - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # We can reopen it if we keep the same options self.reopen(opts) @@ -851,16 +812,13 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assert_qmp(result, 'error/desc', "object 'group0' is in use, = can not be deleted") =20 # But group1 is free this time, and it can be deleted - result =3D self.vm.qmp('object-del', id =3D 'group1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-del', id =3D 'group1') =20 # Let's delete the filter node - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'throttle0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'thr= ottle0') =20 # And we can finally get rid of group0 - result =3D self.vm.qmp('object-del', id =3D 'group0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-del', id =3D 'group0') =20 # If an image has a backing file then the 'backing' option must be # passed on reopen. We don't allow leaving the option out in this @@ -868,13 +826,11 @@ class TestBlockdevReopen(iotests.QMPTestCase): def test_missing_backing_options_1(self): # hd2 opts =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # hd0 opts =3D hd_opts(0) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # hd0 has no backing file: we can omit the 'backing' option self.reopen(opts) @@ -897,11 +853,9 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts) =20 # Remove both hd0 and hd2 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd2') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd2= ') =20 # If an image has default backing file (as part of its metadata) # then the 'backing' option must be passed on reopen. We don't @@ -911,8 +865,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): # hd0 <- hd1 # (hd0 is hd1's default backing file) opts =3D hd_opts(1) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # hd1 has a backing file: we can't omit the 'backing' option self.reopen(opts, {}, "backing is missing for 'hd1'") @@ -923,8 +876,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): # No backing file attached to hd1 now, but we still can't omit the= 'backing' option self.reopen(opts, {}, "backing is missing for 'hd1'") =20 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd1= ') =20 # Test that making 'backing' a reference to an existing child # keeps its current options @@ -937,8 +889,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts['detect-zeroes'] =3D 'on' opts['backing']['detect-zeroes'] =3D 'on' opts['backing']['backing']['detect-zeroes'] =3D 'on' - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Reopen the chain passing the minimum amount of required options. # By making 'backing' a reference to hd1 (instead of a sub-dict) @@ -961,12 +912,10 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(0) opts['backing'] =3D hd_opts(1) opts['backing']['backing'] =3D None - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Stream hd1 into hd0 and wait until it's done - result =3D self.vm.qmp('block-stream', conv_keys =3D True, job_id = =3D 'stream0', device =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', conv_keys =3D True, job_id =3D 'stream= 0', device =3D 'hd0') self.wait_until_completed(drive =3D 'stream0') =20 # Now we have only hd0 @@ -982,8 +931,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): # We can also reopen hd0 if we set 'backing' to null self.reopen(opts, {'backing': None}) =20 - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') =20 # Another block_stream test def test_block_stream_2(self): @@ -991,13 +939,11 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(0) opts['backing'] =3D hd_opts(1) opts['backing']['backing'] =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # Stream hd1 into hd0 and wait until it's done - result =3D self.vm.qmp('block-stream', conv_keys =3D True, job_id = =3D 'stream0', - device =3D 'hd0', base_node =3D 'hd2') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', conv_keys =3D True, job_id =3D 'stream= 0', + device =3D 'hd0', base_node =3D 'hd2') self.wait_until_completed(drive =3D 'stream0') =20 # The chain is hd2 <- hd0 now. hd1 is missing @@ -1019,8 +965,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts, {}, "backing is missing for 'hd0'") =20 # Now we can delete hd0 (and hd2) - result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', conv_keys =3D True, node_name =3D 'hd0= ') self.assertEqual(self.get_node('hd2'), None) =20 # Reopen the chain during a block-stream job (from hd1 to hd0) @@ -1029,14 +974,12 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(0) opts['backing'] =3D hd_opts(1) opts['backing']['backing'] =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =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', - auto_finalize =3D False) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', conv_keys =3D True, job_id =3D 'stream= 0', + device =3D 'hd0', base_node =3D 'hd2', + auto_finalize =3D False) =20 # We can remove hd2 while the stream job is ongoing opts['backing']['backing'] =3D None @@ -1054,14 +997,12 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(0) opts['backing'] =3D hd_opts(1) opts['backing']['backing'] =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 # hd1 <- hd0 - result =3D self.vm.qmp('block-stream', conv_keys =3D True, job_id = =3D 'stream0', - device =3D 'hd1', filter_node_name=3D'cor', - auto_finalize =3D False) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', conv_keys =3D True, job_id =3D 'stream= 0', + device =3D 'hd1', filter_node_name=3D'cor', + auto_finalize =3D False) =20 # We can't reopen with the original options because there is a fil= ter # inserted by stream job above hd1. @@ -1090,12 +1031,10 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(0) opts['backing'] =3D hd_opts(1) opts['backing']['backing'] =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 - result =3D self.vm.qmp('block-commit', conv_keys =3D True, job_id = =3D 'commit0', - device =3D 'hd0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', conv_keys =3D True, job_id =3D 'commit= 0', + device =3D 'hd0') =20 # We can't remove hd2 while the commit job is ongoing opts['backing']['backing'] =3D None @@ -1110,8 +1049,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assert_qmp(event, 'data/type', 'commit') self.assert_qmp_absent(event, 'data/error') =20 - result =3D self.vm.qmp('block-job-complete', device=3D'commit0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3D'commit0') =20 self.wait_until_completed(drive =3D 'commit0') =20 @@ -1121,13 +1059,11 @@ class TestBlockdevReopen(iotests.QMPTestCase): opts =3D hd_opts(0) opts['backing'] =3D hd_opts(1) opts['backing']['backing'] =3D hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 - result =3D self.vm.qmp('block-commit', conv_keys =3D True, job_id = =3D 'commit0', - device =3D 'hd0', top_node =3D 'hd1', - auto_finalize =3D False) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', conv_keys =3D True, job_id =3D 'commit= 0', + device =3D 'hd0', top_node =3D 'hd1', + auto_finalize =3D False) =20 # We can't remove hd2 while the commit job is ongoing opts['backing']['backing'] =3D None @@ -1147,36 +1083,28 @@ class TestBlockdevReopen(iotests.QMPTestCase): def run_test_iothreads(self, iothread_a, iothread_b, errmsg =3D None, opts_a =3D None, opts_b =3D None): opts =3D opts_a or hd_opts(0) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts) =20 opts2 =3D opts_b or hd_opts(2) - result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts= 2) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', conv_keys =3D False, **opts2) =20 - result =3D self.vm.qmp('object-add', qom_type=3D'iothread', id=3D'= iothread0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', qom_type=3D'iothread', id=3D'iothread0') =20 - result =3D self.vm.qmp('object-add', qom_type=3D'iothread', id=3D'= iothread1') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', qom_type=3D'iothread', id=3D'iothread1') =20 - result =3D self.vm.qmp('device_add', driver=3D'virtio-scsi', id=3D= 'scsi0', - iothread=3Diothread_a) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', driver=3D'virtio-scsi', id=3D'scsi0', + iothread=3Diothread_a) =20 - result =3D self.vm.qmp('device_add', driver=3D'virtio-scsi', id=3D= 'scsi1', - iothread=3Diothread_b) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', driver=3D'virtio-scsi', id=3D'scsi1', + iothread=3Diothread_b) =20 if iothread_a: - result =3D self.vm.qmp('device_add', driver=3D'scsi-hd', drive= =3D'hd0', - share_rw=3DTrue, bus=3D"scsi0.0") - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', driver=3D'scsi-hd', drive=3D'hd0', + share_rw=3DTrue, bus=3D"scsi0.0") =20 if iothread_b: - result =3D self.vm.qmp('device_add', driver=3D'scsi-hd', drive= =3D'hd2', - share_rw=3DTrue, bus=3D"scsi1.0") - self.assert_qmp(result, 'return', {}) + self.vm.cmd('device_add', driver=3D'scsi-hd', drive=3D'hd2', + share_rw=3DTrue, bus=3D"scsi1.0") =20 # Attaching the backing file may or may not work self.reopen(opts, {'backing': 'hd2'}, errmsg) @@ -1205,8 +1133,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): # Create a throttle-group object opts =3D { 'qom-type': 'throttle-group', 'id': 'group0', 'limits': { 'iops-total': 1000 } } - result =3D self.vm.qmp('object-add', conv_keys =3D False, **opts) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('object-add', conv_keys =3D False, **opts) =20 # Options with a throttle filter between format and protocol opts =3D [ diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index d44deb673a..c532ccd809 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -48,18 +48,16 @@ class TestNbdReconnect(iotests.QMPTestCase): """Stat job with nbd target and kill the server""" assert job in ('blockdev-backup', 'blockdev-mirror') with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): - result =3D self.vm.qmp('blockdev-add', - {'node-name': 'backup0', - 'driver': 'raw', - 'file': {'driver': 'nbd', - 'server': {'type': 'unix', - 'path': nbd_sock}, - 'reconnect-delay': 10}}) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp(job, device=3D'drive0', - sync=3D'full', target=3D'backup0', - speed=3D(1 * 1024 * 1024)) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', + {'node-name': 'backup0', + 'driver': 'raw', + 'file': {'driver': 'nbd', + 'server': {'type': 'unix', + 'path': nbd_sock}, + 'reconnect-delay': 10}}) + self.vm.cmd(job, device=3D'drive0', + sync=3D'full', target=3D'backup0', + speed=3D(1 * 1024 * 1024)) =20 # Wait for some progress t =3D 0.0 @@ -77,8 +75,7 @@ class TestNbdReconnect(iotests.QMPTestCase): self.assertTrue(jobs) self.assertTrue(jobs[0]['offset'] < jobs[0]['len']) =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D0) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', speed=3D0) =20 # Emulate server down time for 1 second time.sleep(1) @@ -91,12 +88,10 @@ class TestNbdReconnect(iotests.QMPTestCase): with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): e =3D self.vm.event_wait('BLOCK_JOB_COMPLETED') self.assertEqual(e['data']['offset'], size) - result =3D self.vm.qmp('blockdev-del', node_name=3D'backup0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'backup0') =20 def cancel_job(self): - result =3D self.vm.qmp('block-job-cancel', device=3D'drive0', forc= e=3DTrue) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-cancel', device=3D'drive0', force=3DTrue) =20 start_t =3D time.time() self.vm.event_wait('BLOCK_JOB_CANCELLED') diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281 index 5e1339bd75..f6746a12e8 100755 --- a/tests/qemu-iotests/281 +++ b/tests/qemu-iotests/281 @@ -56,15 +56,13 @@ class TestDirtyBitmapIOThread(iotests.QMPTestCase): os.remove(self.images[name]) =20 def test_add_dirty_bitmap(self): - result =3D self.vm.qmp( + self.vm.cmd( 'block-dirty-bitmap-add', node=3D'drive0', name=3D'bitmap1', persistent=3DTrue, ) =20 - self.assert_qmp(result, 'return', {}) - =20 # Test for RHBZ#1746217 & RHBZ#1773517 class TestNBDMirrorIOThread(iotests.QMPTestCase): @@ -105,23 +103,21 @@ class TestNBDMirrorIOThread(iotests.QMPTestCase): os.remove(self.images[name]) =20 def test_nbd_mirror(self): - result =3D self.vm_tgt.qmp( + self.vm_tgt.cmd( 'nbd-server-start', addr=3D{ 'type': 'unix', 'data': { 'path': self.nbd_sock } } ) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm_tgt.qmp( + self.vm_tgt.cmd( 'nbd-server-add', device=3D'drive0', writable=3DTrue ) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm_src.qmp( + self.vm_src.cmd( 'drive-mirror', device=3D'drive0', target=3D'nbd+unix:///drive0?socket=3D' + self.nbd_sock, @@ -130,7 +126,6 @@ class TestNBDMirrorIOThread(iotests.QMPTestCase): speed=3D64*1024*1024, job_id=3D'j1' ) - self.assert_qmp(result, 'return', {}) =20 self.vm_src.event_wait(name=3D"BLOCK_JOB_READY") =20 @@ -290,8 +285,7 @@ class TestYieldingAndTimers(iotests.QMPTestCase): # they will remain active, fire later, and then access freed data. # (Or, with "block/nbd: Assert there are no timers when closed" # applied, the assertions added in that patch will fail.) - result =3D self.vm.qmp('blockdev-del', node_name=3D'nbd') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', node_name=3D'nbd') =20 # Give the timers some time to fire (both have a timeout of 1 s). # (Sleeping in an iotest may ring some alarm bells, but note that = if @@ -303,9 +297,8 @@ class TestYieldingAndTimers(iotests.QMPTestCase): def test_yield_in_iothread(self): # Move the NBD node to the I/O thread; the NBD block driver should # attach the connection's QIOChannel to that thread's AioContext, = too - result =3D self.vm.qmp('x-blockdev-set-iothread', - node_name=3D'nbd', iothread=3D'iothr') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('x-blockdev-set-iothread', + node_name=3D'nbd', iothread=3D'iothr') =20 # Do some I/O that will be throttled by the QSD, so that the netwo= rk # connection hopefully will yield here. When it is resumed, it mu= st diff --git a/tests/qemu-iotests/295 b/tests/qemu-iotests/295 index 8ebe31054c..04818af264 100755 --- a/tests/qemu-iotests/295 +++ b/tests/qemu-iotests/295 @@ -57,8 +57,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): # create the secrets and load 'em into the VM self.secrets =3D [ Secret(i) for i in range(0, 6) ] for secret in self.secrets: - result =3D self.vm.qmp("object-add", **secret.to_qmp_object()) - self.assert_qmp(result, 'return', {}) + self.vm.cmd("object-add", **secret.to_qmp_object()) =20 if iotests.imgfmt =3D=3D "qcow2": self.pfx =3D "encrypt." @@ -102,7 +101,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): } } =20 - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'driver': iotests.imgfmt, 'node-name': id, 'read-only': read_only, @@ -115,12 +114,10 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): } } ) - self.assert_qmp(result, 'return', {}) =20 # close the encrypted block device def closeImageQmp(self, id): - result =3D self.vm.qmp('blockdev-del', {'node-name': id}) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-del', {'node-name': id}) =20 ######################################################################= ##### # add a key to an encrypted block device @@ -159,8 +156,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): args['force'] =3D True =20 #TODO: check what jobs return - result =3D self.vm.qmp('x-blockdev-amend', **args) - assert result['return'] =3D=3D {} + self.vm.cmd('x-blockdev-amend', **args) self.vm.run_job('job_add_key') =20 # erase a key from an encrypted block device @@ -193,8 +189,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): if force =3D=3D True: args['force'] =3D True =20 - result =3D self.vm.qmp('x-blockdev-amend', **args) - assert result['return'] =3D=3D {} + self.vm.cmd('x-blockdev-amend', **args) self.vm.run_job('job_erase_key') =20 ######################################################################= ##### diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296 index 47d2526b72..2b63cefff0 100755 --- a/tests/qemu-iotests/296 +++ b/tests/qemu-iotests/296 @@ -61,10 +61,8 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): # create the secrets and load 'em into the VMs self.secrets =3D [ Secret(i) for i in range(0, 4) ] for secret in self.secrets: - result =3D self.vm1.qmp("object-add", secret.to_qmp_object()) - self.assert_qmp(result, 'return', {}) - result =3D self.vm2.qmp("object-add", secret.to_qmp_object()) - self.assert_qmp(result, 'return', {}) + self.vm1.cmd("object-add", secret.to_qmp_object()) + self.vm2.cmd("object-add", secret.to_qmp_object()) =20 # test case shutdown def tearDown(self): @@ -132,11 +130,9 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): } =20 if reOpen: - result =3D vm.qmp(command, options=3D[opts]) - self.assert_qmp(result, 'return', {}) + vm.cmd(command, options=3D[opts]) else: - result =3D vm.qmp(command, opts) - self.assert_qmp(result, 'return', {}) + vm.cmd(command, opts) =20 =20 ######################################################################= ##### @@ -154,8 +150,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): =20 # close the encrypted block device def closeImageQmp(self, vm, id): - result =3D vm.qmp('blockdev-del', {'node-name': id}) - self.assert_qmp(result, 'return', {}) + vm.cmd('blockdev-del', {'node-name': id}) =20 ######################################################################= ##### =20 diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 index 9e75ac6975..09c9290711 100755 --- a/tests/qemu-iotests/298 +++ b/tests/qemu-iotests/298 @@ -80,25 +80,23 @@ class TestPreallocateFilter(TestPreallocateBase): def test_external_snapshot(self): self.test_prealloc() =20 - result =3D self.vm.qmp('blockdev-snapshot-sync', node_name=3D'disk= ', - snapshot_file=3Doverlay, - snapshot_node_name=3D'overlay') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-snapshot-sync', node_name=3D'disk', + snapshot_file=3Doverlay, + snapshot_node_name=3D'overlay') =20 # on reopen to r-o base preallocation should be dropped self.check_small() =20 self.vm.hmp_qemu_io('drive0', 'write 1M 1M') =20 - result =3D self.vm.qmp('block-commit', device=3D'overlay') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-commit', device=3D'overlay') self.complete_and_wait() =20 # commit of new megabyte should trigger preallocation self.check_big() =20 def test_reopen_opts(self): - result =3D self.vm.qmp('blockdev-reopen', options=3D[{ + self.vm.cmd('blockdev-reopen', options=3D[{ 'node-name': 'disk', 'driver': iotests.imgfmt, 'file': { @@ -113,7 +111,6 @@ class TestPreallocateFilter(TestPreallocateBase): } } }]) - self.assert_qmp(result, 'return', {}) =20 self.vm.hmp_qemu_io('drive0', 'write 0 1M') self.assertTrue(os.path.getsize(disk) =3D=3D 25 * MiB) diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index dbd28384ec..e46616d7b1 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -50,10 +50,9 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.vm_b.add_incoming(f'unix:{mig_sock}') self.vm_b.launch() =20 - result =3D self.vm_a.qmp('block-dirty-bitmap-add', - node=3Dself.src_node_name, - name=3Dself.src_bmap_name) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-add', + node=3Dself.src_node_name, + name=3Dself.src_bmap_name) =20 # Dirty some random megabytes for _ in range(9): @@ -69,8 +68,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): for name in ('dirty-bitmaps', 'events')] =20 for vm in (self.vm_a, self.vm_b): - result =3D vm.qmp('migrate-set-capabilities', capabilities=3Dc= aps) - self.assert_qmp(result, 'return', {}) + vm.cmd('migrate-set-capabilities', capabilities=3Dcaps) =20 def tearDown(self) -> None: self.vm_a.shutdown() @@ -93,8 +91,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): =20 def migrate(self, bitmap_name_valid: bool =3D True, migration_success: bool =3D True) -> None: - result =3D self.vm_a.qmp('migrate', uri=3Df'unix:{mig_sock}') - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate', uri=3Df'unix:{mig_sock}') =20 with iotests.Timeout(5, 'Timeout waiting for migration to complete= '): self.assertEqual(self.vm_a.wait_migration('postmigrate'), @@ -442,10 +439,9 @@ class TestBlockBitmapMappingErrors(TestDirtyBitmapMigr= ation): def test_bitmap_name_too_long(self) -> None: name =3D 'a' * 256 =20 - result =3D self.vm_a.qmp('block-dirty-bitmap-add', - node=3Dself.src_node_name, - name=3Dname) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-add', + node=3Dself.src_node_name, + name=3Dname) =20 self.migrate(False, False) =20 @@ -517,22 +513,19 @@ class TestCrossAliasMigration(TestDirtyBitmapMigratio= n): TestDirtyBitmapMigration.setUp(self) =20 # Now create another block device and let both have two bitmaps ea= ch - result =3D self.vm_a.qmp('blockdev-add', - node_name=3D'node-b', driver=3D'null-co') - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('blockdev-add', + node_name=3D'node-b', driver=3D'null-co') =20 - result =3D self.vm_b.qmp('blockdev-add', - node_name=3D'node-a', driver=3D'null-co') - self.assert_qmp(result, 'return', {}) + self.vm_b.cmd('blockdev-add', + node_name=3D'node-a', driver=3D'null-co') =20 bmaps_to_add =3D (('node-a', 'bmap-b'), ('node-b', 'bmap-a'), ('node-b', 'bmap-b')) =20 for (node, bmap) in bmaps_to_add: - result =3D self.vm_a.qmp('block-dirty-bitmap-add', - node=3Dnode, name=3Dbmap) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-add', + node=3Dnode, name=3Dbmap) =20 @staticmethod def cross_mapping() -> BlockBitmapMapping: @@ -611,24 +604,21 @@ class TestAliasTransformMigration(TestDirtyBitmapMigr= ation): TestDirtyBitmapMigration.setUp(self) =20 # Now create another block device and let both have two bitmaps ea= ch - result =3D self.vm_a.qmp('blockdev-add', - node_name=3D'node-b', driver=3D'null-co', - read_zeroes=3DFalse) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('blockdev-add', + node_name=3D'node-b', driver=3D'null-co', + read_zeroes=3DFalse) =20 - result =3D self.vm_b.qmp('blockdev-add', - node_name=3D'node-a', driver=3D'null-co', - read_zeroes=3DFalse) - self.assert_qmp(result, 'return', {}) + self.vm_b.cmd('blockdev-add', + node_name=3D'node-a', driver=3D'null-co', + read_zeroes=3DFalse) =20 bmaps_to_add =3D (('node-a', 'bmap-b'), ('node-b', 'bmap-a'), ('node-b', 'bmap-b')) =20 for (node, bmap) in bmaps_to_add: - result =3D self.vm_a.qmp('block-dirty-bitmap-add', - node=3Dnode, name=3Dbmap) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-add', + node=3Dnode, name=3Dbmap) =20 @staticmethod def transform_mapping() -> BlockBitmapMapping: diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f43814e802..e5c5798c71 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1252,8 +1252,7 @@ def assert_json_filename_equal(self, json_filename, r= eference): def cancel_and_wait(self, drive=3D'drive0', force=3DFalse, resume=3DFalse, 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', {}) + self.vm.cmd('block-job-cancel', device=3Ddrive, force=3Dforce) =20 if resume: self.vm.resume_drive(drive) @@ -1315,8 +1314,7 @@ def complete_and_wait(self, drive=3D'drive0', wait_re= ady=3DTrue, if wait_ready: self.wait_ready(drive=3Ddrive) =20 - result =3D self.vm.qmp('block-job-complete', device=3Ddrive) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-complete', device=3Ddrive) =20 event =3D self.wait_until_completed(drive=3Ddrive, error=3Dcomplet= ion_error) self.assertTrue(event['data']['type'] in ['mirror', 'commit']) @@ -1335,8 +1333,7 @@ def pause_wait(self, job_id=3D'job0'): assert found =20 def pause_job(self, job_id=3D'job0', wait=3DTrue): - result =3D self.vm.qmp('block-job-pause', device=3Djob_id) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-pause', device=3Djob_id) if wait: self.pause_wait(job_id) =20 diff --git a/tests/qemu-iotests/tests/backing-file-invalidation b/tests/qem= u-iotests/tests/backing-file-invalidation index 4eccc80153..b0e19839db 100755 --- a/tests/qemu-iotests/tests/backing-file-invalidation +++ b/tests/qemu-iotests/tests/backing-file-invalidation @@ -129,12 +129,11 @@ class TestPostMigrateFilename(iotests.QMPTestCase): =20 # For good measure, try creating an overlay and check its backing # chain below. This is how the issue was originally found. - result =3D self.vm_d.qmp('blockdev-snapshot-sync', - format=3Diotests.imgfmt, - snapshot_file=3Dimgs[3], - node_name=3D'node0', - snapshot_node_name=3D'node0-overlay') - self.assert_qmp(result, 'return', {}) + self.vm_d.cmd('blockdev-snapshot-sync', + format=3Diotests.imgfmt, + snapshot_file=3Dimgs[3], + node_name=3D'node0', + snapshot_node_name=3D'node0-overlay') =20 self.vm_d.shutdown() self.vm_d =3D None diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index d3987db942..d33bea577d 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -48,7 +48,7 @@ class TestCbwError(iotests.QMPTestCase): self.vm.launch() =20 def do_cbw_error(self, on_cbw_error): - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'cbw', 'driver': 'copy-before-write', 'on-cbw-error': on_cbw_error, @@ -78,14 +78,12 @@ class TestCbwError(iotests.QMPTestCase): } } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'access', 'driver': 'snapshot-access', 'file': 'cbw' }) - self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('human-monitor-command', command_line=3D'qemu-io cbw "write 0 1M"') @@ -129,14 +127,13 @@ read 1048576/1048576 bytes at offset 0 """) =20 def do_cbw_timeout(self, on_cbw_error): - result =3D self.vm.qmp('object-add', { + self.vm.cmd('object-add', { 'qom-type': 'throttle-group', 'id': 'group0', 'limits': {'bps-write': 300 * 1024} }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'cbw', 'driver': 'copy-before-write', 'on-cbw-error': on_cbw_error, @@ -160,14 +157,12 @@ read 1048576/1048576 bytes at offset 0 } } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'access', 'driver': 'snapshot-access', 'file': 'cbw' }) - self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('human-monitor-command', command_line=3D'qemu-io cbw "write 0 512K"') diff --git a/tests/qemu-iotests/tests/export-incoming-iothread b/tests/qemu= -iotests/tests/export-incoming-iothread index 7679e49103..d36d6194e0 100755 --- a/tests/qemu-iotests/tests/export-incoming-iothread +++ b/tests/qemu-iotests/tests/export-incoming-iothread @@ -55,7 +55,7 @@ class TestExportIncomingIothread(iotests.QMPTestCase): os.remove(test_img) =20 def test_export_add(self): - result =3D self.vm.qmp('nbd-server-start', { + self.vm.cmd('nbd-server-start', { 'addr': { 'type': 'unix', 'data': { @@ -63,16 +63,14 @@ class TestExportIncomingIothread(iotests.QMPTestCase): } } }) - self.assert_qmp(result, 'return', {}) =20 # Regression test for issue 945: This should not fail an assertion - result =3D self.vm.qmp('block-export-add', { + self.vm.cmd('block-export-add', { 'type': 'nbd', 'id': 'exp0', 'node-name': node_name, 'iothread': iothread_id }) - self.assert_qmp(result, 'return', {}) =20 =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/tests/graph-changes-while-io b/tests/qemu-i= otests/tests/graph-changes-while-io index 750e7d4d38..194fda500e 100755 --- a/tests/qemu-iotests/tests/graph-changes-while-io +++ b/tests/qemu-iotests/tests/graph-changes-while-io @@ -66,7 +66,7 @@ class TestGraphChangesWhileIO(QMPTestCase): # While qemu-img bench is running, repeatedly add and remove an # overlay to/from node0 while bench_thr.is_alive(): - result =3D self.qsd.qmp('blockdev-add', { + self.qsd.cmd('blockdev-add', { 'driver': imgfmt, 'node-name': 'overlay', 'backing': 'node0', @@ -75,12 +75,10 @@ class TestGraphChangesWhileIO(QMPTestCase): 'filename': top } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.qsd.qmp('blockdev-del', { + self.qsd.cmd('blockdev-del', { 'node-name': 'overlay' }) - self.assert_qmp(result, 'return', {}) =20 bench_thr.join() =20 @@ -92,7 +90,7 @@ class TestGraphChangesWhileIO(QMPTestCase): qemu_io('-c', 'write 0 64k', top) qemu_io('-c', 'write 128k 64k', top) =20 - result =3D self.qsd.qmp('blockdev-add', { + self.qsd.cmd('blockdev-add', { 'driver': imgfmt, 'node-name': 'overlay', 'backing': None, @@ -101,26 +99,22 @@ class TestGraphChangesWhileIO(QMPTestCase): 'filename': top } }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.qsd.qmp('blockdev-snapshot', { + self.qsd.cmd('blockdev-snapshot', { 'node': 'node0', 'overlay': 'overlay', }) - self.assert_qmp(result, 'return', {}) =20 # While qemu-img bench is running, repeatedly commit overlay to no= de0 while bench_thr.is_alive(): - result =3D self.qsd.qmp('block-commit', { + self.qsd.cmd('block-commit', { 'job-id': 'job0', 'device': 'overlay', }) - self.assert_qmp(result, 'return', {}) =20 - result =3D self.qsd.qmp('block-job-cancel', { + self.qsd.cmd('block-job-cancel', { 'device': 'job0', }) - self.assert_qmp(result, 'return', {}) =20 cancelled =3D False while not cancelled: diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index f6e449d071..5e3b2c7e46 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -213,8 +213,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, ba= se_img_path, result =3D vm.qmp('query-block-jobs') assert len(result['return']) =3D=3D 1 =20 - result =3D vm.qmp('block-job-set-speed', device=3D'push-backup', s= peed=3D0) - assert result =3D=3D {'return': {}} + vm.cmd('block-job-set-speed', device=3D'push-backup', speed=3D0) =20 log(vm.event_wait(name=3D'BLOCK_JOB_COMPLETED', match=3D{'data': {'device': 'push-backup'}}), diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests= /qemu-iotests/tests/migrate-bitmaps-postcopy-test index dda55fad28..c519e6db8c 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test @@ -118,11 +118,10 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTes= tCase): def start_postcopy(self): """ Run migration until RESUME event on target. Return this event.= """ for i in range(nb_bitmaps): - result =3D self.vm_a.qmp('block-dirty-bitmap-add', node=3D'dri= ve0', - name=3D'bitmap{}'.format(i), - granularity=3Dgranularity, - persistent=3DTrue) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-add', node=3D'drive0', + name=3D'bitmap{}'.format(i), + granularity=3Dgranularity, + persistent=3DTrue) =20 result =3D self.vm_a.qmp('x-debug-block-dirty-bitmap-sha256', node=3D'drive0', name=3D'bitmap0') @@ -140,9 +139,8 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestC= ase): # We want to calculate resulting sha256. Do it in bitmap0, so, dis= able # other bitmaps for i in range(1, nb_bitmaps): - result =3D self.vm_a.qmp('block-dirty-bitmap-disable', node=3D= 'drive0', - name=3D'bitmap{}'.format(i)) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-disable', node=3D'drive0', + name=3D'bitmap{}'.format(i)) =20 apply_discards(self.vm_a, discards2) =20 @@ -152,24 +150,19 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTes= tCase): =20 # Now, enable some bitmaps, to be updated during migration for i in range(2, nb_bitmaps, 2): - result =3D self.vm_a.qmp('block-dirty-bitmap-enable', node=3D'= drive0', - name=3D'bitmap{}'.format(i)) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('block-dirty-bitmap-enable', node=3D'drive0', + name=3D'bitmap{}'.format(i)) =20 caps =3D [{'capability': 'dirty-bitmaps', 'state': True}, {'capability': 'events', 'state': True}] =20 - result =3D self.vm_a.qmp('migrate-set-capabilities', capabilities= =3Dcaps) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate-set-capabilities', capabilities=3Dcaps) =20 - result =3D self.vm_b.qmp('migrate-set-capabilities', capabilities= =3Dcaps) - self.assert_qmp(result, 'return', {}) + self.vm_b.cmd('migrate-set-capabilities', capabilities=3Dcaps) =20 - result =3D self.vm_a.qmp('migrate', uri=3D'exec:cat>' + fifo) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate', uri=3D'exec:cat>' + fifo) =20 - result =3D self.vm_a.qmp('migrate-start-postcopy') - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate-start-postcopy') =20 event_resume =3D self.vm_b.event_wait('RESUME') self.vm_b_events.append(event_resume) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index eebb256485..f98e721e97 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -67,8 +67,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if persistent: params['persistent'] =3D True =20 - result =3D vm.qmp('block-dirty-bitmap-add', params) - self.assert_qmp(result, 'return', {}) + vm.cmd('block-dirty-bitmap-add', params) =20 def check_bitmap(self, vm, sha256): result =3D vm.qmp('x-debug-block-dirty-bitmap-sha256', @@ -91,17 +90,15 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if migrate_bitmaps: mig_caps.append({'capability': 'dirty-bitmaps', 'state': True}) =20 - result =3D self.vm_a.qmp('migrate-set-capabilities', - capabilities=3Dmig_caps) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate-set-capabilities', + capabilities=3Dmig_caps) =20 self.add_bitmap(self.vm_a, granularity, persistent) for r in regions: self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % r) sha256 =3D get_bitmap_hash(self.vm_a) =20 - result =3D self.vm_a.qmp('migrate', uri=3Dmig_cmd) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate', uri=3Dmig_cmd) while True: event =3D self.vm_a.event_wait('MIGRATION') if event['data']['status'] =3D=3D 'completed': @@ -115,8 +112,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): removed =3D (not migrate_bitmaps) and persistent self.check_bitmap(self.vm_a, False if removed else sha256) =20 - result =3D self.vm_a.qmp('cont') - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('cont') =20 # test that bitmap is still here after invalidation self.check_bitmap(self.vm_a, sha256) @@ -159,9 +155,8 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if online: os.mkfifo(mig_file) self.vm_b.launch() - result =3D self.vm_b.qmp('migrate-set-capabilities', - capabilities=3Dmig_caps) - self.assert_qmp(result, 'return', {}) + self.vm_b.cmd('migrate-set-capabilities', + capabilities=3Dmig_caps) =20 self.add_bitmap(self.vm_a, granularity, persistent) for r in regions: @@ -172,12 +167,10 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.vm_a.shutdown() self.vm_a.launch() =20 - result =3D self.vm_a.qmp('migrate-set-capabilities', - capabilities=3Dmig_caps) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate-set-capabilities', + capabilities=3Dmig_caps) =20 - result =3D self.vm_a.qmp('migrate', uri=3Dmig_cmd) - self.assert_qmp(result, 'return', {}) + self.vm_a.cmd('migrate', uri=3Dmig_cmd) while True: event =3D self.vm_a.event_wait('MIGRATION') if event['data']['status'] =3D=3D 'completed': @@ -186,11 +179,9 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if not online: self.vm_a.shutdown() self.vm_b.launch() - result =3D self.vm_b.qmp('migrate-set-capabilities', - capabilities=3Dmig_caps) - self.assert_qmp(result, 'return', {}) - result =3D self.vm_b.qmp('migrate-incoming', uri=3Dincoming_cm= d) - self.assert_qmp(result, 'return', {}) + self.vm_b.cmd('migrate-set-capabilities', + capabilities=3Dmig_caps) + self.vm_b.cmd('migrate-incoming', uri=3Dincoming_cmd) =20 while True: event =3D self.vm_b.event_wait('MIGRATION') @@ -256,8 +247,7 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestCa= se): self.vm =3D iotests.VM() self.vm.launch() =20 - result =3D self.vm.qmp('blockdev-add', blockdev) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-add', blockdev) =20 # Check that the bitmaps are there nodes =3D self.vm.qmp('query-named-block-nodes', flat=3DTrue)['ret= urn'] @@ -266,8 +256,7 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestCa= se): self.assert_qmp(node, 'dirty-bitmaps[0]/name', 'bmap0') =20 caps =3D [{'capability': 'events', 'state': True}] - result =3D self.vm.qmp('migrate-set-capabilities', capabilities=3D= caps) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('migrate-set-capabilities', capabilities=3Dcaps) =20 def tearDown(self): self.vm.shutdown() @@ -278,14 +267,12 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTest= Case): """ Continue the source after migration. """ - result =3D self.vm.qmp('migrate', uri=3D'exec: cat > /dev/null') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('migrate', uri=3D'exec: cat > /dev/null') =20 with Timeout(10, 'Migration timeout'): self.vm.wait_migration('postmigrate') =20 - result =3D self.vm.qmp('cont') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('cont') =20 =20 def main() -> None: diff --git a/tests/qemu-iotests/tests/migrate-during-backup b/tests/qemu-io= tests/tests/migrate-during-backup index 34103229ee..afb2277896 100755 --- a/tests/qemu-iotests/tests/migrate-during-backup +++ b/tests/qemu-iotests/tests/migrate-during-backup @@ -43,7 +43,7 @@ class TestMigrateDuringBackup(iotests.QMPTestCase): =20 self.vm =3D iotests.VM().add_drive(disk_a) self.vm.launch() - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'node-name': 'target', 'driver': iotests.imgfmt, 'file': { @@ -51,26 +51,21 @@ class TestMigrateDuringBackup(iotests.QMPTestCase): 'filename': disk_b } }) - self.assert_qmp(result, 'return', {}) =20 def test_migrate(self): - result =3D self.vm.qmp('blockdev-backup', device=3D'drive0', - target=3D'target', sync=3D'full', - speed=3D1, x_perf=3D{ - 'max-workers': 1, - 'max-chunk': 64 * 1024 - }) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-backup', device=3D'drive0', + target=3D'target', sync=3D'full', + speed=3D1, x_perf=3D{ + 'max-workers': 1, + 'max-chunk': 64 * 1024 + }) =20 - result =3D self.vm.qmp('job-pause', id=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('job-pause', id=3D'drive0') =20 - result =3D self.vm.qmp('migrate-set-capabilities', - capabilities=3D[{'capability': 'events', - 'state': True}]) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('migrate', uri=3Dmig_cmd) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('migrate-set-capabilities', + capabilities=3D[{'capability': 'events', + 'state': True}]) + self.vm.cmd('migrate', uri=3Dmig_cmd) =20 e =3D self.vm.events_wait((('MIGRATION', {'data': {'status': 'completed'}}), @@ -80,11 +75,9 @@ class TestMigrateDuringBackup(iotests.QMPTestCase): # Don't assert that e is 'failed' now: this way we'll miss # possible crash when backup continues :) =20 - result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', - speed=3D0) - self.assert_qmp(result, 'return', {}) - result =3D self.vm.qmp('job-resume', id=3D'drive0') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-set-speed', device=3D'drive0', + speed=3D0) + self.vm.cmd('job-resume', id=3D'drive0') =20 # For future: if something changes so that both migration # and backup pass, let's not miss that moment, as it may diff --git a/tests/qemu-iotests/tests/migration-permissions b/tests/qemu-io= tests/tests/migration-permissions index 4e1da369c9..0deaad2d3a 100755 --- a/tests/qemu-iotests/tests/migration-permissions +++ b/tests/qemu-iotests/tests/migration-permissions @@ -47,11 +47,10 @@ class TestMigrationPermissions(iotests.QMPTestCase): =20 vms[i].launch() =20 - result =3D vms[i].qmp('migrate-set-capabilities', - capabilities=3D[ - {'capability': 'events', 'state': True} - ]) - self.assert_qmp(result, 'return', {}) + vms[i].cmd('migrate-set-capabilities', + capabilities=3D[ + {'capability': 'events', 'state': True} + ]) =20 self.vm_s =3D vms[0] self.vm_d =3D vms[1] diff --git a/tests/qemu-iotests/tests/mirror-ready-cancel-error b/tests/qem= u-iotests/tests/mirror-ready-cancel-error index a59e245659..ed2e46447e 100755 --- a/tests/qemu-iotests/tests/mirror-ready-cancel-error +++ b/tests/qemu-iotests/tests/mirror-ready-cancel-error @@ -48,51 +48,48 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): os.remove(target) =20 def add_blockdevs(self, once: bool) -> None: - res =3D self.vm.qmp('blockdev-add', - {'node-name': 'source', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': source - }}) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('blockdev-add', + {'node-name': 'source', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': source + }}) =20 # blkdebug notes: # Enter state 2 on the first flush, which happens before the # job enters the READY state. The second flush will happen # when the job is about to complete, and we want that one to # fail. - res =3D self.vm.qmp('blockdev-add', - {'node-name': 'target', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'blkdebug', - 'image': { - 'driver': 'file', - 'filename': target - }, - 'set-state': [{ - 'event': 'flush_to_disk', - 'state': 1, - 'new_state': 2 - }], - 'inject-error': [{ - 'event': 'flush_to_disk', - 'once': once, - 'immediately': True, - 'state': 2 - }]}}) - self.assert_qmp(res, 'return', {}) + self.vm.cmd('blockdev-add', + {'node-name': 'target', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'blkdebug', + 'image': { + 'driver': 'file', + 'filename': target + }, + 'set-state': [{ + 'event': 'flush_to_disk', + 'state': 1, + 'new_state': 2 + }], + 'inject-error': [{ + 'event': 'flush_to_disk', + 'once': once, + 'immediately': True, + 'state': 2 + }]}}) =20 def start_mirror(self) -> None: - res =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'source', - target=3D'target', - filter_node_name=3D'mirror-top', - sync=3D'full', - on_target_error=3D'stop') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + filter_node_name=3D'mirror-top', + sync=3D'full', + on_target_error=3D'stop') =20 def cancel_mirror_with_error(self) -> None: self.vm.event_wait('BLOCK_JOB_READY') @@ -107,8 +104,7 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): while self.vm.event_wait('JOB_STATUS_CHANGE', timeout=3D0.0) is no= t None: pass =20 - res =3D self.vm.qmp('block-job-cancel', device=3D'mirror') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-job-cancel', device=3D'mirror') =20 self.vm.event_wait('BLOCK_JOB_ERROR') =20 diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests= /tests/mirror-top-perms index 8bca592708..fab9907e92 100755 --- a/tests/qemu-iotests/tests/mirror-top-perms +++ b/tests/qemu-iotests/tests/mirror-top-perms @@ -78,12 +78,11 @@ class TestMirrorTopPerms(iotests.QMPTestCase): difficult to let some other qemu process open the image.) """ =20 - result =3D self.vm.qmp('blockdev-mirror', - job_id=3D'mirror', - device=3D'drive0', - target=3D'null', - sync=3D'full') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('blockdev-mirror', + job_id=3D'mirror', + device=3D'drive0', + target=3D'null', + sync=3D'full') =20 self.vm.event_wait('BLOCK_JOB_READY') =20 @@ -105,9 +104,8 @@ class TestMirrorTopPerms(iotests.QMPTestCase): except machine.VMLaunchFailure as exc: assert 'Is another process using the image' in exc.output =20 - result =3D self.vm.qmp('block-job-cancel', - device=3D'mirror') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-job-cancel', + device=3D'mirror') =20 self.vm.event_wait('BLOCK_JOB_COMPLETED') =20 diff --git a/tests/qemu-iotests/tests/nbd-multiconn b/tests/qemu-iotests/te= sts/nbd-multiconn index 7e686a786e..479e872f2a 100755 --- a/tests/qemu-iotests/tests/nbd-multiconn +++ b/tests/qemu-iotests/tests/nbd-multiconn @@ -48,12 +48,11 @@ class TestNbdMulticonn(iotests.QMPTestCase): =20 self.vm =3D iotests.VM() self.vm.launch() - result =3D self.vm.qmp('blockdev-add', { + self.vm.cmd('blockdev-add', { 'driver': 'qcow2', 'node-name': 'n', 'file': {'driver': 'file', 'filename': disk} }) - self.assert_qmp(result, 'return', {}) =20 def tearDown(self): self.vm.shutdown() @@ -74,12 +73,10 @@ class TestNbdMulticonn(iotests.QMPTestCase): if max_connections is not None: args['max-connections'] =3D max_connections =20 - result =3D self.vm.qmp('nbd-server-start', args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-start', args) yield =20 - result =3D self.vm.qmp('nbd-server-stop') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('nbd-server-stop') =20 def add_export(self, name, writable=3DNone): args =3D { @@ -91,8 +88,7 @@ class TestNbdMulticonn(iotests.QMPTestCase): if writable is not None: args['writable'] =3D writable =20 - result =3D self.vm.qmp('block-export-add', args) - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-export-add', args) =20 def test_default_settings(self): with self.run_server(): diff --git a/tests/qemu-iotests/tests/reopen-file b/tests/qemu-iotests/test= s/reopen-file index 8590a94d53..5a50794ffc 100755 --- a/tests/qemu-iotests/tests/reopen-file +++ b/tests/qemu-iotests/tests/reopen-file @@ -64,12 +64,11 @@ class TestReopenFile(QMPTestCase): self.fail('qemu-io pattern verification failed') =20 def test_reopen_file(self) -> None: - result =3D self.vm.qmp('blockdev-reopen', options=3D[{ + self.vm.cmd('blockdev-reopen', options=3D[{ 'driver': imgfmt, 'node-name': 'format', 'file': 'raw' }]) - self.assert_qmp(result, 'return', {}) =20 # Do some I/O to the image to see whether it still works # (Pattern verification will be checked by tearDown()) diff --git a/tests/qemu-iotests/tests/stream-error-on-reset b/tests/qemu-io= tests/tests/stream-error-on-reset index 5a8c3a9e8d..b60aabb68e 100755 --- a/tests/qemu-iotests/tests/stream-error-on-reset +++ b/tests/qemu-iotests/tests/stream-error-on-reset @@ -115,8 +115,7 @@ class TestStreamErrorOnReset(QMPTestCase): # Launch a stream job, which will take at least a second to # complete, because the base image is throttled (so we can # get in between it having started and it having completed) - res =3D self.vm.qmp('block-stream', job_id=3D'stream', device=3D't= op') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('block-stream', job_id=3D'stream', device=3D'top') =20 while True: ev =3D self.vm.event_wait('JOB_STATUS_CHANGE') @@ -125,8 +124,7 @@ class TestStreamErrorOnReset(QMPTestCase): # forces the virtio-scsi device to be reset, thus draining # the stream job, and making it complete. Completing # inside of that drain should not result in a segfault. - res =3D self.vm.qmp('system_reset') - self.assert_qmp(res, 'return', {}) + self.vm.cmd('system_reset') elif ev['data']['status'] =3D=3D 'null': # The test is done once the job is gone break diff --git a/tests/qemu-iotests/tests/stream-under-throttle b/tests/qemu-io= tests/tests/stream-under-throttle index c24dfbcaa2..1a50b682fc 100755 --- a/tests/qemu-iotests/tests/stream-under-throttle +++ b/tests/qemu-iotests/tests/stream-under-throttle @@ -102,10 +102,9 @@ class TestStreamWithThrottle(iotests.QMPTestCase): Do a simple stream beneath the two throttle nodes. Should complete with no problems. ''' - result =3D self.vm.qmp('block-stream', - job_id=3D'stream', - device=3D'unthrottled-node') - self.assert_qmp(result, 'return', {}) + self.vm.cmd('block-stream', + job_id=3D'stream', + device=3D'unthrottled-node') =20 # Should succeed and not time out try: --=20 2.41.0