From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857484569490.62223706558984; Mon, 10 Jan 2022 15:31:24 -0800 (PST) Received: from localhost ([::1]:42078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n748J-000249-GU for importer@patchew.org; Mon, 10 Jan 2022 18:31:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746Q-0008CC-Ig for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38085) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746P-00087e-2P for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-wXYYAMxiNgWXDmB9GjWlGQ-1; Mon, 10 Jan 2022 18:29:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91478E768; Mon, 10 Jan 2022 23:29:21 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFE9C7B022; Mon, 10 Jan 2022 23:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857363; 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=ufRxEqfN4BYABDdDAy7M/noltxaTvFSmR+E+X0sJiek=; b=CRHF0sUXFn/btiBVxyk7C8HH/xpEq2uJlVtOykxrZsyUigxmai3lq+P2kjyMYff2aCigVi 4vhlbXrZLGlLkYWWubzPFBw7ffheYZfcXDtjnFFN2vJWKVtDjY4mV58e0ltkl9wpNgHHsQ iY8JNDNLvFKHjCmlXwobVEws1PuBTpg= X-MC-Unique: wXYYAMxiNgWXDmB9GjWlGQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 01/31] python/aqmp: use absolute import statement Date: Mon, 10 Jan 2022 18:28:40 -0500 Message-Id: <20220110232910.1923864-2-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857486175100001 Content-Type: text/plain; charset="utf-8" pylint's dependency astroid appears to have bugs in 2.9.1 and 2.9.2 (Dec 31 and Jan 3) that appear to erroneously expect the qemu namespace to have an __init__.py file. astroid 2.9.3 (Jan 9) avoids that problem, but appears to not understand a relative import within a namespace package. Update the relative import - it was worth changing anyway, because these packages will eventually be packaged and distributed separately. Signed-off-by: John Snow Message-id: 20220110191349.1841027-2-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/aqmp/aqmp_tui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/aqmp/aqmp_tui.py index a2929f771c..f1e926dd75 100644 --- a/python/qemu/aqmp/aqmp_tui.py +++ b/python/qemu/aqmp/aqmp_tui.py @@ -35,7 +35,8 @@ import urwid import urwid_readline =20 -from ..qmp import QEMUMonitorProtocol, QMPBadPortError +from qemu.qmp import QEMUMonitorProtocol, QMPBadPortError + from .error import ProtocolError from .message import DeserializationError, Message, UnexpectedTypeError from .protocol import ConnectError, Runstate --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857496559648.5111428518491; Mon, 10 Jan 2022 15:31:36 -0800 (PST) Received: from localhost ([::1]:43002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n748V-0002fi-KN for importer@patchew.org; Mon, 10 Jan 2022 18:31:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746c-0000AJ-8f for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746V-00088d-VA for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-mDNgm2cUPWSJiz0BvxB2-w-1; Mon, 10 Jan 2022 18:29:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E0DB1083F6E; Mon, 10 Jan 2022 23:29:29 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2B8C7B028; Mon, 10 Jan 2022 23:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857371; 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=BAyjc9fmhmTlfmWbuScgD6tJRKwOreXbnEvlDl+wRK0=; b=N42EThwxTv/N6/fVy7mP9bdfXmkOdljOYNqOaOHHfFg0aotXonLqNDSp9YpuDvAsjsimCz ybaXj6eHZxxmi+cDHqzeBkS3QCucEcF2XyxRIu+CiULZPiOQrvjSfd/9vcEqML0Wsq5d5D hwHr4cSwNofjr9kbmjgLemAb+A97PNQ= X-MC-Unique: mDNgm2cUPWSJiz0BvxB2-w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 02/31] Python/aqmp: fix type definitions for mypy 0.920 Date: Mon, 10 Jan 2022 18:28:41 -0500 Message-Id: <20220110232910.1923864-3-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857497879100001 Content-Type: text/plain; charset="utf-8" 0.920 (Released 2021-12-15) is not entirely happy with the way that I was defining _FutureT: qemu/aqmp/protocol.py:601: error: Item "object" of the upper bound "Optional[Future[Any]]" of type variable "_FutureT" has no attribute "done" Update it with something a little mechanically simpler that works better across a wider array of mypy versions. Signed-off-by: John Snow Message-id: 20220110191349.1841027-3-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/aqmp/protocol.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py index 5190b33b13..c4fbe35a0e 100644 --- a/python/qemu/aqmp/protocol.py +++ b/python/qemu/aqmp/protocol.py @@ -43,8 +43,8 @@ =20 =20 T =3D TypeVar('T') +_U =3D TypeVar('_U') _TaskFN =3D Callable[[], Awaitable[None]] # aka ``async def func() -> Non= e`` -_FutureT =3D TypeVar('_FutureT', bound=3DOptional['asyncio.Future[Any]']) =20 =20 class Runstate(Enum): @@ -591,7 +591,8 @@ def _cleanup(self) -> None: """ Fully reset this object to a clean state and return to `IDLE`. """ - def _paranoid_task_erase(task: _FutureT) -> Optional[_FutureT]: + def _paranoid_task_erase(task: Optional['asyncio.Future[_U]'] + ) -> Optional['asyncio.Future[_U]']: # Help to erase a task, ENSURING it is fully quiesced first. assert (task is None) or task.done() return None if (task and task.done()) else task --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857777176914.5987973482038; Mon, 10 Jan 2022 15:36:17 -0800 (PST) Received: from localhost ([::1]:50056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74D1-0007no-U9 for importer@patchew.org; Mon, 10 Jan 2022 18:36:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746m-0000ju-9q for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746k-00089Z-PL for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:47 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-240-FQVQfnEdNoiWyrPb0Lf9oQ-1; Mon, 10 Jan 2022 18:29:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 957431019631; Mon, 10 Jan 2022 23:29:41 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 716697B022; Mon, 10 Jan 2022 23:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857386; 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=VUcGHCn7G9JUHxI079emoPM39xxMoNT5ubpHX3950Rg=; b=Ag0E7+S8w47j53+3LMu9brDMCe7XMyxH6QNI0XzowoDJYk+OhSlTPTubHiEACo5iHS60wq M43h8Bl+Js86S7rz4d4Wb3i2SIegl/tYAx/V7hnUDYYBW4j7mqEB/UtZ+5CNUgGq76uCTN hUxgsc2LDNh+GpNuLaMJhWRwmgEZvHI= X-MC-Unique: FQVQfnEdNoiWyrPb0Lf9oQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 03/31] python: update type hints for mypy 0.930 Date: Mon, 10 Jan 2022 18:28:42 -0500 Message-Id: <20220110232910.1923864-4-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857778088100001 Content-Type: text/plain; charset="utf-8" Mypy 0.930, released Dec 22, changes the way argparse objects are considered. Crafting a definition that works under Python 3.6 and an older mypy alongside newer versions simultaneously is ... difficult, so... eh. Stub it out with an 'Any' definition to get the CI moving again. Oh well. Signed-off-by: John Snow Message-id: 20220110191349.1841027-4-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/qmp/qom_common.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/python/qemu/qmp/qom_common.py b/python/qemu/qmp/qom_common.py index a59ae1a2a1..2e4c741f77 100644 --- a/python/qemu/qmp/qom_common.py +++ b/python/qemu/qmp/qom_common.py @@ -30,10 +30,6 @@ from . import QEMUMonitorProtocol, QMPError =20 =20 -# The following is needed only for a type alias. -Subparsers =3D argparse._SubParsersAction # pylint: disable=3Dprotected-a= ccess - - class ObjectPropertyInfo: """ Represents the return type from e.g. qom-list. @@ -89,7 +85,7 @@ def __init__(self, args: argparse.Namespace): self.qmp.connect() =20 @classmethod - def register(cls, subparsers: Subparsers) -> None: + def register(cls, subparsers: Any) -> None: """ Register this command with the argument parser. =20 --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857935835153.9555097590479; Mon, 10 Jan 2022 15:38:55 -0800 (PST) Received: from localhost ([::1]:58776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Fa-0005Pq-Sh for importer@patchew.org; Mon, 10 Jan 2022 18:38:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746o-0000u7-J2 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n746n-0008A2-0X for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:29:50 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-n0gg6xe4MD2pgnynJSo4Kw-1; Mon, 10 Jan 2022 18:29:45 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2EA56192781C; Mon, 10 Jan 2022 23:29:44 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id B504C7B038; Mon, 10 Jan 2022 23:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857388; 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=9GAkPbAP3QTtD8i7jq4aPj7bx9HsKuinWnJaYnfoWiE=; b=YAul7OavyIsqQYfOio3X0btSCalG4HlYOOnP2+wnk6NUfGkJ+s19bdT2O43D99FiVVNaNl K/6HFkgUVjyZ63N+2mNY7lPXtx8XAy1uZKoOVB+iBZmABLIRSBFIoMMxFX1AY5VgdFWu+a G2GymCxOYDhArncqywphn4J6ogJ0YHg= X-MC-Unique: n0gg6xe4MD2pgnynJSo4Kw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 04/31] simplebench: Fix Python syntax error (reported by LGTM) Date: Mon, 10 Jan 2022 18:28:43 -0500 Message-Id: <20220110232910.1923864-5-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Stefan Weil , Markus Armbruster , Wainer Moschetta , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857936417100001 From: Stefan Weil Fixes: b2fcb0c5754c2554b8406376e99a75e9e0a6b7bd Signed-off-by: Stefan Weil Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: John Snow Message-id: 20220107153019.504124-1-sw@weilnetz.de Signed-off-by: John Snow --- scripts/simplebench/bench-example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/simplebench/bench-example.py b/scripts/simplebench/ben= ch-example.py index 4864435f39..fc370691e0 100644 --- a/scripts/simplebench/bench-example.py +++ b/scripts/simplebench/bench-example.py @@ -25,7 +25,7 @@ =20 def bench_func(env, case): """ Handle one "cell" of benchmarking table. """ - return bench_block_copy(env['qemu_binary'], env['cmd'], {} + return bench_block_copy(env['qemu_binary'], env['cmd'], {}, case['source'], case['target']) =20 =20 --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16418579900239.31122201279561; Mon, 10 Jan 2022 15:39:50 -0800 (PST) Received: from localhost ([::1]:33212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74GS-0007DC-VX for importer@patchew.org; Mon, 10 Jan 2022 18:39:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n747q-0002X3-SH for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:30:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n747p-00006g-DO for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:30:54 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-424-LZsu2k_KNEyzjRNuS5t3nw-1; Mon, 10 Jan 2022 18:30:51 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C054684B9C3; Mon, 10 Jan 2022 23:30:49 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 523427B038; Mon, 10 Jan 2022 23:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857452; 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=Nz15PmpTYR+rhyUU5mECW7V1jU7yOKRzUIgObkhacpU=; b=QEpaxEWfm7YX6czb/nXfS0gEJ82lTY12qUVBPAa9cGIGkP8TiI25ttWm4M+YLqqUKZ2eHh Ccq0r4s5VAN48bVXnNh36E8rXaJsKGzq+6OQdoHLGxUtUHs1/9QzoY1KcImwxD3ZGsCGr6 A1vun00PeKUcUh3mVqyviaEUKksoDQY= X-MC-Unique: LZsu2k_KNEyzjRNuS5t3nw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 05/31] python/aqmp: fix docstring typo Date: Mon, 10 Jan 2022 18:28:44 -0500 Message-Id: <20220110232910.1923864-6-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857992073100001 Content-Type: text/plain; charset="utf-8" Reported-by: Vladimir Sementsov-Ogievskiy Signed-off-by: John Snow Reviewed-by: Beraldo Leal --- python/qemu/aqmp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py index 880d5b6fa7..173556404d 100644 --- a/python/qemu/aqmp/__init__.py +++ b/python/qemu/aqmp/__init__.py @@ -6,7 +6,7 @@ QEMU Guest Agent, and the QEMU Storage Daemon. =20 `QMPClient` provides the main functionality of this package. All errors -raised by this library dervive from `AQMPError`, see `aqmp.error` for +raised by this library derive from `AQMPError`, see `aqmp.error` for additional detail. See `aqmp.events` for an in-depth tutorial on managing QMP events. """ --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858171487632.7473842535904; Mon, 10 Jan 2022 15:42:51 -0800 (PST) Received: from localhost ([::1]:39318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74JO-0003FE-HL for importer@patchew.org; Mon, 10 Jan 2022 18:42:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748W-0003ru-HL for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748U-00008z-PN for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-Cb228NwsPgK8Mxod8y9q6w-1; Mon, 10 Jan 2022 18:31:31 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7C1C81CCB4; Mon, 10 Jan 2022 23:31:29 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2E057B9C5; Mon, 10 Jan 2022 23:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857494; 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=NuSwDqKg/bbUG6s3ZY2E9hTlUXu4rBc7DyGKnKTOigE=; b=cSY9SggQotQ36l23FC6Slk/+yWslLHDkix3TAF+v700XXzdXndaiGq6OcJOY6wSyWyNqVt xm8K2sy78fb3QSUTCnDIVGwL5F09nAHSfrRAEufmwqAzXCuhSeOiu4w6J6W/9pXz9AA6ES /i6Qfgc/O7eqtcyr/mL/XkfWsWwb9sw= X-MC-Unique: Cb228NwsPgK8Mxod8y9q6w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 06/31] python/aqmp: add __del__ method to legacy interface Date: Mon, 10 Jan 2022 18:28:45 -0500 Message-Id: <20220110232910.1923864-7-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858173706100003 Content-Type: text/plain; charset="utf-8" asyncio can complain *very* loudly if you forget to back out of things gracefully before the garbage collector starts destroying objects that contain live references to asyncio Tasks. The usual fix is just to remember to call aqmp.disconnect(), but for the sake of the legacy wrapper and quick, one-off scripts where a graceful shutdown is not necessarily of paramount imporance, add a courtesy cleanup that will trigger prior to seeing screenfuls of confusing asyncio tracebacks. Note that we can't *always* save you from yourself; depending on when the GC runs, you might just seriously be out of luck. The best we can do in this case is to gently remind you to clean up after yourself. (Still much better than multiple pages of incomprehensible python warnings for the crime of forgetting to put your toys away.) Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/aqmp/legacy.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 9e7b9fb80b..2ccb136b02 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -16,6 +16,8 @@ import qemu.qmp from qemu.qmp import QMPMessage, QMPReturnValue, SocketAddrT =20 +from .error import AQMPError +from .protocol import Runstate from .qmp_client import QMPClient =20 =20 @@ -136,3 +138,19 @@ def settimeout(self, timeout: Optional[float]) -> None: =20 def send_fd_scm(self, fd: int) -> None: self._aqmp.send_fd_scm(fd) + + def __del__(self) -> None: + if self._aqmp.runstate =3D=3D Runstate.IDLE: + return + + if not self._aloop.is_running(): + self.close() + else: + # Garbage collection ran while the event loop was running. + # Nothing we can do about it now, but if we don't raise our + # own error, the user will be treated to a lot of traceback + # they might not understand. + raise AQMPError( + "QEMUMonitorProtocol.close()" + " was not called before object was garbage collected" + ) --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857926690962.246295920356; Mon, 10 Jan 2022 15:38:46 -0800 (PST) Received: from localhost ([::1]:57832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74FR-0004n0-M4 for importer@patchew.org; Mon, 10 Jan 2022 18:38:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748X-0003ud-Bh for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748V-00009K-O9 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-PsJ3EeZ6MZaA1pxE-8CysQ-1; Mon, 10 Jan 2022 18:31:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01F1F760C0; Mon, 10 Jan 2022 23:31:31 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id C98007B035; Mon, 10 Jan 2022 23:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857495; 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=5lSe5ckY9kwe3DbxpzcO3XBuqGw1v8fh2OicCiw7MTU=; b=K66eGgRNNImHBTY0RQg6S7bvrf8SOAafY9m136Lp6aESQr3XetWuanq3bwV7RldUrc2+Lg LAoKltS2DkbZrlNX8hJD5md9s2h6tPW2LK+40vp14fS7P+uhTfq7OppV453ED/hjjeQz65 8GQNeCfTT5Wkb0D0e2w91pbeO+c/UF0= X-MC-Unique: PsJ3EeZ6MZaA1pxE-8CysQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 07/31] python/aqmp: handle asyncio.TimeoutError on execute() Date: Mon, 10 Jan 2022 18:28:46 -0500 Message-Id: <20220110232910.1923864-8-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857927524100001 Content-Type: text/plain; charset="utf-8" This exception can be injected into any await statement. If we are canceled via timeout, we want to clear the pending execution record on our way out. Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/qemu/aqmp/qmp_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/aqmp/qmp_client.py index 8105e29fa8..6a985ffe30 100644 --- a/python/qemu/aqmp/qmp_client.py +++ b/python/qemu/aqmp/qmp_client.py @@ -435,7 +435,11 @@ async def _issue(self, msg: Message) -> Union[None, st= r]: msg_id =3D msg['id'] =20 self._pending[msg_id] =3D asyncio.Queue(maxsize=3D1) - await self._outgoing.put(msg) + try: + await self._outgoing.put(msg) + except: + del self._pending[msg_id] + raise =20 return msg_id =20 @@ -452,9 +456,9 @@ async def _reply(self, msg_id: Union[str, None]) -> Mes= sage: was lost, or some other problem. """ queue =3D self._pending[msg_id] - result =3D await queue.get() =20 try: + result =3D await queue.get() if isinstance(result, ExecInterruptedError): raise result return result --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858378421808.5224971010983; Mon, 10 Jan 2022 15:46:18 -0800 (PST) Received: from localhost ([::1]:48752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Mj-0001cv-EX for importer@patchew.org; Mon, 10 Jan 2022 18:46:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748Z-0003yZ-T9 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748X-00009p-36 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-KXTfdr3PPrCPsnndvXR9uQ-1; Mon, 10 Jan 2022 18:31:33 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 506D2192CC41; Mon, 10 Jan 2022 23:31:32 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22FB97B028; Mon, 10 Jan 2022 23:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857496; 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=goWJ0v92K8sKodOS73wTCV8WkTnj6T/OoS1vpc133n4=; b=A2IXB/07g7T9neR5fuHVYic6njmNyD7VQOxXjSDYLFgzkJFa4CUi/TzQDW8zaOVEk7elkv Khi9IrYHMbZ0Wn9c6iU2+TWvT5GUZUqWNo+O1ncGjw1M50hjg0TPwIe+ExZgyO/vZ+LKkE sKqL0v2QHmp+ldcjR/G/gKa68P6V/oQ= X-MC-Unique: KXTfdr3PPrCPsnndvXR9uQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 08/31] python/aqmp: copy type definitions from qmp Date: Mon, 10 Jan 2022 18:28:47 -0500 Message-Id: <20220110232910.1923864-9-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858378990100003 Content-Type: text/plain; charset="utf-8" Copy the remaining type definitions from QMP into the qemu.aqmp.legacy module. Now, users that require the legacy interface don't need to import anything else but qemu.aqmp.legacy wrapper. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/aqmp/legacy.py | 22 ++++++++++++++++++++-- python/qemu/aqmp/protocol.py | 16 ++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 2ccb136b02..9431fe9330 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -6,7 +6,9 @@ =20 import asyncio from typing import ( + Any, Awaitable, + Dict, List, Optional, TypeVar, @@ -14,13 +16,29 @@ ) =20 import qemu.qmp -from qemu.qmp import QMPMessage, QMPReturnValue, SocketAddrT =20 from .error import AQMPError -from .protocol import Runstate +from .protocol import Runstate, SocketAddrT from .qmp_client import QMPClient =20 =20 +#: QMPMessage is an entire QMP message of any kind. +QMPMessage =3D Dict[str, Any] + +#: QMPReturnValue is the 'return' value of a command. +QMPReturnValue =3D object + +#: QMPObject is any object in a QMP message. +QMPObject =3D Dict[str, object] + +# QMPMessage can be outgoing commands or incoming events/returns. +# QMPReturnValue is usually a dict/json object, but due to QAPI's +# 'returns-whitelist', it can actually be anything. +# +# {'return': {}} is a QMPMessage, +# {} is the QMPReturnValue. + + # pylint: disable=3Dmissing-docstring =20 =20 diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py index c4fbe35a0e..5b4f2f0d0a 100644 --- a/python/qemu/aqmp/protocol.py +++ b/python/qemu/aqmp/protocol.py @@ -46,6 +46,10 @@ _U =3D TypeVar('_U') _TaskFN =3D Callable[[], Awaitable[None]] # aka ``async def func() -> Non= e`` =20 +InternetAddrT =3D Tuple[str, int] +UnixAddrT =3D str +SocketAddrT =3D Union[UnixAddrT, InternetAddrT] + =20 class Runstate(Enum): """Protocol session runstate.""" @@ -257,7 +261,7 @@ async def runstate_changed(self) -> Runstate: =20 @upper_half @require(Runstate.IDLE) - async def accept(self, address: Union[str, Tuple[str, int]], + async def accept(self, address: SocketAddrT, ssl: Optional[SSLContext] =3D None) -> None: """ Accept a connection and begin processing message queues. @@ -275,7 +279,7 @@ async def accept(self, address: Union[str, Tuple[str, i= nt]], =20 @upper_half @require(Runstate.IDLE) - async def connect(self, address: Union[str, Tuple[str, int]], + async def connect(self, address: SocketAddrT, ssl: Optional[SSLContext] =3D None) -> None: """ Connect to the server and begin processing message queues. @@ -337,7 +341,7 @@ def _set_state(self, state: Runstate) -> None: =20 @upper_half async def _new_session(self, - address: Union[str, Tuple[str, int]], + address: SocketAddrT, ssl: Optional[SSLContext] =3D None, accept: bool =3D False) -> None: """ @@ -397,7 +401,7 @@ async def _new_session(self, @upper_half async def _establish_connection( self, - address: Union[str, Tuple[str, int]], + address: SocketAddrT, ssl: Optional[SSLContext] =3D None, accept: bool =3D False ) -> None: @@ -424,7 +428,7 @@ async def _establish_connection( await self._do_connect(address, ssl) =20 @upper_half - async def _do_accept(self, address: Union[str, Tuple[str, int]], + async def _do_accept(self, address: SocketAddrT, ssl: Optional[SSLContext] =3D None) -> None: """ Acting as the transport server, accept a single connection. @@ -482,7 +486,7 @@ async def _client_connected_cb(reader: asyncio.StreamRe= ader, self.logger.debug("Connection accepted.") =20 @upper_half - async def _do_connect(self, address: Union[str, Tuple[str, int]], + async def _do_connect(self, address: SocketAddrT, ssl: Optional[SSLContext] =3D None) -> None: """ Acting as the transport client, initiate a connection to a server. --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857729844701.1548013704664; Mon, 10 Jan 2022 15:35:29 -0800 (PST) Received: from localhost ([::1]:49186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74CG-0007Bh-JJ for importer@patchew.org; Mon, 10 Jan 2022 18:35:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748Z-0003xE-2Y for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748W-00009a-FN for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-qAJmimP5Mbul2ts9Dy7_Gg-1; Mon, 10 Jan 2022 18:31:34 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E62484BA43; Mon, 10 Jan 2022 23:31:33 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7247C7B028; Mon, 10 Jan 2022 23:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857495; 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=cRvk1EssMqIMNRz+Y1tAF0BP14oCpFSMW17YP9V7Ho8=; b=hiHcxTw/DNb7NylJ98CThUTJ6BE/uPJgi/1aOU0QJZ1cJf3SdXsscZtGDAxK6mpoNP5DJ7 7ednO8E8w57obcNqVvGG/1tcKKFJ7Lix0PUS5DDjGHQtqGJ8UwEWDOE76aWv1Vez8W58Nd GfA2J5Zkx5hxnhJpZkiCZRRXxQxeuJw= X-MC-Unique: qAJmimP5Mbul2ts9Dy7_Gg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 09/31] python/aqmp: add SocketAddrT to package root Date: Mon, 10 Jan 2022 18:28:48 -0500 Message-Id: <20220110232910.1923864-10-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857731793100001 Content-Type: text/plain; charset="utf-8" It's a commonly needed definition, it can be re-exported by the root. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/aqmp/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py index 173556404d..05f467c141 100644 --- a/python/qemu/aqmp/__init__.py +++ b/python/qemu/aqmp/__init__.py @@ -26,7 +26,12 @@ from .error import AQMPError from .events import EventListener from .message import Message -from .protocol import ConnectError, Runstate, StateError +from .protocol import ( + ConnectError, + Runstate, + SocketAddrT, + StateError, +) from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient =20 =20 @@ -48,4 +53,7 @@ 'ConnectError', 'ExecuteError', 'ExecInterruptedError', + + # Type aliases + 'SocketAddrT', ) --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858160290452.6681941817834; Mon, 10 Jan 2022 15:42:40 -0800 (PST) Received: from localhost ([::1]:38370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74JD-0002ZR-24 for importer@patchew.org; Mon, 10 Jan 2022 18:42:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748j-0004QE-Gx for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748g-0000Gt-FT for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:48 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-99-aAYzhPbxPluJPvTEcxDnXA-1; Mon, 10 Jan 2022 18:31:42 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6561384BA58; Mon, 10 Jan 2022 23:31:41 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF1867B028; Mon, 10 Jan 2022 23:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857505; 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=sdOJhruuN6fxTvu1NBxHScn9EgEMDzEHDJPjcPkDgIc=; b=hbLmA4kI10/ZUUkHtHygqGP2p2m/j5Nra1cf5YLDCv49p9OggoH8cNOjE9DF6xdZLjXs/F cZi/dXI1un38UGUm+JT25QclzD2bDfVLmCtzWTUptkQ07CKbhV5zJAxt+1cHAdY6pwYHwO LPIcyOLl9Rd3zch3VCzCxl4eEwljLlY= X-MC-Unique: aAYzhPbxPluJPvTEcxDnXA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 10/31] python/aqmp: rename AQMPError to QMPError Date: Mon, 10 Jan 2022 18:28:49 -0500 Message-Id: <20220110232910.1923864-11-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858162651100001 Content-Type: text/plain; charset="utf-8" This is in preparation for renaming qemu.aqmp to qemu.qmp. I should have done this from this from the very beginning, but it's a convenient time to make sure this churn is taken care of. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/qemu/aqmp/__init__.py | 6 +++--- python/qemu/aqmp/error.py | 12 ++++++------ python/qemu/aqmp/events.py | 4 ++-- python/qemu/aqmp/legacy.py | 4 ++-- python/qemu/aqmp/protocol.py | 8 ++++---- python/qemu/aqmp/qmp_client.py | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py index 05f467c141..4c22c38079 100644 --- a/python/qemu/aqmp/__init__.py +++ b/python/qemu/aqmp/__init__.py @@ -6,7 +6,7 @@ QEMU Guest Agent, and the QEMU Storage Daemon. =20 `QMPClient` provides the main functionality of this package. All errors -raised by this library derive from `AQMPError`, see `aqmp.error` for +raised by this library derive from `QMPError`, see `aqmp.error` for additional detail. See `aqmp.events` for an in-depth tutorial on managing QMP events. """ @@ -23,7 +23,7 @@ =20 import logging =20 -from .error import AQMPError +from .error import QMPError from .events import EventListener from .message import Message from .protocol import ( @@ -48,7 +48,7 @@ 'Runstate', =20 # Exceptions, most generic to most explicit - 'AQMPError', + 'QMPError', 'StateError', 'ConnectError', 'ExecuteError', diff --git a/python/qemu/aqmp/error.py b/python/qemu/aqmp/error.py index 781f49b008..24ba4d5054 100644 --- a/python/qemu/aqmp/error.py +++ b/python/qemu/aqmp/error.py @@ -1,21 +1,21 @@ """ -AQMP Error Classes +QMP Error Classes =20 This package seeks to provide semantic error classes that are intended to be used directly by clients when they would like to handle particular semantic failures (e.g. "failed to connect") without needing to know the enumeration of possible reasons for that failure. =20 -AQMPError serves as the ancestor for all exceptions raised by this +QMPError serves as the ancestor for all exceptions raised by this package, and is suitable for use in handling semantic errors from this library. In most cases, individual public methods will attempt to catch and re-encapsulate various exceptions to provide a semantic error-handling interface. =20 -.. admonition:: AQMP Exception Hierarchy Reference +.. admonition:: QMP Exception Hierarchy Reference =20 | `Exception` - | +-- `AQMPError` + | +-- `QMPError` | +-- `ConnectError` | +-- `StateError` | +-- `ExecInterruptedError` @@ -31,11 +31,11 @@ """ =20 =20 -class AQMPError(Exception): +class QMPError(Exception): """Abstract error class for all errors originating from this package."= "" =20 =20 -class ProtocolError(AQMPError): +class ProtocolError(QMPError): """ Abstract error class for protocol failures. =20 diff --git a/python/qemu/aqmp/events.py b/python/qemu/aqmp/events.py index 5f7150c78d..f3d4e2b5e8 100644 --- a/python/qemu/aqmp/events.py +++ b/python/qemu/aqmp/events.py @@ -443,7 +443,7 @@ def accept(self, event) -> bool: Union, ) =20 -from .error import AQMPError +from .error import QMPError from .message import Message =20 =20 @@ -451,7 +451,7 @@ def accept(self, event) -> bool: EventFilter =3D Callable[[Message], bool] =20 =20 -class ListenerError(AQMPError): +class ListenerError(QMPError): """ Generic error class for `EventListener`-related problems. """ diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 9431fe9330..27df22818a 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -17,7 +17,7 @@ =20 import qemu.qmp =20 -from .error import AQMPError +from .error import QMPError from .protocol import Runstate, SocketAddrT from .qmp_client import QMPClient =20 @@ -168,7 +168,7 @@ def __del__(self) -> None: # Nothing we can do about it now, but if we don't raise our # own error, the user will be treated to a lot of traceback # they might not understand. - raise AQMPError( + raise QMPError( "QEMUMonitorProtocol.close()" " was not called before object was garbage collected" ) diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py index 5b4f2f0d0a..50e973c2f2 100644 --- a/python/qemu/aqmp/protocol.py +++ b/python/qemu/aqmp/protocol.py @@ -29,7 +29,7 @@ cast, ) =20 -from .error import AQMPError +from .error import QMPError from .util import ( bottom_half, create_task, @@ -65,7 +65,7 @@ class Runstate(Enum): DISCONNECTING =3D 3 =20 =20 -class ConnectError(AQMPError): +class ConnectError(QMPError): """ Raised when the initial connection process has failed. =20 @@ -90,7 +90,7 @@ def __str__(self) -> str: return f"{self.error_message}: {cause}" =20 =20 -class StateError(AQMPError): +class StateError(QMPError): """ An API command (connect, execute, etc) was issued at an inappropriate = time. =20 @@ -363,7 +363,7 @@ async def _new_session(self, This exception will wrap a more concrete one. In most cases, the wrapped exception will be `OSError` or `EOFError`. If a protocol-level failure occurs while establishing a new - session, the wrapped error may also be an `AQMPError`. + session, the wrapped error may also be an `QMPError`. """ assert self.runstate =3D=3D Runstate.IDLE =20 diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/aqmp/qmp_client.py index 6a985ffe30..f1a845cc82 100644 --- a/python/qemu/aqmp/qmp_client.py +++ b/python/qemu/aqmp/qmp_client.py @@ -20,7 +20,7 @@ cast, ) =20 -from .error import AQMPError, ProtocolError +from .error import ProtocolError, QMPError from .events import Events from .message import Message from .models import ErrorResponse, Greeting @@ -66,7 +66,7 @@ class NegotiationError(_WrappedProtocolError): """ =20 =20 -class ExecuteError(AQMPError): +class ExecuteError(QMPError): """ Exception raised by `QMPClient.execute()` on RPC failure. =20 @@ -87,7 +87,7 @@ def __init__(self, error_response: ErrorResponse, self.error_class: str =3D error_response.error.class_ =20 =20 -class ExecInterruptedError(AQMPError): +class ExecInterruptedError(QMPError): """ Exception raised by `execute()` (et al) when an RPC is interrupted. =20 @@ -641,7 +641,7 @@ def send_fd_scm(self, fd: int) -> None: sock =3D self._writer.transport.get_extra_info('socket') =20 if sock.family !=3D socket.AF_UNIX: - raise AQMPError("Sending file descriptors requires a UNIX sock= et.") + raise QMPError("Sending file descriptors requires a UNIX socke= t.") =20 if not hasattr(sock, 'sendmsg'): # We need to void the warranty sticker. --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641857850200154.08155721329524; Mon, 10 Jan 2022 15:37:30 -0800 (PST) Received: from localhost ([::1]:52968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74ED-0001UR-6H for importer@patchew.org; Mon, 10 Jan 2022 18:37:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748j-0004Qe-ND for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748h-0000H7-UN for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-171-9YTrVPyONt2rfeoxd448Pw-1; Mon, 10 Jan 2022 18:31:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B172A81CCB6; Mon, 10 Jan 2022 23:31:42 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87FD17B028; Mon, 10 Jan 2022 23:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857506; 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=TNwWEgLA0yVEeTZP9l3mzoxTrUEAxmq2lgb74pBHN/Q=; b=Tkjy3O1KVI6vwf3s5RrbiYhYqJCk9tIBYVgnTsDDCBWYFCG0UaOQGyd0OpQe7tWOLr3TwU q7Yv3dMpM3n0s0D0kaF3+H5dj8hVZNU03dJuNFt1c8CZVjLTo8ERscgmYLEn5CJOQKJhTo oKUBT+uSLRUBRmmahrqfB6a9sRBmMiY= X-MC-Unique: 9YTrVPyONt2rfeoxd448Pw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 11/31] python/qemu-ga-client: don't use deprecated CLI syntax in usage comment Date: Mon, 10 Jan 2022 18:28:50 -0500 Message-Id: <20220110232910.1923864-12-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641857852328100003 Cleanup related to commit ccd3b3b8112b670f, "qemu-option: warn for short-form boolean options". Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- python/qemu/qmp/qemu_ga_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/qemu/qmp/qemu_ga_client.py b/python/qemu/qmp/qemu_ga_cl= ient.py index 67ac0b4211..b3e1d98c9e 100644 --- a/python/qemu/qmp/qemu_ga_client.py +++ b/python/qemu/qmp/qemu_ga_client.py @@ -5,7 +5,7 @@ =20 Start QEMU with: =20 -# qemu [...] -chardev socket,path=3D/tmp/qga.sock,server,wait=3Doff,id=3Dq= ga0 \ +# qemu [...] -chardev socket,path=3D/tmp/qga.sock,server=3Don,wait=3Doff,i= d=3Dqga0 \ -device virtio-serial \ -device virtserialport,chardev=3Dqga0,name=3Dorg.qemu.guest_agent.0 =20 --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858553994616.2483218119659; Mon, 10 Jan 2022 15:49:13 -0800 (PST) Received: from localhost ([::1]:58066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74PZ-000826-0M for importer@patchew.org; Mon, 10 Jan 2022 18:49:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748l-0004SF-2f for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748j-0000HN-7u for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:31:50 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214-CxVlVZoKMjiW3aUNTBiXjQ-1; Mon, 10 Jan 2022 18:31:45 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09E9E10247A6; Mon, 10 Jan 2022 23:31:44 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id D31DC7B028; Mon, 10 Jan 2022 23:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857508; 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=AW2FhHRH7pKjv6l/23XsAtQ4lKxZE7wChiPYstouEvU=; b=cCc5f8Oe2etSBKsUk6giOLjj1R9AtJYMPD0G+8MwjLsWNCNmFVjWP+m0w2jxbEt3O5+ytL LJszkz5y4W2fRO6NjYWg+LEJnCIqwEzoy2ZIdixZfwjLX4goELxa+gb7rR+wrxufwTbuug CN7TcsVqHrhTf78Bp8bzwEjy3EWixFE= X-MC-Unique: CxVlVZoKMjiW3aUNTBiXjQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 12/31] python/qmp: switch qemu-ga-client to AQMP Date: Mon, 10 Jan 2022 18:28:51 -0500 Message-Id: <20220110232910.1923864-13-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858556287100001 Content-Type: text/plain; charset="utf-8" Async QMP always raises a "ConnectError" on any connection error which houses the cause in a second exception. We can check if this root cause was python's ConnectionError to determine a fairly similar condition to the original error check here. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/qmp/qemu_ga_client.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/python/qemu/qmp/qemu_ga_client.py b/python/qemu/qmp/qemu_ga_cl= ient.py index b3e1d98c9e..15ed430c61 100644 --- a/python/qemu/qmp/qemu_ga_client.py +++ b/python/qemu/qmp/qemu_ga_client.py @@ -37,8 +37,8 @@ # the COPYING file in the top-level directory. =20 import argparse +import asyncio import base64 -import errno import os import random import sys @@ -50,8 +50,8 @@ Sequence, ) =20 -from qemu import qmp -from qemu.qmp import SocketAddrT +from qemu.aqmp import ConnectError, SocketAddrT +from qemu.aqmp.legacy import QEMUMonitorProtocol =20 =20 # This script has not seen many patches or careful attention in quite @@ -61,7 +61,7 @@ # pylint: disable=3Dmissing-docstring =20 =20 -class QemuGuestAgent(qmp.QEMUMonitorProtocol): +class QemuGuestAgent(QEMUMonitorProtocol): def __getattr__(self, name: str) -> Callable[..., Any]: def wrapper(**kwds: object) -> object: return self.command('guest-' + name.replace('_', '-'), **kwds) @@ -149,7 +149,7 @@ def ping(self, timeout: Optional[float]) -> bool: self.qga.settimeout(timeout) try: self.qga.ping() - except TimeoutError: + except asyncio.TimeoutError: return False return True =20 @@ -172,7 +172,7 @@ def suspend(self, mode: str) -> None: try: getattr(self.qga, 'suspend' + '_' + mode)() # On error exception will raise - except TimeoutError: + except asyncio.TimeoutError: # On success command will timed out return =20 @@ -182,7 +182,7 @@ def shutdown(self, mode: str =3D 'powerdown') -> None: =20 try: self.qga.shutdown(mode=3Dmode) - except TimeoutError: + except asyncio.TimeoutError: pass =20 =20 @@ -277,7 +277,7 @@ def _cmd_reboot(client: QemuGuestAgentClient, args: Seq= uence[str]) -> None: =20 def send_command(address: str, cmd: str, args: Sequence[str]) -> None: if not os.path.exists(address): - print('%s not found' % address) + print(f"'{address}' not found. (Is QEMU running?)") sys.exit(1) =20 if cmd not in commands: @@ -287,10 +287,10 @@ def send_command(address: str, cmd: str, args: Sequen= ce[str]) -> None: =20 try: client =3D QemuGuestAgentClient(address) - except OSError as err: + except ConnectError as err: print(err) - if err.errno =3D=3D errno.ECONNREFUSED: - print('Hint: qemu is not running?') + if isinstance(err.exc, ConnectionError): + print('(Is QEMU running?)') sys.exit(1) =20 if cmd =3D=3D 'fsfreeze' and args[0] =3D=3D 'freeze': --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858366042547.64100332213; Mon, 10 Jan 2022 15:46:06 -0800 (PST) Received: from localhost ([::1]:47752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74MX-0000xX-2j for importer@patchew.org; Mon, 10 Jan 2022 18:46:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748v-0004dP-TU for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748t-0000JS-0a for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:01 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-qaZU-6DwPx6NL83PAtMfPg-1; Mon, 10 Jan 2022 18:31:46 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 583C010247A8; Mon, 10 Jan 2022 23:31:45 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BF687B028; Mon, 10 Jan 2022 23:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857515; 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=Zg9LZjkORuTr62yl0AayXxZT2OhZL8s4pf5wPYMaJQc=; b=Lwb2K5A8tI7JaDWALZBdDpjuASi/vkLgEgjYlHhPhIdZNDpPSUiaxAGGHOdpSnPvqHXunS kZWVgZetnVr4KxnjCyszNdK4paI1pkx9o1tLMcxeIylPcaFz7shCMkEpNI0vUjQOAFApzB r3INIPFRxg1LzEd7jc+WiwT0sYD3tvQ= X-MC-Unique: qaZU-6DwPx6NL83PAtMfPg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 13/31] python/qmp: switch qom tools to AQMP Date: Mon, 10 Jan 2022 18:28:52 -0500 Message-Id: <20220110232910.1923864-14-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858367537100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/qmp/qom.py | 5 +++-- python/qemu/qmp/qom_common.py | 3 ++- python/qemu/qmp/qom_fuse.py | 11 ++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/python/qemu/qmp/qom.py b/python/qemu/qmp/qom.py index 8ff28a8343..bb5d1a78f5 100644 --- a/python/qemu/qmp/qom.py +++ b/python/qemu/qmp/qom.py @@ -32,7 +32,8 @@ =20 import argparse =20 -from . import QMPResponseError +from qemu.aqmp import ExecuteError + from .qom_common import QOMCommand =20 =20 @@ -233,7 +234,7 @@ def _list_node(self, path: str) -> None: rsp =3D self.qmp.command('qom-get', path=3Dpath, property=3Ditem.name) print(f" {item.name}: {rsp} ({item.type})") - except QMPResponseError as err: + except ExecuteError as err: print(f" {item.name}: ({item.type})") print('') for item in items: diff --git a/python/qemu/qmp/qom_common.py b/python/qemu/qmp/qom_common.py index 2e4c741f77..e034a6f247 100644 --- a/python/qemu/qmp/qom_common.py +++ b/python/qemu/qmp/qom_common.py @@ -27,7 +27,8 @@ TypeVar, ) =20 -from . import QEMUMonitorProtocol, QMPError +from qemu.aqmp import QMPError +from qemu.aqmp.legacy import QEMUMonitorProtocol =20 =20 class ObjectPropertyInfo: diff --git a/python/qemu/qmp/qom_fuse.py b/python/qemu/qmp/qom_fuse.py index 43f4671fdb..653a76b93b 100644 --- a/python/qemu/qmp/qom_fuse.py +++ b/python/qemu/qmp/qom_fuse.py @@ -48,7 +48,8 @@ import fuse from fuse import FUSE, FuseOSError, Operations =20 -from . import QMPResponseError +from qemu.aqmp import ExecuteError + from .qom_common import QOMCommand =20 =20 @@ -99,7 +100,7 @@ def is_object(self, path: str) -> bool: try: self.qom_list(path) return True - except QMPResponseError: + except ExecuteError: return False =20 def is_property(self, path: str) -> bool: @@ -112,7 +113,7 @@ def is_property(self, path: str) -> bool: if item.name =3D=3D prop: return True return False - except QMPResponseError: + except ExecuteError: return False =20 def is_link(self, path: str) -> bool: @@ -125,7 +126,7 @@ def is_link(self, path: str) -> bool: if item.name =3D=3D prop and item.link: return True return False - except QMPResponseError: + except ExecuteError: return False =20 def read(self, path: str, size: int, offset: int, fh: IO[bytes]) -> by= tes: @@ -138,7 +139,7 @@ def read(self, path: str, size: int, offset: int, fh: I= O[bytes]) -> bytes: try: data =3D str(self.qmp.command('qom-get', path=3Dpath, property= =3Dprop)) data +=3D '\n' # make values shell friendly - except QMPResponseError as err: + except ExecuteError as err: raise FuseOSError(EPERM) from err =20 if offset > len(data): --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858362814630.5597777062274; Mon, 10 Jan 2022 15:46:02 -0800 (PST) Received: from localhost ([::1]:47504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74MT-0000nz-Ni for importer@patchew.org; Mon, 10 Jan 2022 18:46:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748u-0004a2-La for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:23846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748s-0000I1-6H for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-65-06PGFrL3P0KAu_aGhm166w-1; Mon, 10 Jan 2022 18:31:50 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7757F100F942; Mon, 10 Jan 2022 23:31:49 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A4D37B028; Mon, 10 Jan 2022 23:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857511; 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=5fapd+iJCU2gqTizCl2vmpK4gpAcQOtyiLCN9oHVTd8=; b=TlUZ8BHFxpzkVCpuTC7XwlDgpDxb+Kur3QbGGx3xwM5118iEClyX134IoeYd4BncUbpbY/ jRSv1ICxG6Y/pJhielUf2ME2LFcCHKRl0DD7yMIzAkICOc8Ms6HGA8hxminESL25Wgq+X/ Thqzu72BdOX/z70YDyMIvmfygAsXam0= X-MC-Unique: 06PGFrL3P0KAu_aGhm166w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 14/31] python/qmp: switch qmp-shell to AQMP Date: Mon, 10 Jan 2022 18:28:53 -0500 Message-Id: <20220110232910.1923864-15-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858363193100001 Content-Type: text/plain; charset="utf-8" We have a replacement for async QMP, but it doesn't have feature parity yet. For now, then, port the old tool onto the new backend. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/qemu/aqmp/legacy.py | 3 +++ python/qemu/qmp/qmp_shell.py | 31 +++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 27df22818a..0890f95b16 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -22,6 +22,9 @@ from .qmp_client import QMPClient =20 =20 +# (Temporarily) Re-export QMPBadPortError +QMPBadPortError =3D qemu.qmp.QMPBadPortError + #: QMPMessage is an entire QMP message of any kind. QMPMessage =3D Dict[str, Any] =20 diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py index e7d7eb18f1..d11bf54b00 100644 --- a/python/qemu/qmp/qmp_shell.py +++ b/python/qemu/qmp/qmp_shell.py @@ -95,8 +95,13 @@ Sequence, ) =20 -from qemu import qmp -from qemu.qmp import QMPMessage +from qemu.aqmp import ConnectError, QMPError, SocketAddrT +from qemu.aqmp.legacy import ( + QEMUMonitorProtocol, + QMPBadPortError, + QMPMessage, + QMPObject, +) =20 =20 LOG =3D logging.getLogger(__name__) @@ -125,7 +130,7 @@ def complete(self, text: str, state: int) -> Optional[s= tr]: return None =20 =20 -class QMPShellError(qmp.QMPError): +class QMPShellError(QMPError): """ QMP Shell Base error class. """ @@ -153,7 +158,7 @@ def visit_Name(cls, # pylint: disable=3Dinvalid-name return node =20 =20 -class QMPShell(qmp.QEMUMonitorProtocol): +class QMPShell(QEMUMonitorProtocol): """ QMPShell provides a basic readline-based QMP shell. =20 @@ -161,7 +166,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): :param pretty: Pretty-print QMP messages. :param verbose: Echo outgoing QMP messages to console. """ - def __init__(self, address: qmp.SocketAddrT, + def __init__(self, address: SocketAddrT, pretty: bool =3D False, verbose: bool =3D False): super().__init__(address) self._greeting: Optional[QMPMessage] =3D None @@ -237,7 +242,7 @@ def _parse_value(cls, val: str) -> object: =20 def _cli_expr(self, tokens: Sequence[str], - parent: qmp.QMPObject) -> None: + parent: QMPObject) -> None: for arg in tokens: (key, sep, val) =3D arg.partition('=3D') if sep !=3D '=3D': @@ -403,7 +408,7 @@ class HMPShell(QMPShell): :param pretty: Pretty-print QMP messages. :param verbose: Echo outgoing QMP messages to console. """ - def __init__(self, address: qmp.SocketAddrT, + def __init__(self, address: SocketAddrT, pretty: bool =3D False, verbose: bool =3D False): super().__init__(address, pretty, verbose) self._cpu_index =3D 0 @@ -512,19 +517,17 @@ def main() -> None: =20 try: address =3D shell_class.parse_address(args.qmp_server) - except qmp.QMPBadPortError: + except QMPBadPortError: parser.error(f"Bad port number: {args.qmp_server}") return # pycharm doesn't know error() is noreturn =20 with shell_class(address, args.pretty, args.verbose) as qemu: try: qemu.connect(negotiate=3Dnot args.skip_negotiation) - except qmp.QMPConnectError: - die("Didn't get QMP greeting message") - except qmp.QMPCapabilitiesError: - die("Couldn't negotiate capabilities") - except OSError as err: - die(f"Couldn't connect to {args.qmp_server}: {err!s}") + except ConnectError as err: + if isinstance(err.exc, OSError): + die(f"Couldn't connect to {args.qmp_server}: {err!s}") + die(str(err)) =20 for _ in qemu.repl(): pass --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858064353214.71003985518064; Mon, 10 Jan 2022 15:41:04 -0800 (PST) Received: from localhost ([::1]:34820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Hf-0008HG-DU for importer@patchew.org; Mon, 10 Jan 2022 18:41:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748v-0004dF-6u for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748t-0000JC-0P for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-169-HZfQtWElNrO2dV1aGvQuzg-1; Mon, 10 Jan 2022 18:31:52 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4D0C192CC43; Mon, 10 Jan 2022 23:31:50 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98EC37B028; Mon, 10 Jan 2022 23:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857513; 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=348TxO0ls7sbxVqdUXXnC5YO5XDFgK+tIxYGONmOcg8=; b=CidVwfsigmFCgQFiy1Jdbc/B5ZNVeW2slN4lharKE6QiISbhgdGgtQq4rGwDQFntC2xBxb t42/UG3rFIVg26J8LjMKodNoQmIl2lUvoJ01y0HDWcoj47veDOh9/qnPAVxsL24NSy+xb5 GWW9VIE/hUOrZlWwi+3r6mmrOYqrBxo= X-MC-Unique: HZfQtWElNrO2dV1aGvQuzg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 15/31] python: move qmp utilities to python/qemu/utils Date: Mon, 10 Jan 2022 18:28:54 -0500 Message-Id: <20220110232910.1923864-16-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858066833100001 Content-Type: text/plain; charset="utf-8" In order to upload a QMP package to PyPI, I want to remove any scripts that I am not 100% confident I want to support upstream, beyond our castle walls. Move most of our QMP utilities into the utils package so we can split them out from the PyPI upload. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/{qmp =3D> utils}/qemu_ga_client.py | 0 python/qemu/{qmp =3D> utils}/qom.py | 0 python/qemu/{qmp =3D> utils}/qom_common.py | 0 python/qemu/{qmp =3D> utils}/qom_fuse.py | 0 python/setup.cfg | 16 ++++++++-------- scripts/qmp/qemu-ga-client | 2 +- scripts/qmp/qom-fuse | 2 +- scripts/qmp/qom-get | 2 +- scripts/qmp/qom-list | 2 +- scripts/qmp/qom-set | 2 +- scripts/qmp/qom-tree | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) rename python/qemu/{qmp =3D> utils}/qemu_ga_client.py (100%) rename python/qemu/{qmp =3D> utils}/qom.py (100%) rename python/qemu/{qmp =3D> utils}/qom_common.py (100%) rename python/qemu/{qmp =3D> utils}/qom_fuse.py (100%) diff --git a/python/qemu/qmp/qemu_ga_client.py b/python/qemu/utils/qemu_ga_= client.py similarity index 100% rename from python/qemu/qmp/qemu_ga_client.py rename to python/qemu/utils/qemu_ga_client.py diff --git a/python/qemu/qmp/qom.py b/python/qemu/utils/qom.py similarity index 100% rename from python/qemu/qmp/qom.py rename to python/qemu/utils/qom.py diff --git a/python/qemu/qmp/qom_common.py b/python/qemu/utils/qom_common.py similarity index 100% rename from python/qemu/qmp/qom_common.py rename to python/qemu/utils/qom_common.py diff --git a/python/qemu/qmp/qom_fuse.py b/python/qemu/utils/qom_fuse.py similarity index 100% rename from python/qemu/qmp/qom_fuse.py rename to python/qemu/utils/qom_fuse.py diff --git a/python/setup.cfg b/python/setup.cfg index 417e937839..78421411d2 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -60,13 +60,13 @@ tui =3D =20 [options.entry_points] console_scripts =3D - qom =3D qemu.qmp.qom:main - qom-set =3D qemu.qmp.qom:QOMSet.entry_point - qom-get =3D qemu.qmp.qom:QOMGet.entry_point - qom-list =3D qemu.qmp.qom:QOMList.entry_point - qom-tree =3D qemu.qmp.qom:QOMTree.entry_point - qom-fuse =3D qemu.qmp.qom_fuse:QOMFuse.entry_point [fuse] - qemu-ga-client =3D qemu.qmp.qemu_ga_client:main + qom =3D qemu.utils.qom:main + qom-set =3D qemu.utils.qom:QOMSet.entry_point + qom-get =3D qemu.utils.qom:QOMGet.entry_point + qom-list =3D qemu.utils.qom:QOMList.entry_point + qom-tree =3D qemu.utils.qom:QOMTree.entry_point + qom-fuse =3D qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] + qemu-ga-client =3D qemu.utils.qemu_ga_client:main qmp-shell =3D qemu.qmp.qmp_shell:main aqmp-tui =3D qemu.aqmp.aqmp_tui:main [tui] =20 @@ -80,7 +80,7 @@ python_version =3D 3.6 warn_unused_configs =3D True namespace_packages =3D True =20 -[mypy-qemu.qmp.qom_fuse] +[mypy-qemu.utils.qom_fuse] # fusepy has no type stubs: allow_subclassing_any =3D True =20 diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client index 102fd2cad9..56edd0234a 100755 --- a/scripts/qmp/qemu-ga-client +++ b/scripts/qmp/qemu-ga-client @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp import qemu_ga_client +from qemu.utils import qemu_ga_client =20 =20 if __name__ =3D=3D '__main__': diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse index a58c8ef979..d453807b27 100755 --- a/scripts/qmp/qom-fuse +++ b/scripts/qmp/qom-fuse @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp.qom_fuse import QOMFuse +from qemu.utils.qom_fuse import QOMFuse =20 =20 if __name__ =3D=3D '__main__': diff --git a/scripts/qmp/qom-get b/scripts/qmp/qom-get index e4f3e0c013..04ebe052e8 100755 --- a/scripts/qmp/qom-get +++ b/scripts/qmp/qom-get @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp.qom import QOMGet +from qemu.utils.qom import QOMGet =20 =20 if __name__ =3D=3D '__main__': diff --git a/scripts/qmp/qom-list b/scripts/qmp/qom-list index 7a071a54e1..853b85a8d3 100755 --- a/scripts/qmp/qom-list +++ b/scripts/qmp/qom-list @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp.qom import QOMList +from qemu.utils.qom import QOMList =20 =20 if __name__ =3D=3D '__main__': diff --git a/scripts/qmp/qom-set b/scripts/qmp/qom-set index 9ca9e2ba10..06820feec4 100755 --- a/scripts/qmp/qom-set +++ b/scripts/qmp/qom-set @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp.qom import QOMSet +from qemu.utils.qom import QOMSet =20 =20 if __name__ =3D=3D '__main__': diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree index 7d0ccca3a4..760e172277 100755 --- a/scripts/qmp/qom-tree +++ b/scripts/qmp/qom-tree @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp.qom import QOMTree +from qemu.utils.qom import QOMTree =20 =20 if __name__ =3D=3D '__main__': --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164185829661164.79209926325916; Mon, 10 Jan 2022 15:44:56 -0800 (PST) Received: from localhost ([::1]:44376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74LP-00072o-Lh for importer@patchew.org; Mon, 10 Jan 2022 18:44:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748w-0004dw-Fs for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748t-0000Jf-Fk for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-RwqNj0e_PTavQOMyPpFURQ-1; Mon, 10 Jan 2022 18:31:53 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C02A192CC40; Mon, 10 Jan 2022 23:31:52 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id E624A7B028; Mon, 10 Jan 2022 23:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857516; 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=cPzbOhw7pxcTM4EH09AzBQnYI/L+iSIjq3Lzr2bqJ4U=; b=YxFdBuzW8pcsTu0jKT5QmpKSlVn7nqGA/10py1JE9wHyVL6sZWx7ZaPVDYOi/wlKHKU4lC z/+zW45yF3VYL38hfgiSGfbfPZuUPyzO8ErTdRV7rSWL08rqN3nwEj9NE0tTtpFNfna+r5 HHfg3H+ciewGgjJ320jxnPt+dz4SqNw= X-MC-Unique: RwqNj0e_PTavQOMyPpFURQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 16/31] python: move qmp-shell under the AQMP package Date: Mon, 10 Jan 2022 18:28:55 -0500 Message-Id: <20220110232910.1923864-17-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858297494100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/README.rst | 2 +- python/qemu/{qmp =3D> aqmp}/qmp_shell.py | 0 python/setup.cfg | 2 +- scripts/qmp/qmp-shell | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename python/qemu/{qmp =3D> aqmp}/qmp_shell.py (100%) diff --git a/python/README.rst b/python/README.rst index 9c1fceaee7..fcf74f69ea 100644 --- a/python/README.rst +++ b/python/README.rst @@ -59,7 +59,7 @@ Package installation also normally provides executable co= nsole scripts, so that tools like ``qmp-shell`` are always available via $PATH. To invoke them without installation, you can invoke e.g.: =20 -``> PYTHONPATH=3D~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` +``> PYTHONPATH=3D~/src/qemu/python python3 -m qemu.aqmp.qmp_shell`` =20 The mappings between console script name and python module path can be found in ``setup.cfg``. diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/aqmp/qmp_shell.py similarity index 100% rename from python/qemu/qmp/qmp_shell.py rename to python/qemu/aqmp/qmp_shell.py diff --git a/python/setup.cfg b/python/setup.cfg index 78421411d2..168a79c867 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -67,7 +67,7 @@ console_scripts =3D qom-tree =3D qemu.utils.qom:QOMTree.entry_point qom-fuse =3D qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] qemu-ga-client =3D qemu.utils.qemu_ga_client:main - qmp-shell =3D qemu.qmp.qmp_shell:main + qmp-shell =3D qemu.aqmp.qmp_shell:main aqmp-tui =3D qemu.aqmp.aqmp_tui:main [tui] =20 [flake8] diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index 4a20f97db7..31b19d73e2 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp import qmp_shell +from qemu.aqmp import qmp_shell =20 =20 if __name__ =3D=3D '__main__': --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858535329499.6780294468407; Mon, 10 Jan 2022 15:48:55 -0800 (PST) Received: from localhost ([::1]:56156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74PG-0006m8-1V for importer@patchew.org; Mon, 10 Jan 2022 18:48:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748w-0004dS-6Z for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748t-0000JZ-Fp for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:01 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-lST28q9JMwartoF4ILe1JQ-1; Mon, 10 Jan 2022 18:31:54 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 683A181CCB5; Mon, 10 Jan 2022 23:31:53 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D45C7B028; Mon, 10 Jan 2022 23:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857515; 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=MX7ikB8uLBgvVKrEtkj5AhEiOPdXvK486E9Sx99ZetA=; b=QGZB6Tinx9UEEM5/pMQi5ANO2zgag0HYsqCRhRuGGJDW4EFLQzaS9dboYL8iaTDSD80t1v VS8BcjC4zAYlJl902uPzkWvd1T24tI/dqzMxIvXp0b42Hm9M+NNQP8HvibQU9GeSypabla uVTM4Kc1VrkyxKZ7jdibolBTQ9R9xUw= X-MC-Unique: lST28q9JMwartoF4ILe1JQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 17/31] python/machine: permanently switch to AQMP Date: Mon, 10 Jan 2022 18:28:56 -0500 Message-Id: <20220110232910.1923864-18-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858536923100002 Content-Type: text/plain; charset="utf-8" Remove the QEMU_PYTHON_LEGACY_QMP environment variable, making the switch permanent. Update Exceptions and import paths as necessary. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/machine/machine.py | 18 +++++++----------- python/qemu/machine/qtest.py | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 67ab06ca2b..21fb4a4f30 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -40,21 +40,16 @@ TypeVar, ) =20 -from qemu.qmp import ( # pylint: disable=3Dimport-error +from qemu.aqmp import SocketAddrT +from qemu.aqmp.legacy import ( + QEMUMonitorProtocol, QMPMessage, QMPReturnValue, - SocketAddrT, ) =20 from . import console_socket =20 =20 -if os.environ.get('QEMU_PYTHON_LEGACY_QMP'): - from qemu.qmp import QEMUMonitorProtocol -else: - from qemu.aqmp.legacy import QEMUMonitorProtocol - - LOG =3D logging.getLogger(__name__) =20 =20 @@ -710,8 +705,9 @@ def events_wait(self, :param timeout: Optional timeout, in seconds. See QEMUMonitorProtocol.pull_event. =20 - :raise QMPTimeoutError: If timeout was non-zero and no matching ev= ents - were found. + :raise asyncio.TimeoutError: + If timeout was non-zero and no matching events were found. + :return: A QMP event matching the filter criteria. If timeout was 0 and no event matched, None. """ @@ -734,7 +730,7 @@ def _match(event: QMPMessage) -> bool: event =3D self._qmp.pull_event(wait=3Dtimeout) if event is None: # NB: None is only returned when timeout is false-ish. - # Timeouts raise QMPTimeoutError instead! + # Timeouts raise asyncio.TimeoutError instead! break if _match(event): return event diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py index f2f9aaa5e5..13e0aaff84 100644 --- a/python/qemu/machine/qtest.py +++ b/python/qemu/machine/qtest.py @@ -26,7 +26,7 @@ TextIO, ) =20 -from qemu.qmp import SocketAddrT # pylint: disable=3Dimport-error +from qemu.aqmp import SocketAddrT =20 from .machine import QEMUMachine =20 --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858536390978.8105022039625; Mon, 10 Jan 2022 15:48:56 -0800 (PST) Received: from localhost ([::1]:56280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74PH-0006qv-DS for importer@patchew.org; Mon, 10 Jan 2022 18:48:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748x-0004hn-Fh for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44156) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748u-0000Jv-4M for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:03 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-61-GkxM5MK5OsKBFpKDJFScrA-1; Mon, 10 Jan 2022 18:31:56 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F07E760C4; Mon, 10 Jan 2022 23:31:55 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89E987B035; Mon, 10 Jan 2022 23:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857517; 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=cN//P8Qy75ycCLA04A+FinwrhfJje8e0FQvGeIYqQC4=; b=DijAO5FcNfh9Rj2iQR9eBh26GwYrX7xR10YoLpzI1P1MxrBznvv6YbcwQGA13jISXaAPT7 Sew/FDA62Zg8ctgPZlRi1Dz9HSF3t2rm5YXpdx9Ur5oR0s27y0imeemdvcQzYzplCiAeDl I0jOMSDOc+v+Mm/wKV7UgLtusrQbLc8= X-MC-Unique: GkxM5MK5OsKBFpKDJFScrA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 18/31] scripts/cpu-x86-uarch-abi: fix CLI parsing Date: Mon, 10 Jan 2022 18:28:57 -0500 Message-Id: <20220110232910.1923864-19-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858536917100001 Signed-off-by: John Snow Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy --- scripts/cpu-x86-uarch-abi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index 08acc52a81..8963d90f0b 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @@ -9,7 +9,7 @@ from qemu import qmp import sys =20 -if len(sys.argv) !=3D 1: +if len(sys.argv) !=3D 2: print("syntax: %s QMP-SOCK\n\n" % __file__ + "Where QMP-SOCK points to a QEMU process such as\n\n" + " # qemu-system-x86_64 -qmp unix:/tmp/qmp,server,nowait " + @@ -66,7 +66,6 @@ =20 =20 sock =3D sys.argv[1] -cmd =3D sys.argv[2] shell =3D qmp.QEMUMonitorProtocol(sock) shell.connect() =20 --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858704341381.67884012016793; Mon, 10 Jan 2022 15:51:44 -0800 (PST) Received: from localhost ([::1]:39954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Rz-0006UJ-BA for importer@patchew.org; Mon, 10 Jan 2022 18:51:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7490-0004wF-MP for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n748z-0000LR-7K for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:06 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-PmYhmmOAMBCjhCjATbnj3A-1; Mon, 10 Jan 2022 18:32:03 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55021100F942; Mon, 10 Jan 2022 23:32:02 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 533BC7B028; Mon, 10 Jan 2022 23:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857524; 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=kTjHzyK3tz3oj/YoCnCRVjFWrdMTMj/5jHiMCQT2E4k=; b=hWWaJcauto7PxC03lqV5lCvJCJeRTLR2sTKk6w+QpeFmUEsy7pH36wSdiunH8n1vyQthze b9dyYnq2zmtNP98N0yLvwulzfwQT4FuCuOcrpzT0j1CzZ1nmj9bYjnAAgXr0aneTXyr7i5 l/LAPH0q0TlU8mLWQamasqbOm1ZZ370= X-MC-Unique: PmYhmmOAMBCjhCjATbnj3A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 19/31] scripts/cpu-x86-uarch-abi: switch to AQMP Date: Mon, 10 Jan 2022 18:28:58 -0500 Message-Id: <20220110232910.1923864-20-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858705833100001 Signed-off-by: John Snow Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- scripts/cpu-x86-uarch-abi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index 8963d90f0b..c262d2f027 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @@ -6,7 +6,7 @@ # compatibility levels for each CPU model. # =20 -from qemu import qmp +from qemu.aqmp.legacy import QEMUMonitorProtocol import sys =20 if len(sys.argv) !=3D 2: @@ -66,7 +66,7 @@ =20 =20 sock =3D sys.argv[1] -shell =3D qmp.QEMUMonitorProtocol(sock) +shell =3D QEMUMonitorProtocol(sock) shell.connect() =20 models =3D shell.cmd("query-cpu-definitions") --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858498249311.9106732885215; Mon, 10 Jan 2022 15:48:18 -0800 (PST) Received: from localhost ([::1]:53940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Oe-0005Fr-K1 for importer@patchew.org; Mon, 10 Jan 2022 18:48:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7493-000588-Ue for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46796) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7492-0000Lf-9t for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-310--76d4KCWPRS70zNL-NkUWw-1; Mon, 10 Jan 2022 18:32:04 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A77D1760C0; Mon, 10 Jan 2022 23:32:03 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 766397B9C5; Mon, 10 Jan 2022 23:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857527; 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=3h7Pre3cGGUGwbMYvY8wqDPzEp6Fq31kEZ81bE3ou6c=; b=IVD9SdNEu+1UuiSxEpBxqjadvRRXRUEnVAxPPRud2pc2PUH/PFab0xezpAJOd3CH0har/s lgfm47Jb4HZ7k+hxaRSheVvysrMa7TInQ6S02PWO+R4SZd7hmzqVrZQVqIQbyfba5wzvzH 56EVcf+myNpKDow/rZcUmUkaNXqWxxo= X-MC-Unique: -76d4KCWPRS70zNL-NkUWw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 20/31] scripts/render-block-graph: switch to AQMP Date: Mon, 10 Jan 2022 18:28:59 -0500 Message-Id: <20220110232910.1923864-21-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858499311100001 Content-Type: text/plain; charset="utf-8" Creating an instance of qemu.aqmp.ExecuteError is too involved here, so just drop the specificity down to a generic QMPError. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- scripts/render_block_graph.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/render_block_graph.py b/scripts/render_block_graph.py index da6acf050d..97778927f3 100755 --- a/scripts/render_block_graph.py +++ b/scripts/render_block_graph.py @@ -25,10 +25,8 @@ from graphviz import Digraph =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python')) -from qemu.qmp import ( - QEMUMonitorProtocol, - QMPResponseError, -) +from qemu.aqmp import QMPError +from qemu.aqmp.legacy import QEMUMonitorProtocol =20 =20 def perm(arr): @@ -105,7 +103,7 @@ def command(self, cmd): reply =3D json.loads(subprocess.check_output(ar)) =20 if 'error' in reply: - raise QMPResponseError(reply) + raise QMPError(reply) =20 return reply['return'] =20 --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858671595283.5495554079979; Mon, 10 Jan 2022 15:51:11 -0800 (PST) Received: from localhost ([::1]:37424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74RS-0004iT-Kf for importer@patchew.org; Mon, 10 Jan 2022 18:51:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7495-0005ED-Fl for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55131) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7493-0000Lx-Rl for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-XISWeSvtO_O3-k13CG2-cQ-1; Mon, 10 Jan 2022 18:32:06 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F220010247A6; Mon, 10 Jan 2022 23:32:04 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5CDA7B9C5; Mon, 10 Jan 2022 23:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857529; 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=92jSsZciLQfa3p5PNY0Hhu9AF3kkhve0TBJ4jn3eJ4M=; b=FxZVrf8JqAVNd4fWVbZ/PJgWmPekD74MP5qNdaxkIbAwhH9eWIJrkUM3GN/2VQKOQcR88c GhAS7HpaSliPpKtqrhp0W6X7p4IOtxZQx+zOjjqCuAa0mxkDrTn20p4iKgjOr3+PAHEkjY 3+aa9xCycK2fZviDocvBFD1s32P89rI= X-MC-Unique: XISWeSvtO_O3-k13CG2-cQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 21/31] scripts/bench-block-job: switch to AQMP Date: Mon, 10 Jan 2022 18:29:00 -0500 Message-Id: <20220110232910.1923864-22-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858672663100001 Content-Type: text/plain; charset="utf-8" For this commit, we only need to remove accommodations for the synchronous QMP library. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- scripts/simplebench/bench_block_job.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/b= ench_block_job.py index a403c35b08..af9d1646a4 100755 --- a/scripts/simplebench/bench_block_job.py +++ b/scripts/simplebench/bench_block_job.py @@ -27,7 +27,6 @@ =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) from qemu.machine import QEMUMachine -from qemu.qmp import QMPConnectError from qemu.aqmp import ConnectError =20 =20 @@ -50,7 +49,7 @@ def bench_block_job(cmd, cmd_args, qemu_args): vm.launch() except OSError as e: return {'error': 'popen failed: ' + str(e)} - except (QMPConnectError, ConnectError, socket.timeout): + except (ConnectError, socket.timeout): return {'error': 'qemu failed: ' + str(vm.get_log())} =20 try: --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858859016985.4414526796179; Mon, 10 Jan 2022 15:54:19 -0800 (PST) Received: from localhost ([::1]:45752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74UT-0001yh-R1 for importer@patchew.org; Mon, 10 Jan 2022 18:54:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749A-0005Uw-K2 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7498-0000MQ-Ru for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:16 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-493-9jA0_Vo9P3ehaVKryiYx2A-1; Mon, 10 Jan 2022 18:32:12 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4C7A10247A7; Mon, 10 Jan 2022 23:32:11 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 206ED7B9C6; Mon, 10 Jan 2022 23:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857534; 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=MZKUCxF+gcLpWqoCB88zDSSxE28Qrtc5Pc9kTOG/WZU=; b=Dfy2GGDzb+wR8MlVa6OP18zl10j6HnQAPpAUdyiBra1Tar5MQgQYoh9CULtSvoG+5OfwuM zsNLo+uTdVWW3aLutpWI/zJ9eCTCplg05KCpog5VjyQSPQYL1cmwAiSLfpiQKJS8qthbqv dYQh3bveS6HPuRsPlOihjJOtrGUtV58= X-MC-Unique: 9jA0_Vo9P3ehaVKryiYx2A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 22/31] iotests/mirror-top-perms: switch to AQMP Date: Mon, 10 Jan 2022 18:29:01 -0500 Message-Id: <20220110232910.1923864-23-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858861296100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- Note: I still need to adjust the logging. The problem now is that the logging messages include the PID of the test process, so they need to be filtered out. I'll investigate that for a follow-up. I could just add yet another filtering function somewhere, but I think it's getting out of hand with how many filters and loggers there are, so I want to give it a slightly more serious treatment instead of a hackjob. Signed-off-by: John Snow --- tests/qemu-iotests/tests/mirror-top-perms | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests= /tests/mirror-top-perms index 0a51a613f3..f394931a00 100755 --- a/tests/qemu-iotests/tests/mirror-top-perms +++ b/tests/qemu-iotests/tests/mirror-top-perms @@ -23,7 +23,6 @@ import os =20 from qemu.aqmp import ConnectError from qemu.machine import machine -from qemu.qmp import QMPConnectError =20 import iotests from iotests import change_log_level, qemu_img @@ -101,13 +100,13 @@ class TestMirrorTopPerms(iotests.QMPTestCase): self.vm_b.add_device('virtio-blk,drive=3Ddrive0,share-rw=3Don') try: # Silence AQMP errors temporarily. - # TODO: Remove this and just allow the errors to be logged when - # AQMP fully replaces QMP. + # TODO: Remove change_log_level and allow the errors to be log= ged. + # This necessitates a PID filter on *all* logging output. with change_log_level('qemu.aqmp'): self.vm_b.launch() print('ERROR: VM B launched successfully, ' 'this should not have happened') - except (QMPConnectError, ConnectError): + except ConnectError: assert 'Is another process using the image' in self.vm_b.get_l= og() =20 result =3D self.vm.qmp('block-job-cancel', --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641859188452593.7737372607584; Mon, 10 Jan 2022 15:59:48 -0800 (PST) Received: from localhost ([::1]:57678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Zl-0002gS-0M for importer@patchew.org; Mon, 10 Jan 2022 18:59:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749b-0005u4-5D for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749Q-0000Nu-QW for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:35 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-572-tWOvoUUKPMuJDye_GB9RRQ-1; Mon, 10 Jan 2022 18:32:24 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2928F192CC40; Mon, 10 Jan 2022 23:32:23 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id D76407B9C5; Mon, 10 Jan 2022 23:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857552; 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=1ZbXx0DMSG5+n5Usj99Ag9g43p0HtSVAkSo7Yl70EG8=; b=NnAWDqR/48zgplKITZfVlhE/nxKJ4kgYzScuawgD3iMtD/HrtG60XkJ8fI7z+j/+Gh0cbs xdGYbJT+6y1JooaUzLx5ZlG7gcALnj9k03Fsx9CJf0LMqpVDDwtjdxFcK0NtRF2k75sPwi 1hwm6Z/0Nkmo94K6kbEJ0jArX2ujRiY= X-MC-Unique: tWOvoUUKPMuJDye_GB9RRQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 23/31] iotests: switch to AQMP Date: Mon, 10 Jan 2022 18:29:02 -0500 Message-Id: <20220110232910.1923864-24-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641859190076100001 Content-Type: text/plain; charset="utf-8" Simply import the type defition from the new location. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- tests/qemu-iotests/iotests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 1e2f2391d1..98bc50cb3a 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -37,7 +37,7 @@ from contextlib import contextmanager =20 from qemu.machine import qtest -from qemu.qmp import QMPMessage +from qemu.aqmp.legacy import QMPMessage =20 # Use this logger for logging messages directly from the iotests module logger =3D logging.getLogger('qemu.iotests') --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858934704790.0122723133176; Mon, 10 Jan 2022 15:55:34 -0800 (PST) Received: from localhost ([::1]:48644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Vh-0003tR-M3 for importer@patchew.org; Mon, 10 Jan 2022 18:55:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749Q-0005rL-I8 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749N-0000NK-Dx for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:31 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-427-Iusic4VAPKm9xs4IROiU7g-1; Mon, 10 Jan 2022 18:32:26 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75EFE192CC41; Mon, 10 Jan 2022 23:32:24 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AF8B7B035; Mon, 10 Jan 2022 23:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857548; 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=pnDMGoDGVABbZcBbBYBilcaZqZMUkLoPFlb+NvCpVzQ=; b=a26M2KXQYCmpTevcfybSb+L/A2fHSN3+VMwVoMIovjPdD69jib4HltjGRiy1w4EqwKYFbW j5Ko2pzmBNNB/SigwcbUa+2xOm095SUp2zAfLs78kCds0I5Y7xNrfksajFtbUXRAmK17h7 F/2t22TqmzBcJ3b1KjfPTUybTT30nNk= X-MC-Unique: Iusic4VAPKm9xs4IROiU7g-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 24/31] python: temporarily silence pylint duplicate-code warnings Date: Mon, 10 Jan 2022 18:29:03 -0500 Message-Id: <20220110232910.1923864-25-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858935515100001 Content-Type: text/plain; charset="utf-8" The next several commits copy some code from qemu.qmp to qemu.aqmp, then delete qemu.qmp. In the interim, to prevent test failures, the duplicate code detection needs to be silenced to prevent bisect problems with CI testing. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/python/setup.cfg b/python/setup.cfg index 168a79c867..510df23698 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -115,6 +115,7 @@ ignore_missing_imports =3D True disable=3Dconsider-using-f-string, too-many-function-args, # mypy handles this with less false posit= ives. no-member, # mypy also handles this better. + duplicate-code, # To be removed by the end of this patch series. =20 [pylint.basic] # Good variable names which should always be accepted, separated by a comm= a. --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641859043753326.4467652355439; Mon, 10 Jan 2022 15:57:23 -0800 (PST) Received: from localhost ([::1]:54516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74XS-0008S7-OS for importer@patchew.org; Mon, 10 Jan 2022 18:57:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749Q-0005rW-Ib for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749O-0000NQ-FS for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:31 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-ABlNF1F6P6ek_D7b_l6ThA-1; Mon, 10 Jan 2022 18:32:27 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFEFB10247A9; Mon, 10 Jan 2022 23:32:25 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98BBC7B028; Mon, 10 Jan 2022 23:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857549; 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=2YKZp7bmHrc9Ohe2LnJeHZSiwih75U4coYschRudwuE=; b=QEsNqx93nJ32cQ6VM3kmuTK3pFDCul03BL7K9Ad2+vmcjJspd7P7aigckU2Eg7vD/SG4Ti khnp+IlpkZc7Knam7slWA3ydudNAZUb3ZslD/9VF/kLvsYoSLZDSeKYD3cufUDmqU9z1wE EFZaMF0ilDlI3Ih91VlL8KxkoG2MnU8= X-MC-Unique: ABlNF1F6P6ek_D7b_l6ThA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 25/31] python/aqmp: take QMPBadPortError and parse_address from qemu.qmp Date: Mon, 10 Jan 2022 18:29:04 -0500 Message-Id: <20220110232910.1923864-26-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641859044925100001 Content-Type: text/plain; charset="utf-8" Shift these definitions over from the qmp package to the async qmp package. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/aqmp/aqmp_tui.py | 3 +-- python/qemu/aqmp/legacy.py | 30 ++++++++++++++++++++++++++---- python/qemu/qmp/__init__.py | 26 -------------------------- 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/aqmp/aqmp_tui.py index f1e926dd75..184a3e4690 100644 --- a/python/qemu/aqmp/aqmp_tui.py +++ b/python/qemu/aqmp/aqmp_tui.py @@ -35,9 +35,8 @@ import urwid import urwid_readline =20 -from qemu.qmp import QEMUMonitorProtocol, QMPBadPortError - from .error import ProtocolError +from .legacy import QEMUMonitorProtocol, QMPBadPortError from .message import DeserializationError, Message, UnexpectedTypeError from .protocol import ConnectError, Runstate from .qmp_client import ExecInterruptedError, QMPClient diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 0890f95b16..76b09671cc 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -22,9 +22,6 @@ from .qmp_client import QMPClient =20 =20 -# (Temporarily) Re-export QMPBadPortError -QMPBadPortError =3D qemu.qmp.QMPBadPortError - #: QMPMessage is an entire QMP message of any kind. QMPMessage =3D Dict[str, Any] =20 @@ -45,6 +42,12 @@ # pylint: disable=3Dmissing-docstring =20 =20 +class QMPBadPortError(QMPError): + """ + Unable to parse socket address: Port was non-numerical. + """ + + class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): def __init__(self, address: SocketAddrT, server: bool =3D False, @@ -72,7 +75,26 @@ def _get_greeting(self) -> Optional[QMPMessage]: return None =20 # __enter__ and __exit__ need no changes - # parse_address needs no changes + + @classmethod + def parse_address(cls, address: str) -> SocketAddrT: + """ + Parse a string into a QMP address. + + Figure out if the argument is in the port:host form. + If it's not, it's probably a file path. + """ + components =3D address.split(':') + if len(components) =3D=3D 2: + try: + port =3D int(components[1]) + except ValueError: + msg =3D f"Bad port: '{components[1]}' in '{address}'." + raise QMPBadPortError(msg) from None + return (components[0], port) + + # Treat as filepath. + return address =20 def connect(self, negotiate: bool =3D True) -> Optional[QMPMessage]: self._aqmp.await_greeting =3D negotiate diff --git a/python/qemu/qmp/__init__.py b/python/qemu/qmp/__init__.py index 358c0971d0..4e08641154 100644 --- a/python/qemu/qmp/__init__.py +++ b/python/qemu/qmp/__init__.py @@ -102,12 +102,6 @@ def __init__(self, reply: QMPMessage): self.reply =3D reply =20 =20 -class QMPBadPortError(QMPError): - """ - Unable to parse socket address: Port was non-numerical. - """ - - class QEMUMonitorProtocol: """ Provide an API to connect to QEMU via QEMU Monitor Protocol (QMP) and = then @@ -237,26 +231,6 @@ def __exit__(self, # Implement context manager exit function. self.close() =20 - @classmethod - def parse_address(cls, address: str) -> SocketAddrT: - """ - Parse a string into a QMP address. - - Figure out if the argument is in the port:host form. - If it's not, it's probably a file path. - """ - components =3D address.split(':') - if len(components) =3D=3D 2: - try: - port =3D int(components[1]) - except ValueError: - msg =3D f"Bad port: '{components[1]}' in '{address}'." - raise QMPBadPortError(msg) from None - return (components[0], port) - - # Treat as filepath. - return address - def connect(self, negotiate: bool =3D True) -> Optional[QMPMessage]: """ Connect to the QMP Monitor and perform capabilities negotiation. --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641859012577482.96293425977296; Mon, 10 Jan 2022 15:56:52 -0800 (PST) Received: from localhost ([::1]:53260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Wx-0007M2-Aw for importer@patchew.org; Mon, 10 Jan 2022 18:56:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749b-0005u6-5D for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749Q-0000Nm-9x for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-i8gNzxekPiqNWVJp-aEnDw-1; Mon, 10 Jan 2022 18:32:28 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49C04192CC41; Mon, 10 Jan 2022 23:32:27 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C65D7B035; Mon, 10 Jan 2022 23:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857551; 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=BvJnSkuKelxwwkz6mxHaYFKgr6xeEh3QGZiP2CFIE0Y=; b=QH6vZ4nV7STPAG01jSqiBD6OEmW/AG+GSzQNpk++AlG7YBJXrlZbA1aofup/FWmOjX4Acf 85ayJfcTnNkySLOMBJWeG/wU/+blDPJqL01GZB+U5RSn4OA7QfkFa2ziUElissEud8qcjx tK0jFsq3CObBpEO1rwF8DCnf3oh5GYw= X-MC-Unique: i8gNzxekPiqNWVJp-aEnDw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 26/31] python/aqmp: fully separate from qmp.QEMUMonitorProtocol Date: Mon, 10 Jan 2022 18:29:05 -0500 Message-Id: <20220110232910.1923864-27-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641859014773100001 Content-Type: text/plain; charset="utf-8" After this patch, qemu.aqmp.legacy.QEMUMonitorProtocol no longer inherits from qemu.qmp.QEMUMonitorProtocol. To do this, several inherited methods need to be explicitly re-defined. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/aqmp/legacy.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 76b09671cc..8f38e7d912 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -5,18 +5,18 @@ """ =20 import asyncio +from types import TracebackType from typing import ( Any, Awaitable, Dict, List, Optional, + Type, TypeVar, Union, ) =20 -import qemu.qmp - from .error import QMPError from .protocol import Runstate, SocketAddrT from .qmp_client import QMPClient @@ -48,9 +48,9 @@ class QMPBadPortError(QMPError): """ =20 =20 -class QEMUMonitorProtocol(qemu.qmp.QEMUMonitorProtocol): +class QEMUMonitorProtocol: def __init__(self, address: SocketAddrT, - server: bool =3D False, + server: bool =3D False, # pylint: disable=3Dunused-argum= ent nickname: Optional[str] =3D None): =20 # pylint: disable=3Dsuper-init-not-called @@ -74,7 +74,18 @@ def _get_greeting(self) -> Optional[QMPMessage]: return self._aqmp.greeting._asdict() return None =20 - # __enter__ and __exit__ need no changes + def __enter__(self: _T) -> _T: + # Implement context manager enter function. + return self + + def __exit__(self, + # pylint: disable=3Dduplicate-code + # see https://github.com/PyCQA/pylint/issues/3619 + exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], + exc_tb: Optional[TracebackType]) -> None: + # Implement context manager exit function. + self.close() =20 @classmethod def parse_address(cls, address: str) -> SocketAddrT: @@ -131,7 +142,22 @@ def cmd_obj(self, qmp_cmd: QMPMessage) -> QMPMessage: ) ) =20 - # Default impl of cmd() delegates to cmd_obj + def cmd(self, name: str, + args: Optional[Dict[str, object]] =3D None, + cmd_id: Optional[object] =3D None) -> QMPMessage: + """ + Build a QMP command and send it to the QMP Monitor. + + @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: return self._sync( --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164185936975031.706733839699154; Mon, 10 Jan 2022 16:02:49 -0800 (PST) Received: from localhost ([::1]:35814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74ci-00074T-R1 for importer@patchew.org; Mon, 10 Jan 2022 19:02:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749h-0005xd-Ed for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55323) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749W-0000OF-4i for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-NWJgZSQlMweDd8CgbXqRsA-1; Mon, 10 Jan 2022 18:32:35 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B617110247A6; Mon, 10 Jan 2022 23:32:34 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EA1E7B028; Mon, 10 Jan 2022 23:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857557; 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=+YB3G6buKVEpGJESOta2fRjbI+7cwF7GLpghmhp5bXk=; b=AKJabIwZQX6mhCGSCaOZ5lFJhU8qe6JDQ78EtIKmkKLl9dAWxRfitS+5wtyfjXaZCGzJPT RRbb7z6w4kSqnNL00950tawRunTmC36bmkMQq/r/FV8EtDx++8mDH0vusthkhzGPY5IoSv sjrxf7dQjBdJzhpvcSSTTt0zDZPD6KA= X-MC-Unique: NWJgZSQlMweDd8CgbXqRsA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 27/31] python/aqmp: copy qmp docstrings to qemu.aqmp.legacy Date: Mon, 10 Jan 2022 18:29:06 -0500 Message-Id: <20220110232910.1923864-28-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641859370677100001 Content-Type: text/plain; charset="utf-8" Copy the docstrings out of qemu.qmp, adjusting them as necessary to more accurately reflect the current state of this class. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/qemu/aqmp/legacy.py | 110 ++++++++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/aqmp/legacy.py index 8f38e7d912..6c250cd46a 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/aqmp/legacy.py @@ -1,9 +1,23 @@ """ -Sync QMP Wrapper +(Legacy) Sync QMP Wrapper =20 -This class pretends to be qemu.qmp.QEMUMonitorProtocol. +This module provides the `QEMUMonitorProtocol` class, which is a +synchronous wrapper around `QMPClient`. + +Its design closely resembles that of the original QEMUMonitorProtocol +class, originally written by Luiz Capitulino. """ =20 +# Copyright (C) 2009, 2010, 2021 Red Hat Inc. +# +# Authors: +# Luiz Capitulino +# John Snow +# +# This work is licensed under the terms of the GNU GPL, version 2. +# See the COPYING file in the top-level directory. + + import asyncio from types import TracebackType from typing import ( @@ -39,9 +53,6 @@ # {} is the QMPReturnValue. =20 =20 -# pylint: disable=3Dmissing-docstring - - class QMPBadPortError(QMPError): """ Unable to parse socket address: Port was non-numerical. @@ -49,6 +60,21 @@ class QMPBadPortError(QMPError): =20 =20 class QEMUMonitorProtocol: + """ + Provide an API to connect to QEMU via QEMU Monitor Protocol (QMP) + and then allow to handle commands and events. + + :param address: QEMU address, can be either a unix socket path (strin= g) + or a tuple in the form ( address, port ) for a TCP + connection + :param server: Deprecated, ignored. (See 'accept') + :param nickname: Optional nickname used for logging. + + ..note:: + No connection is established during `__init__`, this is done by + the `connect()` or `accept()` methods. + """ + def __init__(self, address: SocketAddrT, server: bool =3D False, # pylint: disable=3Dunused-argum= ent nickname: Optional[str] =3D None): @@ -108,6 +134,12 @@ def parse_address(cls, address: str) -> SocketAddrT: return address =20 def connect(self, negotiate: bool =3D True) -> Optional[QMPMessage]: + """ + Connect to the QMP Monitor and perform capabilities negotiation. + + :return: QMP greeting dict, or None if negotiate is false + :raise ConnectError: on connection errors + """ self._aqmp.await_greeting =3D negotiate self._aqmp.negotiate =3D negotiate =20 @@ -117,6 +149,16 @@ def connect(self, negotiate: bool =3D True) -> Optiona= l[QMPMessage]: return self._get_greeting() =20 def accept(self, timeout: Optional[float] =3D 15.0) -> QMPMessage: + """ + Await connection from QMP Monitor and perform capabilities negotia= tion. + + :param timeout: + timeout in seconds (nonnegative float number, or None). + If None, there is no timeout, and this may block forever. + + :return: QMP greeting dict + :raise ConnectError: on connection errors + """ self._aqmp.await_greeting =3D True self._aqmp.negotiate =3D True =20 @@ -130,6 +172,12 @@ def accept(self, timeout: Optional[float] =3D 15.0) ->= QMPMessage: return ret =20 def cmd_obj(self, qmp_cmd: QMPMessage) -> QMPMessage: + """ + Send a QMP command to the QMP Monitor. + + :param qmp_cmd: QMP command to be sent as a Python dict + :return: QMP response as a Python dict + """ return dict( self._sync( # pylint: disable=3Dprotected-access @@ -148,9 +196,9 @@ def cmd(self, name: str, """ 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) + :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: @@ -160,6 +208,9 @@ def cmd(self, name: str, return self.cmd_obj(qmp_cmd) =20 def command(self, cmd: str, **kwds: object) -> QMPReturnValue: + """ + Build and send a QMP command to the monitor, report errors if any + """ return self._sync( self._aqmp.execute(cmd, kwds), self._timeout @@ -167,6 +218,19 @@ def command(self, cmd: str, **kwds: object) -> QMPRetu= rnValue: =20 def pull_event(self, wait: Union[bool, float] =3D False) -> Optional[QMPMess= age]: + """ + Pulls a single event. + + :param wait: + If False or 0, do not wait. Return None if no events ready. + If True, wait forever until the next event. + Otherwise, wait for the specified number of seconds. + + :raise asyncio.TimeoutError: + When a timeout is requested and the timeout period elapses. + + :return: The first available QMP event, or None. + """ if not wait: # wait is False/0: "do not wait, do not except." if self._aqmp.events.empty(): @@ -187,6 +251,20 @@ def pull_event(self, ) =20 def get_events(self, wait: Union[bool, float] =3D False) -> List[QMPMe= ssage]: + """ + Get a list of QMP events and clear all pending events. + + :param wait: + If False or 0, do not wait. Return None if no events ready. + If True, wait until we have at least one event. + Otherwise, wait for up to the specified number of seconds for = at + least one event. + + :raise asyncio.TimeoutError: + When a timeout is requested and the timeout period elapses. + + :return: A list of QMP events. + """ events =3D [dict(x) for x in self._aqmp.events.clear()] if events: return events @@ -195,17 +273,33 @@ def get_events(self, wait: Union[bool, float] =3D Fal= se) -> List[QMPMessage]: return [event] if event is not None else [] =20 def clear_events(self) -> None: + """Clear current list of pending events.""" self._aqmp.events.clear() =20 def close(self) -> None: + """Close the connection.""" self._sync( self._aqmp.disconnect() ) =20 def settimeout(self, timeout: Optional[float]) -> None: + """ + Set the timeout for QMP RPC execution. + + This timeout affects the `cmd`, `cmd_obj`, and `command` methods. + The `accept`, `pull_event` and `get_event` methods have their + own configurable timeouts. + + :param timeout: + timeout in seconds, or None. + None will wait indefinitely. + """ self._timeout =3D timeout =20 def send_fd_scm(self, fd: int) -> None: + """ + Send a file descriptor to the remote via SCM_RIGHTS. + """ self._aqmp.send_fd_scm(fd) =20 def __del__(self) -> None: --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641859574832105.13499340158353; Mon, 10 Jan 2022 16:06:14 -0800 (PST) Received: from localhost ([::1]:38974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74g1-0000mq-Bz for importer@patchew.org; Mon, 10 Jan 2022 19:06:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749k-000605-Qg for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749h-0000On-6M for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16-COzteV7oNzuPVLY0yQmcgQ-1; Mon, 10 Jan 2022 18:32:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 188002F25; Mon, 10 Jan 2022 23:32:42 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id D89677B028; Mon, 10 Jan 2022 23:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857566; 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=QGDrZYHeLMVa5KflIETsGhw2IQrNw+pesxzDgff763c=; b=F4Ai7p2O8cK57b1LWwaBebe2AC4aVHdPr8597pY+knhZjqqgA7SM9BITvr9+OMAYN6A1iv zkS0OSvilLJuuRI7xZbzVeGIyFgC2LteiUc6rlPKKycWJjLeJ7wf9Q53eza9Gb5/85NjKG FW6CeLdZSa8x9OXDvDP2SoP82jiZwH8= X-MC-Unique: COzteV7oNzuPVLY0yQmcgQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 28/31] python: remove the old QMP package Date: Mon, 10 Jan 2022 18:29:07 -0500 Message-Id: <20220110232910.1923864-29-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641859576256100001 Content-Type: text/plain; charset="utf-8" Thank you for your service! Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/PACKAGE.rst | 4 +- python/README.rst | 2 +- python/qemu/qmp/README.rst | 9 - python/qemu/qmp/__init__.py | 396 ------------------------------------ python/qemu/qmp/py.typed | 0 python/setup.cfg | 3 +- 6 files changed, 4 insertions(+), 410 deletions(-) delete mode 100644 python/qemu/qmp/README.rst delete mode 100644 python/qemu/qmp/__init__.py delete mode 100644 python/qemu/qmp/py.typed diff --git a/python/PACKAGE.rst b/python/PACKAGE.rst index b0b86cc4c3..ddfa9ba3f5 100644 --- a/python/PACKAGE.rst +++ b/python/PACKAGE.rst @@ -8,11 +8,11 @@ to change at any time. Usage ----- =20 -The ``qemu.qmp`` subpackage provides a library for communicating with +The ``qemu.aqmp`` subpackage provides a library for communicating with QMP servers. The ``qemu.machine`` subpackage offers rudimentary facilities for launching and managing QEMU processes. Refer to each package's documentation -(``>>> help(qemu.qmp)``, ``>>> help(qemu.machine)``) +(``>>> help(qemu.aqmp)``, ``>>> help(qemu.machine)``) for more information. =20 Contributing diff --git a/python/README.rst b/python/README.rst index fcf74f69ea..eb5213337d 100644 --- a/python/README.rst +++ b/python/README.rst @@ -3,7 +3,7 @@ QEMU Python Tooling =20 This directory houses Python tooling used by the QEMU project to build, configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). +then by package (e.g. ``qemu/machine``, ``qemu/aqmp``, etc). =20 ``setup.py`` is used by ``pip`` to install this tooling to the current environment. ``setup.cfg`` provides the packaging configuration used by diff --git a/python/qemu/qmp/README.rst b/python/qemu/qmp/README.rst deleted file mode 100644 index 5bfb82535f..0000000000 --- a/python/qemu/qmp/README.rst +++ /dev/null @@ -1,9 +0,0 @@ -qemu.qmp package -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -This package provides a library used for connecting to and communicating -with QMP servers. It is used extensively by iotests, vm tests, -avocado tests, and other utilities in the ./scripts directory. It is -not a fully-fledged SDK and is subject to change at any time. - -See the documentation in ``__init__.py`` for more information. diff --git a/python/qemu/qmp/__init__.py b/python/qemu/qmp/__init__.py deleted file mode 100644 index 4e08641154..0000000000 --- a/python/qemu/qmp/__init__.py +++ /dev/null @@ -1,396 +0,0 @@ -""" -QEMU Monitor Protocol (QMP) development library & tooling. - -This package provides a fairly low-level class for communicating to QMP -protocol servers, as implemented by QEMU, the QEMU Guest Agent, and the -QEMU Storage Daemon. This library is not intended for production use. - -`QEMUMonitorProtocol` is the primary class of interest, and all errors -raised derive from `QMPError`. -""" - -# Copyright (C) 2009, 2010 Red Hat Inc. -# -# Authors: -# Luiz Capitulino -# -# This work is licensed under the terms of the GNU GPL, version 2. See -# the COPYING file in the top-level directory. - -import errno -import json -import logging -import socket -import struct -from types import TracebackType -from typing import ( - Any, - Dict, - List, - Optional, - TextIO, - Tuple, - Type, - TypeVar, - Union, - cast, -) - - -#: QMPMessage is an entire QMP message of any kind. -QMPMessage =3D Dict[str, Any] - -#: QMPReturnValue is the 'return' value of a command. -QMPReturnValue =3D object - -#: QMPObject is any object in a QMP message. -QMPObject =3D Dict[str, object] - -# QMPMessage can be outgoing commands or incoming events/returns. -# QMPReturnValue is usually a dict/json object, but due to QAPI's -# 'returns-whitelist', it can actually be anything. -# -# {'return': {}} is a QMPMessage, -# {} is the QMPReturnValue. - - -InternetAddrT =3D Tuple[str, int] -UnixAddrT =3D str -SocketAddrT =3D Union[InternetAddrT, UnixAddrT] - - -class QMPError(Exception): - """ - QMP base exception - """ - - -class QMPConnectError(QMPError): - """ - QMP connection exception - """ - - -class QMPCapabilitiesError(QMPError): - """ - QMP negotiate capabilities exception - """ - - -class QMPTimeoutError(QMPError): - """ - QMP timeout exception - """ - - -class QMPProtocolError(QMPError): - """ - QMP protocol error; unexpected response - """ - - -class QMPResponseError(QMPError): - """ - Represents erroneous QMP monitor reply - """ - def __init__(self, reply: QMPMessage): - try: - desc =3D reply['error']['desc'] - except KeyError: - desc =3D reply - super().__init__(desc) - self.reply =3D reply - - -class QEMUMonitorProtocol: - """ - Provide an API to connect to QEMU via QEMU Monitor Protocol (QMP) and = then - allow to handle commands and events. - """ - - #: Logger object for debugging messages - logger =3D logging.getLogger('QMP') - - def __init__(self, address: SocketAddrT, - server: bool =3D False, - nickname: Optional[str] =3D None): - """ - Create a QEMUMonitorProtocol class. - - @param address: QEMU address, can be either a unix socket path (st= ring) - or a tuple in the form ( address, port ) for a TCP - connection - @param server: server mode listens on the socket (bool) - @raise OSError on socket connection errors - @note No connection is established, this is done by the connect() = or - accept() methods - """ - self.__events: List[QMPMessage] =3D [] - self.__address =3D address - self.__sock =3D self.__get_sock() - self.__sockfile: Optional[TextIO] =3D None - self._nickname =3D nickname - if self._nickname: - self.logger =3D logging.getLogger('QMP').getChild(self._nickna= me) - if server: - self.__sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,= 1) - self.__sock.bind(self.__address) - self.__sock.listen(1) - - def __get_sock(self) -> socket.socket: - if isinstance(self.__address, tuple): - family =3D socket.AF_INET - else: - family =3D socket.AF_UNIX - return socket.socket(family, socket.SOCK_STREAM) - - def __negotiate_capabilities(self) -> QMPMessage: - greeting =3D self.__json_read() - if greeting is None or "QMP" not in greeting: - raise QMPConnectError - # Greeting seems ok, negotiate capabilities - resp =3D self.cmd('qmp_capabilities') - if resp and "return" in resp: - return greeting - raise QMPCapabilitiesError - - def __json_read(self, only_event: bool =3D False) -> Optional[QMPMessa= ge]: - assert self.__sockfile is not None - while True: - data =3D self.__sockfile.readline() - if not data: - return None - # By definition, any JSON received from QMP is a QMPMessage, - # and we are asserting only at static analysis time that it - # has a particular shape. - resp: QMPMessage =3D json.loads(data) - if 'event' in resp: - self.logger.debug("<<< %s", resp) - self.__events.append(resp) - if not only_event: - continue - return resp - - def __get_events(self, wait: Union[bool, float] =3D False) -> None: - """ - Check for new events in the stream and cache them in __events. - - @param wait (bool): block until an event is available. - @param wait (float): If wait is a float, treat it as a timeout val= ue. - - @raise QMPTimeoutError: If a timeout float is provided and the tim= eout - period elapses. - @raise QMPConnectError: If wait is True but no events could be - retrieved or if some other error occurred. - """ - - # Current timeout and blocking status - current_timeout =3D self.__sock.gettimeout() - - # Check for new events regardless and pull them into the cache: - self.__sock.settimeout(0) # i.e. setblocking(False) - try: - self.__json_read() - except OSError as err: - # EAGAIN: No data available; not critical - if err.errno !=3D errno.EAGAIN: - raise - finally: - self.__sock.settimeout(current_timeout) - - # Wait for new events, if needed. - # if wait is 0.0, this means "no wait" and is also implicitly fals= e. - if not self.__events and wait: - if isinstance(wait, float): - self.__sock.settimeout(wait) - try: - ret =3D self.__json_read(only_event=3DTrue) - except socket.timeout as err: - raise QMPTimeoutError("Timeout waiting for event") from err - except Exception as err: - msg =3D "Error while reading from socket" - raise QMPConnectError(msg) from err - finally: - self.__sock.settimeout(current_timeout) - - if ret is None: - raise QMPConnectError("Error while reading from socket") - - T =3D TypeVar('T') - - def __enter__(self: T) -> T: - # Implement context manager enter function. - return self - - def __exit__(self, - # pylint: disable=3Dduplicate-code - # see https://github.com/PyCQA/pylint/issues/3619 - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> None: - # Implement context manager exit function. - self.close() - - def connect(self, negotiate: bool =3D True) -> Optional[QMPMessage]: - """ - Connect to the QMP Monitor and perform capabilities negotiation. - - @return QMP greeting dict, or None if negotiate is false - @raise OSError on socket connection errors - @raise QMPConnectError if the greeting is not received - @raise QMPCapabilitiesError if fails to negotiate capabilities - """ - self.__sock.connect(self.__address) - self.__sockfile =3D self.__sock.makefile(mode=3D'r') - if negotiate: - return self.__negotiate_capabilities() - return None - - def accept(self, timeout: Optional[float] =3D 15.0) -> QMPMessage: - """ - Await connection from QMP Monitor and perform capabilities negotia= tion. - - @param timeout: timeout in seconds (nonnegative float number, or - None). The value passed will set the behavior of t= he - underneath QMP socket as described in [1]. - Default value is set to 15.0. - - @return QMP greeting dict - @raise OSError on socket connection errors - @raise QMPConnectError if the greeting is not received - @raise QMPCapabilitiesError if fails to negotiate capabilities - - [1] - https://docs.python.org/3/library/socket.html#socket.socket.settim= eout - """ - self.__sock.settimeout(timeout) - self.__sock, _ =3D self.__sock.accept() - self.__sockfile =3D self.__sock.makefile(mode=3D'r') - return self.__negotiate_capabilities() - - def cmd_obj(self, qmp_cmd: QMPMessage) -> QMPMessage: - """ - Send a QMP command to the QMP Monitor. - - @param qmp_cmd: QMP command to be sent as a Python dict - @return QMP response as a Python dict - """ - self.logger.debug(">>> %s", qmp_cmd) - self.__sock.sendall(json.dumps(qmp_cmd).encode('utf-8')) - resp =3D self.__json_read() - if resp is None: - raise QMPConnectError("Unexpected empty reply from server") - self.logger.debug("<<< %s", resp) - return resp - - def cmd(self, name: str, - args: Optional[Dict[str, object]] =3D None, - cmd_id: Optional[object] =3D None) -> QMPMessage: - """ - Build a QMP command and send it to the QMP Monitor. - - @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) - - def command(self, cmd: str, **kwds: object) -> QMPReturnValue: - """ - Build and send a QMP command to the monitor, report errors if any - """ - ret =3D self.cmd(cmd, kwds) - if 'error' in ret: - raise QMPResponseError(ret) - if 'return' not in ret: - raise QMPProtocolError( - "'return' key not found in QMP response '{}'".format(str(r= et)) - ) - return cast(QMPReturnValue, ret['return']) - - def pull_event(self, - wait: Union[bool, float] =3D False) -> Optional[QMPMess= age]: - """ - Pulls a single event. - - @param wait (bool): block until an event is available. - @param wait (float): If wait is a float, treat it as a timeout val= ue. - - @raise QMPTimeoutError: If a timeout float is provided and the tim= eout - period elapses. - @raise QMPConnectError: If wait is True but no events could be - retrieved or if some other error occurred. - - @return The first available QMP event, or None. - """ - self.__get_events(wait) - - if self.__events: - return self.__events.pop(0) - return None - - def get_events(self, wait: bool =3D False) -> List[QMPMessage]: - """ - Get a list of available QMP events and clear all pending events. - - @param wait (bool): block until an event is available. - @param wait (float): If wait is a float, treat it as a timeout val= ue. - - @raise QMPTimeoutError: If a timeout float is provided and the tim= eout - period elapses. - @raise QMPConnectError: If wait is True but no events could be - retrieved or if some other error occurred. - - @return The list of available QMP events. - """ - self.__get_events(wait) - events =3D self.__events - self.__events =3D [] - return events - - def clear_events(self) -> None: - """ - Clear current list of pending events. - """ - self.__events =3D [] - - def close(self) -> None: - """ - Close the socket and socket file. - """ - if self.__sock: - self.__sock.close() - if self.__sockfile: - self.__sockfile.close() - - def settimeout(self, timeout: Optional[float]) -> None: - """ - Set the socket timeout. - - @param timeout (float): timeout in seconds (non-zero), or None. - @note This is a wrap around socket.settimeout - - @raise ValueError: if timeout was set to 0. - """ - if timeout =3D=3D 0: - msg =3D "timeout cannot be 0; this engages non-blocking mode." - msg +=3D " Use 'None' instead to disable timeouts." - raise ValueError(msg) - self.__sock.settimeout(timeout) - - def send_fd_scm(self, fd: int) -> None: - """ - Send a file descriptor to the remote via SCM_RIGHTS. - """ - if self.__sock.family !=3D socket.AF_UNIX: - raise RuntimeError("Can't use SCM_RIGHTS on non-AF_UNIX socket= .") - - self.__sock.sendmsg( - [b' '], - [(socket.SOL_SOCKET, socket.SCM_RIGHTS, struct.pack('@i', fd))] - ) diff --git a/python/qemu/qmp/py.typed b/python/qemu/qmp/py.typed deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/python/setup.cfg b/python/setup.cfg index 510df23698..5140a5b322 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -24,10 +24,9 @@ classifiers =3D [options] python_requires =3D >=3D 3.6 packages =3D - qemu.qmp + qemu.aqmp qemu.machine qemu.utils - qemu.aqmp =20 [options.package_data] * =3D py.typed --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858686434104.90818579366851; Mon, 10 Jan 2022 15:51:26 -0800 (PST) Received: from localhost ([::1]:38982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74Rh-0005ls-EI for importer@patchew.org; Mon, 10 Jan 2022 18:51:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749k-000600-Bu for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749h-0000Oh-6O for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-393-OcJoYrM8MAW1BBtft2tS5Q-1; Mon, 10 Jan 2022 18:32:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6CCC0100F943; Mon, 10 Jan 2022 23:32:43 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A0087B9C5; Mon, 10 Jan 2022 23:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857565; 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=s4HXzH8pT/Z6vivO5G2h3oqSccwKi1/+gJHg4jYO1UA=; b=LFnDyA6N4R/7uWa31HYFpHHA4alpKpdZEYvzW4pgFwNnxqTe2x81yDmJErO1g7+AQoBg2K yn5RlBvU5i/kM8Bbs/CP19yfmKG/6gph1Pbra6drfBv1lLqSYDNSGNLH7tc8hFVkhzLAys QebhEGiTXTPcpCQM7dkcTg6rT/mctQ8= X-MC-Unique: OcJoYrM8MAW1BBtft2tS5Q-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 29/31] python: re-enable pylint duplicate-code warnings Date: Mon, 10 Jan 2022 18:29:08 -0500 Message-Id: <20220110232910.1923864-30-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858687944100001 Content-Type: text/plain; charset="utf-8" With the old library gone, there's nothing duplicated in the tree, so the warning suppression can be removed. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Beraldo Leal --- python/setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/python/setup.cfg b/python/setup.cfg index 5140a5b322..c341e922c2 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -114,7 +114,6 @@ ignore_missing_imports =3D True disable=3Dconsider-using-f-string, too-many-function-args, # mypy handles this with less false posit= ives. no-member, # mypy also handles this better. - duplicate-code, # To be removed by the end of this patch series. =20 [pylint.basic] # Good variable names which should always be accepted, separated by a comm= a. --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641859338054463.90912413013757; Mon, 10 Jan 2022 16:02:18 -0800 (PST) Received: from localhost ([::1]:33924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74cD-0005mS-2E for importer@patchew.org; Mon, 10 Jan 2022 19:02:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749l-000609-Bo for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749h-0000PH-6p for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-N3Gwlc9GN5O3Fn5OC1WzHQ-1; Mon, 10 Jan 2022 18:32:45 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D017210247A6; Mon, 10 Jan 2022 23:32:44 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EEC47B028; Mon, 10 Jan 2022 23:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857568; 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=tDTWqqVAht6iCgFAq2Rinkz4PD4t8NDbsyleAUCDFtQ=; b=QBSB8vxZ6biFDWItRiHqq4rs8blyXGRwoomshQSTtSXNbosAMDUhFYMx8L+jhMwm0YHQ+9 aoXbBn94ZEafHNRlDOsOqzGlD+uc4gmeqER88tjOfzCXCYP742jw1YlZAskSkXKJAcEe6L luBC4W+1pFrSaQmZpdbf4YyY0ld0C/A= X-MC-Unique: N3Gwlc9GN5O3Fn5OC1WzHQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 30/31] python: rename qemu.aqmp to qemu.qmp Date: Mon, 10 Jan 2022 18:29:09 -0500 Message-Id: <20220110232910.1923864-31-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641859339585100001 Content-Type: text/plain; charset="utf-8" Now that we are fully switched over to the new QMP library, move it back over the old namespace. This is being done primarily so that we may upload this package simply as "qemu.qmp" without introducing confusion over whether or not "aqmp" is a new protocol or not. The trade-off is increased confusion inside the QEMU developer tree. Sorry! Note: the 'private' member "_aqmp" in legacy.py also changes to "_qmp"; not out of necessity, but just to remove any traces of the "aqmp" name. Signed-off-by: John Snow Reviewed-by: Beraldo Leal --- python/PACKAGE.rst | 4 +-- python/README.rst | 4 +-- python/qemu/machine/machine.py | 4 +-- python/qemu/machine/qtest.py | 2 +- python/qemu/{aqmp =3D> qmp}/__init__.py | 6 ++-- python/qemu/{aqmp =3D> qmp}/aqmp_tui.py | 0 python/qemu/{aqmp =3D> qmp}/error.py | 0 python/qemu/{aqmp =3D> qmp}/events.py | 2 +- python/qemu/{aqmp =3D> qmp}/legacy.py | 36 +++++++++++------------ python/qemu/{aqmp =3D> qmp}/message.py | 0 python/qemu/{aqmp =3D> qmp}/models.py | 0 python/qemu/{aqmp =3D> qmp}/protocol.py | 4 +-- python/qemu/{aqmp =3D> qmp}/py.typed | 0 python/qemu/{aqmp =3D> qmp}/qmp_client.py | 16 +++++----- python/qemu/{aqmp =3D> qmp}/qmp_shell.py | 4 +-- python/qemu/{aqmp =3D> qmp}/util.py | 0 python/qemu/utils/qemu_ga_client.py | 4 +-- python/qemu/utils/qom.py | 2 +- python/qemu/utils/qom_common.py | 4 +-- python/qemu/utils/qom_fuse.py | 2 +- python/setup.cfg | 8 ++--- python/tests/protocol.py | 14 ++++----- scripts/cpu-x86-uarch-abi.py | 2 +- scripts/device-crash-test | 4 +-- scripts/qmp/qmp-shell | 2 +- scripts/render_block_graph.py | 4 +-- scripts/simplebench/bench_block_job.py | 2 +- tests/qemu-iotests/iotests.py | 2 +- tests/qemu-iotests/tests/mirror-top-perms | 6 ++-- 29 files changed, 69 insertions(+), 69 deletions(-) rename python/qemu/{aqmp =3D> qmp}/__init__.py (87%) rename python/qemu/{aqmp =3D> qmp}/aqmp_tui.py (100%) rename python/qemu/{aqmp =3D> qmp}/error.py (100%) rename python/qemu/{aqmp =3D> qmp}/events.py (99%) rename python/qemu/{aqmp =3D> qmp}/legacy.py (92%) rename python/qemu/{aqmp =3D> qmp}/message.py (100%) rename python/qemu/{aqmp =3D> qmp}/models.py (100%) rename python/qemu/{aqmp =3D> qmp}/protocol.py (99%) rename python/qemu/{aqmp =3D> qmp}/py.typed (100%) rename python/qemu/{aqmp =3D> qmp}/qmp_client.py (97%) rename python/qemu/{aqmp =3D> qmp}/qmp_shell.py (99%) rename python/qemu/{aqmp =3D> qmp}/util.py (100%) diff --git a/python/PACKAGE.rst b/python/PACKAGE.rst index ddfa9ba3f5..b0b86cc4c3 100644 --- a/python/PACKAGE.rst +++ b/python/PACKAGE.rst @@ -8,11 +8,11 @@ to change at any time. Usage ----- =20 -The ``qemu.aqmp`` subpackage provides a library for communicating with +The ``qemu.qmp`` subpackage provides a library for communicating with QMP servers. The ``qemu.machine`` subpackage offers rudimentary facilities for launching and managing QEMU processes. Refer to each package's documentation -(``>>> help(qemu.aqmp)``, ``>>> help(qemu.machine)``) +(``>>> help(qemu.qmp)``, ``>>> help(qemu.machine)``) for more information. =20 Contributing diff --git a/python/README.rst b/python/README.rst index eb5213337d..9c1fceaee7 100644 --- a/python/README.rst +++ b/python/README.rst @@ -3,7 +3,7 @@ QEMU Python Tooling =20 This directory houses Python tooling used by the QEMU project to build, configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/aqmp``, etc). +then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). =20 ``setup.py`` is used by ``pip`` to install this tooling to the current environment. ``setup.cfg`` provides the packaging configuration used by @@ -59,7 +59,7 @@ Package installation also normally provides executable co= nsole scripts, so that tools like ``qmp-shell`` are always available via $PATH. To invoke them without installation, you can invoke e.g.: =20 -``> PYTHONPATH=3D~/src/qemu/python python3 -m qemu.aqmp.qmp_shell`` +``> PYTHONPATH=3D~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` =20 The mappings between console script name and python module path can be found in ``setup.cfg``. diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 21fb4a4f30..6e4bf6520c 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -40,8 +40,8 @@ TypeVar, ) =20 -from qemu.aqmp import SocketAddrT -from qemu.aqmp.legacy import ( +from qemu.qmp import SocketAddrT +from qemu.qmp.legacy import ( QEMUMonitorProtocol, QMPMessage, QMPReturnValue, diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py index 13e0aaff84..1a1fc6c9b0 100644 --- a/python/qemu/machine/qtest.py +++ b/python/qemu/machine/qtest.py @@ -26,7 +26,7 @@ TextIO, ) =20 -from qemu.aqmp import SocketAddrT +from qemu.qmp import SocketAddrT =20 from .machine import QEMUMachine =20 diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/qmp/__init__.py similarity index 87% rename from python/qemu/aqmp/__init__.py rename to python/qemu/qmp/__init__.py index 4c22c38079..a19868b13d 100644 --- a/python/qemu/aqmp/__init__.py +++ b/python/qemu/qmp/__init__.py @@ -6,8 +6,8 @@ QEMU Guest Agent, and the QEMU Storage Daemon. =20 `QMPClient` provides the main functionality of this package. All errors -raised by this library derive from `QMPError`, see `aqmp.error` for -additional detail. See `aqmp.events` for an in-depth tutorial on +raised by this library derive from `QMPError`, see `qmp.error` for +additional detail. See `qmp.events` for an in-depth tutorial on managing QMP events. """ =20 @@ -36,7 +36,7 @@ =20 =20 # Suppress logging unless an application engages it. -logging.getLogger('qemu.aqmp').addHandler(logging.NullHandler()) +logging.getLogger('qemu.qmp').addHandler(logging.NullHandler()) =20 =20 # The order of these fields impact the Sphinx documentation order. diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/qmp/aqmp_tui.py similarity index 100% rename from python/qemu/aqmp/aqmp_tui.py rename to python/qemu/qmp/aqmp_tui.py diff --git a/python/qemu/aqmp/error.py b/python/qemu/qmp/error.py similarity index 100% rename from python/qemu/aqmp/error.py rename to python/qemu/qmp/error.py diff --git a/python/qemu/aqmp/events.py b/python/qemu/qmp/events.py similarity index 99% rename from python/qemu/aqmp/events.py rename to python/qemu/qmp/events.py index f3d4e2b5e8..6199776cc6 100644 --- a/python/qemu/aqmp/events.py +++ b/python/qemu/qmp/events.py @@ -1,5 +1,5 @@ """ -AQMP Events and EventListeners +QMP Events and EventListeners =20 Asynchronous QMP uses `EventListener` objects to listen for events. An `EventListener` is a FIFO event queue that can be pre-filtered to listen diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/qmp/legacy.py similarity index 92% rename from python/qemu/aqmp/legacy.py rename to python/qemu/qmp/legacy.py index 6c250cd46a..1c03c8b22e 100644 --- a/python/qemu/aqmp/legacy.py +++ b/python/qemu/qmp/legacy.py @@ -80,7 +80,7 @@ def __init__(self, address: SocketAddrT, nickname: Optional[str] =3D None): =20 # pylint: disable=3Dsuper-init-not-called - self._aqmp =3D QMPClient(nickname) + self._qmp =3D QMPClient(nickname) self._aloop =3D asyncio.get_event_loop() self._address =3D address self._timeout: Optional[float] =3D None @@ -95,9 +95,9 @@ def _sync( ) =20 def _get_greeting(self) -> Optional[QMPMessage]: - if self._aqmp.greeting is not None: + if self._qmp.greeting is not None: # pylint: disable=3Dprotected-access - return self._aqmp.greeting._asdict() + return self._qmp.greeting._asdict() return None =20 def __enter__(self: _T) -> _T: @@ -140,11 +140,11 @@ def connect(self, negotiate: bool =3D True) -> Option= al[QMPMessage]: :return: QMP greeting dict, or None if negotiate is false :raise ConnectError: on connection errors """ - self._aqmp.await_greeting =3D negotiate - self._aqmp.negotiate =3D negotiate + self._qmp.await_greeting =3D negotiate + self._qmp.negotiate =3D negotiate =20 self._sync( - self._aqmp.connect(self._address) + self._qmp.connect(self._address) ) return self._get_greeting() =20 @@ -159,11 +159,11 @@ def accept(self, timeout: Optional[float] =3D 15.0) -= > QMPMessage: :return: QMP greeting dict :raise ConnectError: on connection errors """ - self._aqmp.await_greeting =3D True - self._aqmp.negotiate =3D True + self._qmp.await_greeting =3D True + self._qmp.negotiate =3D True =20 self._sync( - self._aqmp.accept(self._address), + self._qmp.accept(self._address), timeout ) =20 @@ -185,7 +185,7 @@ def cmd_obj(self, qmp_cmd: QMPMessage) -> QMPMessage: # _raw() isn't a public API, because turning off # automatic ID assignment is discouraged. For # compatibility with iotests *only*, do it anyway. - self._aqmp._raw(qmp_cmd, assign_id=3DFalse), + self._qmp._raw(qmp_cmd, assign_id=3DFalse), self._timeout ) ) @@ -212,7 +212,7 @@ def command(self, cmd: str, **kwds: object) -> QMPRetur= nValue: Build and send a QMP command to the monitor, report errors if any """ return self._sync( - self._aqmp.execute(cmd, kwds), + self._qmp.execute(cmd, kwds), self._timeout ) =20 @@ -233,7 +233,7 @@ def pull_event(self, """ if not wait: # wait is False/0: "do not wait, do not except." - if self._aqmp.events.empty(): + if self._qmp.events.empty(): return None =20 # If wait is 'True', wait forever. If wait is False/0, the events @@ -245,7 +245,7 @@ def pull_event(self, =20 return dict( self._sync( - self._aqmp.events.get(), + self._qmp.events.get(), timeout ) ) @@ -265,7 +265,7 @@ def get_events(self, wait: Union[bool, float] =3D False= ) -> List[QMPMessage]: =20 :return: A list of QMP events. """ - events =3D [dict(x) for x in self._aqmp.events.clear()] + events =3D [dict(x) for x in self._qmp.events.clear()] if events: return events =20 @@ -274,12 +274,12 @@ def get_events(self, wait: Union[bool, float] =3D Fal= se) -> List[QMPMessage]: =20 def clear_events(self) -> None: """Clear current list of pending events.""" - self._aqmp.events.clear() + self._qmp.events.clear() =20 def close(self) -> None: """Close the connection.""" self._sync( - self._aqmp.disconnect() + self._qmp.disconnect() ) =20 def settimeout(self, timeout: Optional[float]) -> None: @@ -300,10 +300,10 @@ def send_fd_scm(self, fd: int) -> None: """ Send a file descriptor to the remote via SCM_RIGHTS. """ - self._aqmp.send_fd_scm(fd) + self._qmp.send_fd_scm(fd) =20 def __del__(self) -> None: - if self._aqmp.runstate =3D=3D Runstate.IDLE: + if self._qmp.runstate =3D=3D Runstate.IDLE: return =20 if not self._aloop.is_running(): diff --git a/python/qemu/aqmp/message.py b/python/qemu/qmp/message.py similarity index 100% rename from python/qemu/aqmp/message.py rename to python/qemu/qmp/message.py diff --git a/python/qemu/aqmp/models.py b/python/qemu/qmp/models.py similarity index 100% rename from python/qemu/aqmp/models.py rename to python/qemu/qmp/models.py diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/qmp/protocol.py similarity index 99% rename from python/qemu/aqmp/protocol.py rename to python/qemu/qmp/protocol.py index 50e973c2f2..3bae528d59 100644 --- a/python/qemu/aqmp/protocol.py +++ b/python/qemu/qmp/protocol.py @@ -193,9 +193,9 @@ class AsyncProtocol(Generic[T]): =20 :param name: Name used for logging messages, if any. By default, messages - will log to 'qemu.aqmp.protocol', but each individual connection + will log to 'qemu.qmp.protocol', but each individual connection can be given its own logger by giving it a name; messages will - then log to 'qemu.aqmp.protocol.${name}'. + then log to 'qemu.qmp.protocol.${name}'. """ # pylint: disable=3Dtoo-many-instance-attributes =20 diff --git a/python/qemu/aqmp/py.typed b/python/qemu/qmp/py.typed similarity index 100% rename from python/qemu/aqmp/py.typed rename to python/qemu/qmp/py.typed diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/qmp/qmp_client.py similarity index 97% rename from python/qemu/aqmp/qmp_client.py rename to python/qemu/qmp/qmp_client.py index f1a845cc82..8ea9e45115 100644 --- a/python/qemu/aqmp/qmp_client.py +++ b/python/qemu/qmp/qmp_client.py @@ -192,7 +192,7 @@ async def run(self, address=3D'/tmp/qemu.socket'): await self.qmp.runstate_changed.wait() await self.disconnect() =20 - See `aqmp.events` for more detail on event handling patterns. + See `qmp.events` for more detail on event handling patterns. """ #: Logger object used for debugging messages. logger =3D logging.getLogger(__name__) @@ -416,7 +416,7 @@ def _do_send(self, msg: Message) -> None: =20 @upper_half def _get_exec_id(self) -> str: - exec_id =3D f"__aqmp#{self._execute_id:05d}" + exec_id =3D f"__qmp#{self._execute_id:05d}" self._execute_id +=3D 1 return exec_id =20 @@ -476,7 +476,7 @@ async def _execute(self, msg: Message, assign_id: bool = =3D True) -> Message: An execution ID will be assigned if assign_id is `True`. It can be disabled, but this requires that an ID is manually assigned instead. For manually assigned IDs, you must not use the string - '__aqmp#' anywhere in the ID. + '__qmp#' anywhere in the ID. =20 :param msg: The QMP `Message` to execute. :param assign_id: If True, assign a new execution ID. @@ -490,7 +490,7 @@ async def _execute(self, msg: Message, assign_id: bool = =3D True) -> Message: msg['id'] =3D self._get_exec_id() elif 'id' in msg: assert isinstance(msg['id'], str) - assert '__aqmp#' not in msg['id'] + assert '__qmp#' not in msg['id'] =20 exec_id =3D await self._issue(msg) return await self._reply(exec_id) @@ -512,7 +512,7 @@ async def _raw( Assign an arbitrary execution ID to this message. If `False`, the existing id must either be absent (and no other such pending execution may omit an ID) or a string. If it is - a string, it must not start with '__aqmp#' and no other such + a string, it must not start with '__qmp#' and no other such pending execution may currently be using that ID. =20 :return: Execution reply from the server. @@ -524,7 +524,7 @@ async def _raw( When assign_id is `False`, an ID is given, and it is not a str= ing. :raise ValueError: When assign_id is `False`, but the ID is not usable; - Either because it starts with '__aqmp#' or it is already in-us= e. + Either because it starts with '__qmp#' or it is already in-use. """ # 1. convert generic Mapping or bytes to a QMP Message # 2. copy Message objects so that we assign an ID only to the copy. @@ -534,9 +534,9 @@ async def _raw( if not assign_id and 'id' in msg: if not isinstance(exec_id, str): raise TypeError(f"ID ('{exec_id}') must be a string.") - if exec_id.startswith('__aqmp#'): + if exec_id.startswith('__qmp#'): raise ValueError( - f"ID ('{exec_id}') must not start with '__aqmp#'." + f"ID ('{exec_id}') must not start with '__qmp#'." ) =20 if not assign_id and exec_id in self._pending: diff --git a/python/qemu/aqmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py similarity index 99% rename from python/qemu/aqmp/qmp_shell.py rename to python/qemu/qmp/qmp_shell.py index d11bf54b00..571110f4f8 100644 --- a/python/qemu/aqmp/qmp_shell.py +++ b/python/qemu/qmp/qmp_shell.py @@ -95,8 +95,8 @@ Sequence, ) =20 -from qemu.aqmp import ConnectError, QMPError, SocketAddrT -from qemu.aqmp.legacy import ( +from qemu.qmp import ConnectError, QMPError, SocketAddrT +from qemu.qmp.legacy import ( QEMUMonitorProtocol, QMPBadPortError, QMPMessage, diff --git a/python/qemu/aqmp/util.py b/python/qemu/qmp/util.py similarity index 100% rename from python/qemu/aqmp/util.py rename to python/qemu/qmp/util.py diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_g= a_client.py index 15ed430c61..8c38a7ac9c 100644 --- a/python/qemu/utils/qemu_ga_client.py +++ b/python/qemu/utils/qemu_ga_client.py @@ -50,8 +50,8 @@ Sequence, ) =20 -from qemu.aqmp import ConnectError, SocketAddrT -from qemu.aqmp.legacy import QEMUMonitorProtocol +from qemu.qmp import ConnectError, SocketAddrT +from qemu.qmp.legacy import QEMUMonitorProtocol =20 =20 # This script has not seen many patches or careful attention in quite diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py index bb5d1a78f5..bcf192f477 100644 --- a/python/qemu/utils/qom.py +++ b/python/qemu/utils/qom.py @@ -32,7 +32,7 @@ =20 import argparse =20 -from qemu.aqmp import ExecuteError +from qemu.qmp import ExecuteError =20 from .qom_common import QOMCommand =20 diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common= .py index e034a6f247..80da1b2304 100644 --- a/python/qemu/utils/qom_common.py +++ b/python/qemu/utils/qom_common.py @@ -27,8 +27,8 @@ TypeVar, ) =20 -from qemu.aqmp import QMPError -from qemu.aqmp.legacy import QEMUMonitorProtocol +from qemu.qmp import QMPError +from qemu.qmp.legacy import QEMUMonitorProtocol =20 =20 class ObjectPropertyInfo: diff --git a/python/qemu/utils/qom_fuse.py b/python/qemu/utils/qom_fuse.py index 653a76b93b..8dcd59fcde 100644 --- a/python/qemu/utils/qom_fuse.py +++ b/python/qemu/utils/qom_fuse.py @@ -48,7 +48,7 @@ import fuse from fuse import FUSE, FuseOSError, Operations =20 -from qemu.aqmp import ExecuteError +from qemu.qmp import ExecuteError =20 from .qom_common import QOMCommand =20 diff --git a/python/setup.cfg b/python/setup.cfg index c341e922c2..911ae02de7 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -24,7 +24,7 @@ classifiers =3D [options] python_requires =3D >=3D 3.6 packages =3D - qemu.aqmp + qemu.qmp qemu.machine qemu.utils =20 @@ -66,8 +66,8 @@ console_scripts =3D qom-tree =3D qemu.utils.qom:QOMTree.entry_point qom-fuse =3D qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] qemu-ga-client =3D qemu.utils.qemu_ga_client:main - qmp-shell =3D qemu.aqmp.qmp_shell:main - aqmp-tui =3D qemu.aqmp.aqmp_tui:main [tui] + qmp-shell =3D qemu.qmp.qmp_shell:main + aqmp-tui =3D qemu.qmp.aqmp_tui:main [tui] =20 [flake8] extend-ignore =3D E722 # Prefer pylint's bare-except checks to flake8's @@ -83,7 +83,7 @@ namespace_packages =3D True # fusepy has no type stubs: allow_subclassing_any =3D True =20 -[mypy-qemu.aqmp.aqmp_tui] +[mypy-qemu.qmp.aqmp_tui] # urwid and urwid_readline have no type stubs: allow_subclassing_any =3D True =20 diff --git a/python/tests/protocol.py b/python/tests/protocol.py index 5cd7938be3..8864e66a94 100644 --- a/python/tests/protocol.py +++ b/python/tests/protocol.py @@ -6,9 +6,9 @@ =20 import avocado =20 -from qemu.aqmp import ConnectError, Runstate -from qemu.aqmp.protocol import AsyncProtocol, StateError -from qemu.aqmp.util import asyncio_run, create_task +from qemu.qmp import ConnectError, Runstate +from qemu.qmp.protocol import AsyncProtocol, StateError +from qemu.qmp.util import asyncio_run, create_task =20 =20 class NullProtocol(AsyncProtocol[None]): @@ -170,7 +170,7 @@ def testDefaultName(self): def testLogger(self): self.assertEqual( self.proto.logger.name, - 'qemu.aqmp.protocol' + 'qemu.qmp.protocol' ) =20 def testName(self): @@ -183,7 +183,7 @@ def testName(self): =20 self.assertEqual( self.proto.logger.name, - 'qemu.aqmp.protocol.Steve' + 'qemu.qmp.protocol.Steve' ) =20 self.assertEqual( @@ -418,7 +418,7 @@ async def _bad_connection(self, family: str): await self.proto.accept('/dev/null') =20 async def _hanging_connection(self): - with TemporaryDirectory(suffix=3D'.aqmp') as tmpdir: + with TemporaryDirectory(suffix=3D'.qmp') as tmpdir: sock =3D os.path.join(tmpdir, type(self.proto).__name__ + ".so= ck") await self.proto.accept(sock) =20 @@ -574,7 +574,7 @@ async def _asyncTearDown(self): =20 @TestBase.async_test async def testSmoke(self): - with TemporaryDirectory(suffix=3D'.aqmp') as tmpdir: + with TemporaryDirectory(suffix=3D'.qmp') as tmpdir: sock =3D os.path.join(tmpdir, type(self.proto).__name__ + ".so= ck") server_task =3D create_task(self.server.accept(sock)) =20 diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index c262d2f027..82ff07582f 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @@ -6,7 +6,7 @@ # compatibility levels for each CPU model. # =20 -from qemu.aqmp.legacy import QEMUMonitorProtocol +from qemu.qmp.legacy import QEMUMonitorProtocol import sys =20 if len(sys.argv) !=3D 2: diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 7fbd99158b..4bfc68c008 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -36,7 +36,7 @@ from itertools import chain =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python')) from qemu.machine import QEMUMachine -from qemu.aqmp import ConnectError +from qemu.qmp import ConnectError =20 logger =3D logging.getLogger('device-crash-test') dbg =3D logger.debug @@ -517,7 +517,7 @@ def main(): # Async QMP, when in use, is chatty about connection failures. # This script knowingly generates a ton of connection errors. # Silence this logger. - logging.getLogger('qemu.aqmp.qmp_client').setLevel(logging.CRITICA= L) + logging.getLogger('qemu.qmp.qmp_client').setLevel(logging.CRITICAL) =20 fatal_failures =3D [] wl_stats =3D {} diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index 31b19d73e2..4a20f97db7 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -4,7 +4,7 @@ import os import sys =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.aqmp import qmp_shell +from qemu.qmp import qmp_shell =20 =20 if __name__ =3D=3D '__main__': diff --git a/scripts/render_block_graph.py b/scripts/render_block_graph.py index 97778927f3..26f43fef27 100755 --- a/scripts/render_block_graph.py +++ b/scripts/render_block_graph.py @@ -25,8 +25,8 @@ from graphviz import Digraph =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python')) -from qemu.aqmp import QMPError -from qemu.aqmp.legacy import QEMUMonitorProtocol +from qemu.qmp import QMPError +from qemu.qmp.legacy import QEMUMonitorProtocol =20 =20 def perm(arr): diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/b= ench_block_job.py index af9d1646a4..56191db44b 100755 --- a/scripts/simplebench/bench_block_job.py +++ b/scripts/simplebench/bench_block_job.py @@ -27,7 +27,7 @@ =20 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) from qemu.machine import QEMUMachine -from qemu.aqmp import ConnectError +from qemu.qmp import ConnectError =20 =20 def bench_block_job(cmd, cmd_args, qemu_args): diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 98bc50cb3a..ded417c8c8 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -37,7 +37,7 @@ from contextlib import contextmanager =20 from qemu.machine import qtest -from qemu.aqmp.legacy import QMPMessage +from qemu.qmp.legacy import QMPMessage =20 # Use this logger for logging messages directly from the iotests module logger =3D logging.getLogger('qemu.iotests') diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests= /tests/mirror-top-perms index f394931a00..d0b4449b35 100755 --- a/tests/qemu-iotests/tests/mirror-top-perms +++ b/tests/qemu-iotests/tests/mirror-top-perms @@ -21,7 +21,7 @@ =20 import os =20 -from qemu.aqmp import ConnectError +from qemu.qmp import ConnectError from qemu.machine import machine =20 import iotests @@ -99,10 +99,10 @@ class TestMirrorTopPerms(iotests.QMPTestCase): self.vm_b.add_blockdev(f'file,node-name=3Ddrive0,filename=3D{sourc= e}') self.vm_b.add_device('virtio-blk,drive=3Ddrive0,share-rw=3Don') try: - # Silence AQMP errors temporarily. + # Silence QMP errors temporarily. # TODO: Remove change_log_level and allow the errors to be log= ged. # This necessitates a PID filter on *all* logging output. - with change_log_level('qemu.aqmp'): + with change_log_level('qemu.qmp'): self.vm_b.launch() print('ERROR: VM B launched successfully, ' 'this should not have happened') --=20 2.31.1 From nobody Fri May 3 00:22:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641858672350756.1917641032117; Mon, 10 Jan 2022 15:51:12 -0800 (PST) Received: from localhost ([::1]:37494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n74RT-0004lX-7o for importer@patchew.org; Mon, 10 Jan 2022 18:51:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749m-00060A-1h for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n749k-0000Q4-36 for qemu-devel@nongnu.org; Mon, 10 Jan 2022 18:32:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-266-2h7Z4SVcNoiAHQGeWigzAw-1; Mon, 10 Jan 2022 18:32:47 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B06A100F942; Mon, 10 Jan 2022 23:32:46 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1BE77B031; Mon, 10 Jan 2022 23:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641857570; 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=t5l4tg2t/K05Hr3lka1OpH095sVCTfVTEl5F5DN+1LI=; b=Ny19NHI1mr3CtGzGQCPQP8aHYKQaywRLJVSLRkv1Qz6Cg1MRhGrQfEemoL7e+m2m4XNEi+ mDdP1cu4YK+CIHKHqmwJsrtYJaKfV8AdwC56wHJMKCZ14p4+q9KBfRaAer4Qb3RERLoS/S DzPw7jJnUBxMaJqk2H5/6kWhmi5E9ZQ= X-MC-Unique: 2h7Z4SVcNoiAHQGeWigzAw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v3 31/31] python: rename 'aqmp-tui' to 'qmp-tui' Date: Mon, 10 Jan 2022 18:29:10 -0500 Message-Id: <20220110232910.1923864-32-jsnow@redhat.com> In-Reply-To: <20220110232910.1923864-1-jsnow@redhat.com> References: <20220110232910.1923864-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.597, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , Cc: Kevin Wolf , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Markus Armbruster , Wainer Moschetta , Hanna Reitz , Gerd Hoffmann , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641858672718100003 Content-Type: text/plain; charset="utf-8" This is the last vestige of the "aqmp" moniker surviving in the tree; remov= e it. Signed-off-by: John Snow Reviewed-by: Beraldo Leal --- python/qemu/qmp/{aqmp_tui.py =3D> qmp_tui.py} | 12 ++++++------ python/setup.cfg | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) rename python/qemu/qmp/{aqmp_tui.py =3D> qmp_tui.py} (98%) diff --git a/python/qemu/qmp/aqmp_tui.py b/python/qemu/qmp/qmp_tui.py similarity index 98% rename from python/qemu/qmp/aqmp_tui.py rename to python/qemu/qmp/qmp_tui.py index 184a3e4690..17dc94e7c3 100644 --- a/python/qemu/qmp/aqmp_tui.py +++ b/python/qemu/qmp/qmp_tui.py @@ -6,13 +6,13 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. """ -AQMP TUI +QMP TUI =20 -AQMP TUI is an asynchronous interface built on top the of the AQMP library. +QMP TUI is an asynchronous interface built on top the of the QMP library. It is the successor of QMP-shell and is bought-in as a replacement for it. =20 -Example Usage: aqmp-tui -Full Usage: aqmp-tui --help +Example Usage: qmp-tui +Full Usage: qmp-tui --help """ =20 import argparse @@ -129,7 +129,7 @@ def has_handler_type(logger: logging.Logger, =20 class App(QMPClient): """ - Implements the AQMP TUI. + Implements the QMP TUI. =20 Initializes the widgets and starts the urwid event loop. =20 @@ -612,7 +612,7 @@ def main() -> None: Driver of the whole script, parses arguments, initialize the TUI and the logger. """ - parser =3D argparse.ArgumentParser(description=3D'AQMP TUI') + parser =3D argparse.ArgumentParser(description=3D'QMP TUI') parser.add_argument('qmp_server', help=3D'Address of the QMP server. ' 'Format ') parser.add_argument('--num-retries', type=3Dint, default=3D10, diff --git a/python/setup.cfg b/python/setup.cfg index 911ae02de7..4614521dea 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -51,7 +51,7 @@ devel =3D fuse =3D fusepy >=3D 2.0.4 =20 -# AQMP TUI dependencies +# QMP TUI dependencies tui =3D urwid >=3D 2.1.2 urwid-readline >=3D 0.13 @@ -67,7 +67,7 @@ console_scripts =3D qom-fuse =3D qemu.utils.qom_fuse:QOMFuse.entry_point [fuse] qemu-ga-client =3D qemu.utils.qemu_ga_client:main qmp-shell =3D qemu.qmp.qmp_shell:main - aqmp-tui =3D qemu.qmp.aqmp_tui:main [tui] + qmp-tui =3D qemu.qmp.qmp_tui:main [tui] =20 [flake8] extend-ignore =3D E722 # Prefer pylint's bare-except checks to flake8's @@ -83,7 +83,7 @@ namespace_packages =3D True # fusepy has no type stubs: allow_subclassing_any =3D True =20 -[mypy-qemu.qmp.aqmp_tui] +[mypy-qemu.qmp.qmp_tui] # urwid and urwid_readline have no type stubs: allow_subclassing_any =3D True =20 --=20 2.31.1