From nobody Mon Feb 9 09:00:34 2026 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 1639597457817334.27787976204877; Wed, 15 Dec 2021 11:44:17 -0800 (PST) Received: from localhost ([::1]:57702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaCG-0005zQ-Sx for importer@patchew.org; Wed, 15 Dec 2021 14:44:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9G-0003Lh-Ms for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9F-000564-2C for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:10 -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-488-2e0kLWKwOgWJXJ-dE042zw-1; Wed, 15 Dec 2021 14:41:07 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D822A81EE63; Wed, 15 Dec 2021 19:41:05 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A87C1037F36; Wed, 15 Dec 2021 19:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597268; 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=4S9SIOCySwJsiETo45OdWYDFRUqMH9u8CfVImMkxZNY=; b=fgcRImSwwDbxx3LO7FQjfCHZ76zeUthQy4qtNd3iRDleuoaTfF7lhP/roVp2NH9lDhSmP/ ANEAx9yLrr6Xz0b9gm0FN+KFnEzn/cSqyMHhUab6/y39BYSSP7DK7c9Zf3CpBJozRWYaEp YQuYzIMsu5o9TOvMfsR/9BEUaXpnznk= X-MC-Unique: 2e0kLWKwOgWJXJ-dE042zw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 01/25] python/aqmp: add __del__ method to legacy interface Date: Wed, 15 Dec 2021 14:39:15 -0500 Message-Id: <20211215193939.3768033-2-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597459038100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639597661166883.8288511217941; Wed, 15 Dec 2021 11:47:41 -0800 (PST) Received: from localhost ([::1]:37884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaFY-0003N1-4Z for importer@patchew.org; Wed, 15 Dec 2021 14:47:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaA1-0004JO-RV for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9y-0006m4-L6 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:57 -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-618-TXLfIPFePf-sZVvJR3FKEQ-1; Wed, 15 Dec 2021 14:41:38 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB099100C661; Wed, 15 Dec 2021 19:41:37 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0761510074FD; Wed, 15 Dec 2021 19:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597304; 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=mTPg9OlYaEtMoVYo4OhIjZOaYBewhMFH9YhQB2XHl64=; b=OCXeuFHM44wpbYfrQ594wyWjMP0/wXpkWb3o086KzGDKpIp89vgvPnKXhNFzmlJmC4tBxx pyFjGdmRzLKsIo3K45X3WwFiaEO1YVEfFcxGQB38S+LmEKyqbGSrUCbv69eTY8NUail2ac 5Lg7WTxPDlAwPIBwCvl9I+uAZKYMEjA= X-MC-Unique: TXLfIPFePf-sZVvJR3FKEQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 02/25] python/aqmp: handle asyncio.TimeoutError on execute() Date: Wed, 15 Dec 2021 14:39:16 -0500 Message-Id: <20211215193939.3768033-3-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597661832100001 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 Mon Feb 9 09:00:34 2026 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 1639597796343503.34234571992306; Wed, 15 Dec 2021 11:49:56 -0800 (PST) Received: from localhost ([::1]:46398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaHj-0000bE-Ct for importer@patchew.org; Wed, 15 Dec 2021 14:49:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaA7-0004LW-Dx for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9z-0006lv-BD for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-355-AUo_XcbtNumyovdNOlG9gQ-1; Wed, 15 Dec 2021 14:41:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15D5418C8C00; Wed, 15 Dec 2021 19:41:39 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCD4D10074FD; Wed, 15 Dec 2021 19:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597303; 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=zOfDKqXxhoCUTexfpJWO4hRlK2KV3C8drQlDp+KAl3E=; b=aWaqNll/dQohC9GC0XzBRsYZoufdY053T4rqSPfsBlpvlJ219iAT42qCZnF4MBBh+QET7E xVyUoAxv8LjrpYl8hTo64awhqAeBN+4M/Wy6lwbUAzBNqfEAOIywUjbxwoGGfijUihGtiU VQvqgrxpMQ5N6v4xGlrW+rjR7l6JoYQ= X-MC-Unique: AUo_XcbtNumyovdNOlG9gQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 03/25] python/aqmp: copy type definitions from qmp Date: Wed, 15 Dec 2021 14:39:17 -0500 Message-Id: <20211215193939.3768033-4-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597796793100001 Content-Type: text/plain; charset="utf-8" Copy the remaining type definitions from QMP into the qemu.aqmp.legacy module. Now, most users don't need to import anything else but qemu.aqmp.legacy. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 5190b33b13..42a897e2fe 100644 --- a/python/qemu/aqmp/protocol.py +++ b/python/qemu/aqmp/protocol.py @@ -46,6 +46,10 @@ _TaskFN =3D Callable[[], Awaitable[None]] # aka ``async def func() -> Non= e`` _FutureT =3D TypeVar('_FutureT', bound=3DOptional['asyncio.Future[Any]']) =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 Mon Feb 9 09:00:34 2026 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 1639597520618712.0973710567805; Wed, 15 Dec 2021 11:45:20 -0800 (PST) Received: from localhost ([::1]:59770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaDH-0007Qs-MB for importer@patchew.org; Wed, 15 Dec 2021 14:45:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaA4-0004Jz-6r for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9y-0006lw-NS for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:59 -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-35-ayDfI7KOOsC8c6NQ9hy79A-1; Wed, 15 Dec 2021 14:41:41 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7580881EE62; Wed, 15 Dec 2021 19:41:40 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37CF210246F1; Wed, 15 Dec 2021 19:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597303; 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=MiilU32l9qViD/3YblCdYLylKpNf5B/qdJ+hyjphUbk=; b=eepdlCJAvMmYrWpq1K5oCxub5lt7WyEdrYXwABKwyk13STYXFQ8rsB77Qo5KDha7E0XI/x PM9Osq1mKBE5XNUZYLAdWgsLhe1r+Hw+g0pRvF79P98o+nJRtLLyqJLOPmZjg7H69OSxSm c5XxmKxo6kRvI/ShvPIQBrb0/jk09c8= X-MC-Unique: ayDfI7KOOsC8c6NQ9hy79A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 04/25] python/aqmp: add SocketAddrT to package root Date: Wed, 15 Dec 2021 14:39:18 -0500 Message-Id: <20211215193939.3768033-5-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597521593100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 880d5b6fa7..c6fa2dda58 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 Mon Feb 9 09:00:34 2026 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 1639597673177924.7409316797675; Wed, 15 Dec 2021 11:47:53 -0800 (PST) Received: from localhost ([::1]:38228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaFk-0003bB-62 for importer@patchew.org; Wed, 15 Dec 2021 14:47:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaA2-0004JR-6b for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39353) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9y-0006mC-Kx for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:57 -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-438-ri6_Pb1bNI6DgAOQFj8Bfw-1; Wed, 15 Dec 2021 14:41:42 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D46C681EE60; Wed, 15 Dec 2021 19:41:41 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9800F10074FD; Wed, 15 Dec 2021 19:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597305; 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=ObrdQ06rShy7UtwKUrc4KJsA4IeCa2Q+mQ/zVjfavuE=; b=Cdi0B4IFgpKn0qUOHJj67dRo9UnkcelqhPnaylhU3e/6i8pk0XH3PAs8m4eNHo6jqBbAzc lb7UnLnjg8wpzPo9qri2N8jTe1bo6p1UYxCeDY9nj5o1ecm1vYZDICNXg258qhZBdhSNbz qfRXMU5h5nFY+EBCCEvVJjNY5QKv4Ds= X-MC-Unique: ri6_Pb1bNI6DgAOQFj8Bfw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 05/25] python/aqmp: rename AQMPError to QMPError Date: Wed, 15 Dec 2021 14:39:19 -0500 Message-Id: <20211215193939.3768033-6-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597673623100001 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 c6fa2dda58..e1efab00af 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 dervive 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 42a897e2fe..9ee6fe4ae2 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 Mon Feb 9 09:00:34 2026 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 1639597812818512.4706686435519; Wed, 15 Dec 2021 11:50:12 -0800 (PST) Received: from localhost ([::1]:47690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaHz-0001Uy-RM for importer@patchew.org; Wed, 15 Dec 2021 14:50:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAG-0004k6-08 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9y-0006mT-MX for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-117-wSdm1IExPf-ftpdyIFfPUQ-1; Wed, 15 Dec 2021 14:41:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E09A18C8C02; Wed, 15 Dec 2021 19:41:43 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0231610074FD; Wed, 15 Dec 2021 19:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597307; 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=8fkM3RzKN38Ml/3hwMhJ0HBNIBPBNdszQjmOJHoSID4=; b=jQ5pLL2cIfePxK5yTzPq1lIxEfyR5JZAweSiswIrW/wCp7p/3GWAkq1iycFaAtQKyjf5lR o1LPJnXiO5B5lH3LoEKeL5sAXA2TqxIOIIevgGF4YAEMUrvW0ozUlP9amhwgZzSSI04QV1 rxtykwKYqCyQBXCi77t1NeQD7nqzr5A= X-MC-Unique: wSdm1IExPf-ftpdyIFfPUQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 06/25] python/qemu-ga-client: update instructions to newer CLI syntax Date: Wed, 15 Dec 2021 14:39:20 -0500 Message-Id: <20211215193939.3768033-7-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597813451100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639597704327958.5925180754124; Wed, 15 Dec 2021 11:48:24 -0800 (PST) Received: from localhost ([::1]:41016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaGF-0005TE-Ci for importer@patchew.org; Wed, 15 Dec 2021 14:48:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaA1-0004JM-GN for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21453) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxa9x-0006mp-Bk for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:41:56 -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-581-BB49RfWnPI--fHivSZIKEw-1; Wed, 15 Dec 2021 14:41:46 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F09E760C9; Wed, 15 Dec 2021 19:41:44 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 605C110074FD; Wed, 15 Dec 2021 19:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597309; 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=vLFhR7ZJ7BWeCLyQJFXmxjzGjmcX2i8VzFRc8cNrtAM=; b=W54O17KwrK4uy7jUm/NdbbU/0xqhBW0zctROoWF6e6PZVszdH/oo1Brkibhgx5HI0N9oWd pVhc0wZL6Ad3Ufb1oKzP4KIqG+/6xFVk3h/3+j4FK1QTkOVbeRvRk0JyAK/e3qAYOqDNTK p8Wx2GKAkORjRWB/WOLKegJ/Vvuygts= X-MC-Unique: BB49RfWnPI--fHivSZIKEw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 07/25] python/qmp: switch qemu-ga-client to AQMP Date: Wed, 15 Dec 2021 14:39:21 -0500 Message-Id: <20211215193939.3768033-8-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597706090100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639597894022336.1852279924757; Wed, 15 Dec 2021 11:51:34 -0800 (PST) Received: from localhost ([::1]:50338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaJJ-0003Kb-0n for importer@patchew.org; Wed, 15 Dec 2021 14:51:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAQ-0004o5-Qf for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAO-0000Iw-R8 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:22 -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-536-aP7bKdkQO2214L9JjF4q0Q-1; Wed, 15 Dec 2021 14:42:17 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6ACCF106B3A3; Wed, 15 Dec 2021 19:42:16 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF14D10074FD; Wed, 15 Dec 2021 19:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597340; 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=7IbeeyS7dBmJTWJ2j+vgcET3GFl5dTxf7BZcjLMPZ+I=; b=SjDWBb3mOZyBl5STIvFwzGuMKd21B9OYu7PBXiv27XnwZjuWhm8NxoeTFLHBMW4IA3kFkz NDyCqaN1pvIsVhdDRyW1lrOQ9SZLQEJz8Vmw1QSfdUNqmDnfYNM5d+l7JPrwtHa+PQGxqE HFkj4L9JLv75Y1vMxlChYbw7j0bIy4c= X-MC-Unique: aP7bKdkQO2214L9JjF4q0Q-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 08/25] python/qmp: switch qom tools to AQMP Date: Wed, 15 Dec 2021 14:39:22 -0500 Message-Id: <20211215193939.3768033-9-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597895119100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 a59ae1a2a1..6f07451dfa 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 # The following is needed only for a type alias. 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 Mon Feb 9 09:00:34 2026 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 1639597613357485.9220177936205; Wed, 15 Dec 2021 11:46:53 -0800 (PST) Received: from localhost ([::1]:35356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaEm-0001gk-8Y for importer@patchew.org; Wed, 15 Dec 2021 14:46:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAb-00051u-Ih for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAY-0000Nz-CG for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-172-udHfBjdjNmSgHv_4ZNmW2w-1; Wed, 15 Dec 2021 14:42:25 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9904F760C5; Wed, 15 Dec 2021 19:42:24 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C26210246EB; Wed, 15 Dec 2021 19:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597348; 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=VpowE+HYd8NLrIcS94GYeDdxxF7aUq4Y70feKG/er0c=; b=KeYa+IdRBo8OJI1Ncpb3E9GPHSskU+/Cuj3w8BVa2Ycrzg//NyfQePAj16qXoFOBjBC2wZ 3yRisTsG2E0CIi3Hp6ZzxXHFjNiGZw5jsgaBroCBzLoIkeV57tVyAxYEUjR72MY2ne7832 +bInXmqHCY4AEP9nc9iZh4s6mW7HhXM= X-MC-Unique: udHfBjdjNmSgHv_4ZNmW2w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 09/25] python/qmp: switch qmp-shell to AQMP Date: Wed, 15 Dec 2021 14:39:23 -0500 Message-Id: <20211215193939.3768033-10-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597614769100001 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 Mon Feb 9 09:00:34 2026 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 1639597995669781.0894210278643; Wed, 15 Dec 2021 11:53:15 -0800 (PST) Received: from localhost ([::1]:56446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaKw-0007Tx-MY for importer@patchew.org; Wed, 15 Dec 2021 14:53:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAc-00053P-PK for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37096) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAY-0000Xs-Rh for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:34 -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-288-tJ-KfLmDMWC4qdHCactbmA-1; Wed, 15 Dec 2021 14:42:27 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08DC3801ADC; Wed, 15 Dec 2021 19:42:26 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA4E410074FD; Wed, 15 Dec 2021 19:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597350; 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=GHTs3dVM5hFbGiBs6bsJhoICZNDKvIQeHP9OLCa4kXo=; b=BRZ9/QILr/Pqqan2y+naDFhFTXOBgbNVfklUv+vJa8Q8hTVCzgxHLpaTXYoDGBijGVsRTz /4NQwH13II+dUzW+693/hzVdyXVtmgAb8uQ90w27GPcCndQb8wTGlJgg5SpoG1qpyWIrb3 j85suXUiqnhVUs+5tLhNdI6PkveKpHc= X-MC-Unique: tJ-KfLmDMWC4qdHCactbmA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 10/25] python: move qmp utilities to python/qemu/utils Date: Wed, 15 Dec 2021 14:39:24 -0500 Message-Id: <20211215193939.3768033-11-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597996674100001 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 --- 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 Mon Feb 9 09:00:34 2026 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 1639598187649580.6220432458092; Wed, 15 Dec 2021 11:56:27 -0800 (PST) Received: from localhost ([::1]:34134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaO2-00038K-KO for importer@patchew.org; Wed, 15 Dec 2021 14:56:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAZ-0004vA-SK for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAY-0000T9-4r for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-446-ZvWhSSGyOmilm2znblGbkA-1; Wed, 15 Dec 2021 14:42:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DF21100C663; Wed, 15 Dec 2021 19:42:27 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AF2710074FD; Wed, 15 Dec 2021 19:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597349; 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=o/D/PEB9EDF7yYxBFFSKnfUT785DfwIux93dqCYu8qA=; b=HIQ+3W2zP5QNOTCtD+feLZwz05Z3VhGXfBTQrHfaHAZS8QIfIzuQ4WIw8FAbgbIIFBRpnk EVp2k+ZPklEgn4EE4QmMkBJbKMn5mJjw0WaGD2OXpjWXqV/ZgFbVHOp8eSr3vF5j2OnRT6 QF4H+0NTWVWGLFctnqCQMasQ5nGLwGc= X-MC-Unique: ZvWhSSGyOmilm2znblGbkA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 11/25] python: move qmp-shell under the AQMP package Date: Wed, 15 Dec 2021 14:39:25 -0500 Message-Id: <20211215193939.3768033-12-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598188299100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598221152596.6523376039091; Wed, 15 Dec 2021 11:57:01 -0800 (PST) Received: from localhost ([::1]:36494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaOa-0004ps-7t for importer@patchew.org; Wed, 15 Dec 2021 14:57:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAd-00053T-Jo for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAb-0000lb-Rj for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-541-tVOq3d69Orm7rgDBno8wvw-1; Wed, 15 Dec 2021 14:42:30 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D15628042A2; Wed, 15 Dec 2021 19:42:28 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90A5B1036D00; Wed, 15 Dec 2021 19:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597353; 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=pdCv53NqcC/gHhN4IgKau9iSfhdUIeYYu37PK97CXuY=; b=F6KON8W+T4spTI8ng71isecD5hCcaT+bT9azL8Z/FCgnJO9Ohwas99Zfc3afXjqBL8utXH Ntw/FWvVukl3yQj/ebCfyLGYpG2ZpB/TDUAm4WeucqG817pK67S9mKk4623yrbku7/xjGi k3jBuLy2hYGbxZi40XyTbMdHm3CxYxs= X-MC-Unique: tVOq3d69Orm7rgDBno8wvw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 12/25] python/machine: permanently switch to AQMP Date: Wed, 15 Dec 2021 14:39:26 -0500 Message-Id: <20211215193939.3768033-13-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598223078100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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..817c8a5425 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.protocol import SocketAddrT =20 from .machine import QEMUMachine =20 --=20 2.31.1 From nobody Mon Feb 9 09:00:34 2026 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 1639597748731889.1092282588542; Wed, 15 Dec 2021 11:49:08 -0800 (PST) Received: from localhost ([::1]:43960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaGx-0007Ou-Pu for importer@patchew.org; Wed, 15 Dec 2021 14:49:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAe-00053U-8e for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAc-0000rq-V3 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-516-I0XzSV2nM3C7Vg1uNJQvqg-1; Wed, 15 Dec 2021 14:42:31 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42499100C660; Wed, 15 Dec 2021 19:42:30 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id F250F1037F36; Wed, 15 Dec 2021 19:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597354; 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=lAgGbxVCeyTmIDeyZ+YWYCMIvjAwkEcRBPiUwRdN2bQ=; b=Kp6ORBThsByagTf3STAxUjeRgc0keEqZZiTCH68OXHxJ5mP0hCEQd5rURzR9oPaxj1Oppb H6m45e8Sktb1ypDTtVEzSAyvxGgCoAxGkoid5jmaMV4pNZ1VOj1K9iqDJZ652t028rr8AM sQt7Vn1d3ST8ir3B9KE0rW0wdlgpfsM= X-MC-Unique: I0XzSV2nM3C7Vg1uNJQvqg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 13/25] scripts/cpu-x86-uarch-abi: fix CLI parsing Date: Wed, 15 Dec 2021 14:39:27 -0500 Message-Id: <20211215193939.3768033-14-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597750392100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow 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 Mon Feb 9 09:00:34 2026 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 1639598008249430.52081147091553; Wed, 15 Dec 2021 11:53:28 -0800 (PST) Received: from localhost ([::1]:56876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaL9-0007nj-Bv for importer@patchew.org; Wed, 15 Dec 2021 14:53:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAw-0005PF-KS for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaAv-0001wQ-2y for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:42: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-262-uiUrqhVUMcG3iB9li81hfw-1; Wed, 15 Dec 2021 14:42:49 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4772D760C1; Wed, 15 Dec 2021 19:42:48 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 638D410074FD; Wed, 15 Dec 2021 19:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597372; 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=EOSe0Y+PecUkVn3R8Oja7L9B2QiH1oXEL9mkbdeM1p4=; b=BVfesf1gSta/Xb+yj+CRfF05DVV354Y7e17zCPhiQPEFrZYepdXJ1RwQXBaGrEJKPJv40a DakNAZjR+f8FUCBP/ZtbdaDsbP8da41UUKtgNU9Qyjzm3FV2VkhPyctHLrOI0roWsOdTMe IvSz9SC4wOiBZ2n85rFjd6nc7bEP2lU= X-MC-Unique: uiUrqhVUMcG3iB9li81hfw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 14/25] scripts/cpu-x86-uarch-abi: switch to AQMP Date: Wed, 15 Dec 2021 14:39:28 -0500 Message-Id: <20211215193939.3768033-15-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598010114100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598228572634.0949192311019; Wed, 15 Dec 2021 11:57:08 -0800 (PST) Received: from localhost ([::1]:37016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaOh-0005CE-JD for importer@patchew.org; Wed, 15 Dec 2021 14:57:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB6-0005iL-OA for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB5-0001xV-BK for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:04 -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-307-41jp9VX5MHG4c0fj2vbsFw-1; Wed, 15 Dec 2021 14:42:59 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8201B8042E1; Wed, 15 Dec 2021 19:42:58 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BB3B10074FD; Wed, 15 Dec 2021 19:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597382; 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=TaOdEqubTcg02LOSrnzb0iuTWM+DFNgu3uhxz5Eh5uE=; b=Hv4cEAZp+DTs0fctdyhcgY1t9AIMjLiD8aWOF90VJ88cPRI2n0u1BHOaFbSrC9Hli2ahB1 R22LSO3GSvf5hGqDkXZrd3X84l8LtFfBxINmiKZYcc2DUEObVtLfyilLjxWa1Wo3WyN8h0 bYy82jVzWrmu0l5izJvLmwW338WmsPU= X-MC-Unique: 41jp9VX5MHG4c0fj2vbsFw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 15/25] scripts/render-block-graph: switch to AQMP Date: Wed, 15 Dec 2021 14:39:29 -0500 Message-Id: <20211215193939.3768033-16-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598230126100001 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 AQMPError. Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598464300372.26516464614997; Wed, 15 Dec 2021 12:01:04 -0800 (PST) Received: from localhost ([::1]:45576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaSV-0002bV-07 for importer@patchew.org; Wed, 15 Dec 2021 15:01:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB8-0005q1-DR for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49809) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB6-0001xu-NO for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43: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-154-vyOKgEhnOY-s9kiTq0y76w-1; Wed, 15 Dec 2021 14:43:00 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E08058042EA; Wed, 15 Dec 2021 19:42:59 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3E7710074FD; Wed, 15 Dec 2021 19:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597384; 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=ldOdmNQi+cFFOo6YYoDgU5P4D37dC1TVNC1M6WbkmMQ=; b=MqB6qCUZg9FWycyhQhyQNY90zhJd5n/WUbkPAdKf6l9IQWfEnAp1U+JldjqWHQs70CdRIp mho3Jui4kVK+radYr+gtcZximZFNbJKKljzJOXvxFLVNwr+ksK6SKXeZKnZvCRX7lEkwrt 6hLsT0TbCoKivqj/Kd//UqNMUya6Ink= X-MC-Unique: vyOKgEhnOY-s9kiTq0y76w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 16/25] scripts/bench-block-job: switch to AQMP Date: Wed, 15 Dec 2021 14:39:30 -0500 Message-Id: <20211215193939.3768033-17-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598466251100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598491176481.31885340680947; Wed, 15 Dec 2021 12:01:31 -0800 (PST) Received: from localhost ([::1]:46350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaSv-0003Ah-WA for importer@patchew.org; Wed, 15 Dec 2021 15:01:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB9-0005ro-Pr for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB8-0001yH-BB for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:07 -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-325-8HTOgUJpMLuU6csiMBL_Gw-1; Wed, 15 Dec 2021 14:43:02 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FEA9760C7; Wed, 15 Dec 2021 19:43:01 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F23210074FD; Wed, 15 Dec 2021 19:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597385; 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=fbR8cLUOu5n6ohejSdT7hbIEAZvI5H8CnJy9U6sbFHY=; b=FasAmWtfGQz4qhGfECyC40lFPrQsKiJBgCIT+QhlW2TtqVsUmypuLTw+TFhAfaT1IL3Sbd PtFe8BLtFG+LDJVFqNnt9e4FrVfvGGPuKzZyTX0WpLJ9wd/LBtbIi57K2DaXiYeeaWBzt7 ggc/n0h9GTl92UAW/pY0C124bpHWdCc= X-MC-Unique: 8HTOgUJpMLuU6csiMBL_Gw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 17/25] iotests/mirror-top-perms: switch to AQMP Date: Wed, 15 Dec 2021 14:39:31 -0500 Message-Id: <20211215193939.3768033-18-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598491904100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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, or for v2. 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 Mon Feb 9 09:00:34 2026 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 1639597932682428.69880478802486; Wed, 15 Dec 2021 11:52:12 -0800 (PST) Received: from localhost ([::1]:53056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaJv-0005Bd-9Y for importer@patchew.org; Wed, 15 Dec 2021 14:52:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBB-0005rs-5j for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaB9-0001yY-Ex for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:08 -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-448-9_re886oMWunw5x-k_ePKA-1; Wed, 15 Dec 2021 14:43:03 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2159760C0; Wed, 15 Dec 2021 19:43:02 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 716C310074FD; Wed, 15 Dec 2021 19:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597386; 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=ZxlToBL8uM12CzsCFv+FxFOBKJYX2wgHcwzRPGN+2Go=; b=TRhEcaYRFioIWJRGRbxOeCBNIHEcY0NLP0TItR7WDt2lwIE6vdRJAxRPwhzGtMjoT1IFv1 3NQxf4VMjHvC8mZDtOR2i879FqvP4hWXP7kK1Qs+bbSJjJLJwfwJXlMAY+8uMb/sZST5Vu 87at6LKCGB4BcLblbK0+nASquWPkh0Y= X-MC-Unique: 9_re886oMWunw5x-k_ePKA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 18/25] iotests: switch to AQMP Date: Wed, 15 Dec 2021 14:39:32 -0500 Message-Id: <20211215193939.3768033-19-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639597933449100001 Content-Type: text/plain; charset="utf-8" Simply import the type defition from the new location. Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 83bfedb902..cb21aebe36 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 Mon Feb 9 09:00:34 2026 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 1639598603911153.87498620716406; Wed, 15 Dec 2021 12:03:23 -0800 (PST) Received: from localhost ([::1]:52144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaUk-00079u-TT for importer@patchew.org; Wed, 15 Dec 2021 15:03:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBc-0006uV-TZ for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBa-00021E-DR for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43: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-249-ksk92EUsN-e88Yr29jdDPQ-1; Wed, 15 Dec 2021 14:43:26 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12B9E760C1; Wed, 15 Dec 2021 19:43:25 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2F9C10246F1; Wed, 15 Dec 2021 19:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597407; 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=39pJWh8RGfbFeVB98pUJd96r5gL4/HEBTqQOwDEQMzM=; b=UeqHdXQ1shaeIwn6VbpbwhLUXMb+HBEGzgsZBdTUOdqEjVdSQ3lvn6od9uO1ctYomEOu+O RYGqAcBM6OqW1Oi2Wp1Dm8cyCj3qWsc8mW00Wl4oAJ9KahtXv5nKQE4ClWDFlF+SDPAgNK XNxF2gKFWBmPU2uId3ts4Fvn6oT9Sq0= X-MC-Unique: ksk92EUsN-e88Yr29jdDPQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 19/25] python: temporarily silence pylint duplicate-code warnings Date: Wed, 15 Dec 2021 14:39:33 -0500 Message-Id: <20211215193939.3768033-20-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598606127100001 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 Mon Feb 9 09:00:34 2026 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 16395986984172.7058836214239363; Wed, 15 Dec 2021 12:04:58 -0800 (PST) Received: from localhost ([::1]:55398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaWH-0000to-EI for importer@patchew.org; Wed, 15 Dec 2021 15:04:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC2-0007MA-HX for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBp-00024A-MH for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43: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-385-FzWeoijUPmSKjQOuw3l4_A-1; Wed, 15 Dec 2021 14:43:43 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0244100C662; Wed, 15 Dec 2021 19:43:41 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C4A810074FD; Wed, 15 Dec 2021 19:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597429; 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=7U9JZYOTPQZQgw/PHuo/PYbKF6YyV2ZYNcjsl11jO8o=; b=GCb9ieP3ENlxO46w8cb6qeLMgtSFrZXie77OJ1TsrNfURnf3yeZj8c5V/Bv/p21VtaPkA7 FlrsY8XHX8gZA+GCqDwIRukf5EeXlGM5Og+A+XsHhaARowXcudcfQjiXg3ts2xreElb/Aj xztTN8qMBV/GE+2BcgDVfwB3wy5BHmI= X-MC-Unique: FzWeoijUPmSKjQOuw3l4_A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 20/25] python/aqmp: take QMPBadPortError and parse_address from qemu.qmp Date: Wed, 15 Dec 2021 14:39:34 -0500 Message-Id: <20211215193939.3768033-21-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598700452100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/qemu/aqmp/aqmp_tui.py | 2 +- python/qemu/aqmp/legacy.py | 30 ++++++++++++++++++++++++++---- python/qemu/qmp/__init__.py | 26 -------------------------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/aqmp/aqmp_tui.py index a2929f771c..184a3e4690 100644 --- a/python/qemu/aqmp/aqmp_tui.py +++ b/python/qemu/aqmp/aqmp_tui.py @@ -35,8 +35,8 @@ import urwid import urwid_readline =20 -from ..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 Mon Feb 9 09:00:34 2026 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 16395985237441016.7505579902532; Wed, 15 Dec 2021 12:02:03 -0800 (PST) Received: from localhost ([::1]:48686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaTS-0004jg-OF for importer@patchew.org; Wed, 15 Dec 2021 15:02:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBq-0007J7-V6 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBo-00023k-RQ for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43: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-625-hbmzqk9IP0uciJHcLwogZA-1; Wed, 15 Dec 2021 14:43:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24E09801B0C; Wed, 15 Dec 2021 19:43:43 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2D581036B4B; Wed, 15 Dec 2021 19:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597428; 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=m+ewUBxxuB6wR9nvzWe9jNbUMTYl7ovNc4dortmzwL8=; b=gehY86kEK9yZzX0OAwcOLScPUx3xh5ZEcXKT37yGWxCFgMcGJl80JgEcTCunkNLMUQRujD 60OURX/y88qk8XcU3IrAwsKEz8elxbfuUEu3tdPw4t5VKyZos52f8YRi4PZFPiioUhzD4e Vnem8z321gW0e3AgmDzi8wwbDzF6tdc= X-MC-Unique: hbmzqk9IP0uciJHcLwogZA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 21/25] python/aqmp: fully separate from qmp.QEMUMonitorProtocol Date: Wed, 15 Dec 2021 14:39:35 -0500 Message-Id: <20211215193939.3768033-22-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598525542100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598892136715.102147030746; Wed, 15 Dec 2021 12:08:12 -0800 (PST) Received: from localhost ([::1]:33808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaZP-0005Vp-1w for importer@patchew.org; Wed, 15 Dec 2021 15:08:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC2-0007M9-HI for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBp-00023x-84 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:43: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-294-VNRXOeAGORGBmJjjInZRig-1; Wed, 15 Dec 2021 14:43:45 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 885A88042E1; Wed, 15 Dec 2021 19:43:44 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46D7A10074FD; Wed, 15 Dec 2021 19:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597428; 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=kjKEAV9UvhRVVqz+3CvakmMoNWarxGXgoqhLYUzGXDQ=; b=Cb7oPfQJNesPHoTlAGTRsLw8qZRPJlq99nixMnE2LxTtLgd4H5TfIr4iqVj5jdDYw6QZ0z NB6oVtaym+Eq0hAKaHcHvuhC4lpV8WynTvrMnAW12m41a5dtK9yQ87uOJZ6wTOZ//QXLCi 5r+2OuqqFAnz6ZEjqjlUpb4qQlbFOio= X-MC-Unique: VNRXOeAGORGBmJjjInZRig-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 22/25] python/aqmp: copy qmp docstrings to qemu.aqmp.legacy Date: Wed, 15 Dec 2021 14:39:36 -0500 Message-Id: <20211215193939.3768033-23-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598894229100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598197949607.6156613228655; Wed, 15 Dec 2021 11:56:37 -0800 (PST) Received: from localhost ([::1]:34736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaOC-0003cJ-SM for importer@patchew.org; Wed, 15 Dec 2021 14:56:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC4-0007MR-TU for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaBy-00024Y-Gj for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44: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-297-XTFfCmoiPeeIIZlJezV48w-1; Wed, 15 Dec 2021 14:43:47 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04F43100C660; Wed, 15 Dec 2021 19:43:46 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA6561036D00; Wed, 15 Dec 2021 19:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597430; 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=ZZwa1mX4YRq0vgVxI4TWWloUUhZpDz5osaOtoQ8t8H0=; b=N9Ts5cy2InMWv6zIoRu9GngHYNVL+1AJPmGnBtgMdvczbaYpWAIzsNgaemmIWVsfjOV5Y2 BLphPJhGAA8IdklioI/ssbgsvV6fmxwJN70q9ZgL2yYGczEw4TnSN8ywrJygnpHik1wbTm mnawabBWww37ZOdD5FxHbnKqpyzNvSQ= X-MC-Unique: XTFfCmoiPeeIIZlJezV48w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 23/25] python: remove the old QMP package Date: Wed, 15 Dec 2021 14:39:37 -0500 Message-Id: <20211215193939.3768033-24-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598199925100001 Content-Type: text/plain; charset="utf-8" Thank you for your service! Signed-off-by: John Snow Reviewed-by: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639598692309571.1358258560923; Wed, 15 Dec 2021 12:04:52 -0800 (PST) Received: from localhost ([::1]:54958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxaWB-0000Zt-6X for importer@patchew.org; Wed, 15 Dec 2021 15:04:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC4-0007MT-U1 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC1-00026A-BU for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44: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-224-zGIkZg9RNOqen1rrkymcJA-1; Wed, 15 Dec 2021 14:43:51 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D3991030C20; Wed, 15 Dec 2021 19:43:50 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26A9510074FD; Wed, 15 Dec 2021 19:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597432; 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=yON4DkVybRlJ8QrAOwHh2Nzza9xYE+03aFOFuEjoQoQ=; b=eE2yjUcEyyubermLKNFiQUkXYtTHh0ZfZvEjgw5olCHATmF3Zyheea26CWecnYNL7YUeDz wZKrl0hyHS183EODdykcNcBiigelqxLw+RkQux+7udpKx6th7KeZUblTHFnR1m1oz5m4nW x9avLIdW5FefN2R+EgruZvwH43OXxOE= X-MC-Unique: zGIkZg9RNOqen1rrkymcJA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 24/25] python: re-enable pylint duplicate-code warnings Date: Wed, 15 Dec 2021 14:39:38 -0500 Message-Id: <20211215193939.3768033-25-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639598694571100001 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: Beraldo Leal Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Mon Feb 9 09:00:34 2026 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 1639599002080145.5899881307106; Wed, 15 Dec 2021 12:10:02 -0800 (PST) Received: from localhost ([::1]:38722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxabB-0000LJ-4K for importer@patchew.org; Wed, 15 Dec 2021 15:10:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC8-0007Mb-O0 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxaC4-00026h-G4 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 14:44: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-498-va_jTYPTPx62WhRZKXrRVQ-1; Wed, 15 Dec 2021 14:43:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C113D18C8C00; Wed, 15 Dec 2021 19:43:54 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.19.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EF391036D00; Wed, 15 Dec 2021 19:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639597439; 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=xb4PplQhbL7wdZi1aX6SAsAGZLeng6zxrf339ML0LoI=; b=A5XvC4nA+oadLhDq7NZYsvyGbSMo0Nc+pAijWpcP5EflvldE3ci2JnH3o0ciLEAtsqEoIk +w6rTBnOXG0XFathE1myrDVvKucPuR/cTZDywB1sAHHTRFw+BuBiE7soUc5ZtlpUGhvgpR 7O7J/QoyftkPkBkyqXkclU7SjtfQy1I= X-MC-Unique: va_jTYPTPx62WhRZKXrRVQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 25/25] python: rename qemu.aqmp to qemu.qmp Date: Wed, 15 Dec 2021 14:39:39 -0500 Message-Id: <20211215193939.3768033-26-jsnow@redhat.com> In-Reply-To: <20211215193939.3768033-1-jsnow@redhat.com> References: <20211215193939.3768033-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, 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_H2=-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: Eduardo Habkost , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Beraldo Leal , qemu-block@nongnu.org, Andrea Bolognani , Wainer Moschetta , Markus Armbruster , 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: 1639599003327100001 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! Signed-off-by: John Snow --- 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 | 0 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, 51 insertions(+), 51 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 (100%) 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 817c8a5425..f29d5c1042 100644 --- a/python/qemu/machine/qtest.py +++ b/python/qemu/machine/qtest.py @@ -26,7 +26,7 @@ TextIO, ) =20 -from qemu.aqmp.protocol import SocketAddrT +from qemu.qmp.protocol 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 e1efab00af..b3f1d919e2 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 dervive from `QMPError`, see `aqmp.error` for -additional detail. See `aqmp.events` for an in-depth tutorial on +raised by this library dervive 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 100% rename from python/qemu/aqmp/legacy.py rename to python/qemu/qmp/legacy.py 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 9ee6fe4ae2..5d417a95c3 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 6f07451dfa..7f5682fc04 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 # The following is needed only for a type alias. 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 cb21aebe36..28c1cbc30f 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