From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614170; cv=none; d=zohomail.com; s=zohoarc; b=iJItUYKVfgpX5VRdLV+lGHhAiQeLX2F7UyArZUWTS+0UtmeVd6MYXWLpn7N+QRo8bAGxtFxUD+ufEI3u6fV9XQzx8JO6my4gNYJs68mwT+qSXheMpQGJjypMLNFyS1QcElqRQwOsNTEHvMzDcrMWAUKG1jOPN/Schmlw/YKMLnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4xT6CcNZptOwqyiLv/EWJ7ABnDSmBj18pWnLojDvO3c=; b=ITKdGv45RSSfIcwsFchdJLSKaxkbbFnRxuanI/daYBVHAJ80OejlhlpCfNd9xfJtwx/d0tT3IW8/vAsurb1BUhbWd//GI1P2q/gdYwBnMEbc4aYrfAkPfW26ptWJvqaaaV/qNfZnD0Vfu7u02HPDs7b5iYgU/kAq7hXyvrTglZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614170124885.0367168886315; Tue, 24 Jan 2023 18:36:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcl-0008DP-7Z; Tue, 24 Jan 2023 21:34:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcj-0008Cu-Pz for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVci-0005LP-1M for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:53 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-180-krgcCGueOT-vLUqSMoNBUQ-1; Tue, 24 Jan 2023 21:34:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79DBB29A9CA3; Wed, 25 Jan 2023 02:34:47 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id E91222026D4B; Wed, 25 Jan 2023 02:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614091; 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=4xT6CcNZptOwqyiLv/EWJ7ABnDSmBj18pWnLojDvO3c=; b=CbCm5RMiAHpq3YAotuPA53rLGmjf2sTfypJNMSaz2YHf9mdxd7wCc69FefmbXQhNa8XRbb u6oTQNJLc+JoYWnEMSRHcwGvq2iXkqf2xT+83KSVMN6Adxbv5K9w4ZFdVHpBr2iO50EDSg 1JprPCiO6o+e1y3c4mHyy7xQYlrDO3E= X-MC-Unique: krgcCGueOT-vLUqSMoNBUQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , Dongdong Zhang Subject: [PULL 1/7] Fix some typos Date: Tue, 24 Jan 2023 21:34:39 -0500 Message-Id: <20230125023445.3655253-2-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614170729100003 From: Dongdong Zhang Fix some typos in 'python' directory. Signed-off-by: Dongdong Zhang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20221130015358.6998-2-zhangdongdong@eswincomputing.com [Fixed additional typo spotted by Max Filippov. --js] Reviewed-by: John Snow Signed-off-by: John Snow --- python/qemu/machine/console_socket.py | 2 +- python/qemu/machine/qtest.py | 2 +- python/qemu/qmp/protocol.py | 2 +- python/qemu/qmp/qmp_tui.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/qemu/machine/console_socket.py b/python/qemu/machine/co= nsole_socket.py index 8c4ff598ad7..4e28ba9bb23 100644 --- a/python/qemu/machine/console_socket.py +++ b/python/qemu/machine/console_socket.py @@ -68,7 +68,7 @@ def _thread_start(self) -> threading.Thread: """Kick off a thread to drain the socket.""" # Configure socket to not block and timeout. # This allows our drain thread to not block - # on recieve and exit smoothly. + # on receive and exit smoothly. socket.socket.setblocking(self, False) socket.socket.settimeout(self, 1) drain_thread =3D threading.Thread(target=3Dself._drain_fn) diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py index 1a1fc6c9b08..1c46138bd0c 100644 --- a/python/qemu/machine/qtest.py +++ b/python/qemu/machine/qtest.py @@ -42,7 +42,7 @@ class QEMUQtestProtocol: :raise socket.error: on socket connection errors =20 .. note:: - No conection is estabalished by __init__(), this is done + No connection is established by __init__(), this is done by the connect() or accept() methods. """ def __init__(self, address: SocketAddrT, diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py index 6ea86650ad2..15909b7dbad 100644 --- a/python/qemu/qmp/protocol.py +++ b/python/qemu/qmp/protocol.py @@ -812,7 +812,7 @@ async def _bh_flush_writer(self) -> None: =20 @bottom_half async def _bh_close_stream(self, error_pathway: bool =3D False) -> Non= e: - # NB: Closing the writer also implcitly closes the reader. + # NB: Closing the writer also implicitly closes the reader. if not self._writer: return =20 diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py index ce239d8979b..83691447231 100644 --- a/python/qemu/qmp/qmp_tui.py +++ b/python/qemu/qmp/qmp_tui.py @@ -71,7 +71,7 @@ def format_json(msg: str) -> str: due to an decoding error then a simple string manipulation is done to achieve a single line JSON string. =20 - Converting into single line is more asthetically pleasing when looking + Converting into single line is more aesthetically pleasing when looking along with error messages. =20 Eg: @@ -91,7 +91,7 @@ def format_json(msg: str) -> str: =20 [1, true, 3]: QMP message is not a JSON object. =20 - The single line mode is more asthetically pleasing. + The single line mode is more aesthetically pleasing. =20 :param msg: The message to formatted into single line. @@ -498,7 +498,7 @@ def __init__(self, parent: App) -> None: class HistoryBox(urwid.ListBox): """ This widget is modelled using the ListBox widget, contains the list of - all messages both QMP messages and log messsages to be shown in the TU= I. + all messages both QMP messages and log messages to be shown in the TUI. =20 The messages are urwid.Text widgets. On every append of a message, the focus is shifted to the last appended message. --=20 2.39.0 From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614169; cv=none; d=zohomail.com; s=zohoarc; b=Na8xEJxPbP0qKDuugvogcDhZWCL5yT4d1aQxI2pfEu+5fbNyk3TqcBX2nrTBiPNq3rcxV7GJjiu8TcTRg66RMxilcLiIwxKaVkPevF194pQOQixiw6PQZqiYEjVQSwpFSkM0Ksq8U5x2PyDDGqR8iQLmzxwc8UGQE/jVZ5MBAdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614169; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XK1m08GIjE5gY0wWRoHGYqPJm5+tZIvVhNheEeK0fW0=; b=b18/3tSaKuygVn7hWn7HkdQEp6JqPOkCSEDAPbXo4KHHvvfbi/5MkWXjLSfhU/GRIALwwCo1Mj9RgZN20tgnjBrAi7SfdTkE8naKogzcfelXMPZnW77TYK68Vl/tGq/D7NmNUuJTkjtKsF9R7fU/jPm/pibKj3/hLCIXrmgLoaw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614169885280.909273474633; Tue, 24 Jan 2023 18:36:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcn-0008GH-Ip; Tue, 24 Jan 2023 21:34:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcl-0008Do-GU for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcj-0005Ld-1a for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:55 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-216-9FozmxB5NVKK_jbVOEcswQ-1; Tue, 24 Jan 2023 21:34:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3080185A588; Wed, 25 Jan 2023 02:34:48 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8704C2026D4B; Wed, 25 Jan 2023 02:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XK1m08GIjE5gY0wWRoHGYqPJm5+tZIvVhNheEeK0fW0=; b=EpcLuqcIwDivgwbCsH0Fijiycj3k78MkzV1Vb0bhkqfgbZI19MFHVIorEdMD/Os6oRs2XX KEAsxm8FIYC/YYZAL/GH0KHIKRuDTiVKhxBOlvXHgPrPe0jfbjMx9F6/qGT+r83nkLlkOc sU9e16DDuxSTCH9TUNHagfVgLWxNvDk= X-MC-Unique: 9FozmxB5NVKK_jbVOEcswQ-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , Vladimir Sementsov-Ogievskiy Subject: [PULL 2/7] python: QEMUMachine: enable qmp accept timeout by default Date: Tue, 24 Jan 2023 21:34:40 -0500 Message-Id: <20230125023445.3655253-3-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614170970100005 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy I've spent much time trying to debug hanging pipeline in gitlab. I started from and idea that I have problem in code in my series (which has some timeouts). Finally I found that the problem is that I've used QEMUMachine class directly to avoid qtest, and didn't add necessary arguments. Qemu fails and we wait for qmp accept endlessly. In gitlab it's just stopped by timeout (one hour) with no sign of what's going wrong. With timeout enabled, gitlab don't wait for an hour and prints all needed information. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Message-Id: <20220624195252.175249-1-vsementsov@yandex-team.ru> [Fixed typing. --js] Signed-off-by: John Snow --- python/qemu/machine/machine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 748a0d807c9..c759db03e43 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -131,7 +131,7 @@ def __init__(self, drain_console: bool =3D False, console_log: Optional[str] =3D None, log_dir: Optional[str] =3D None, - qmp_timer: Optional[float] =3D None): + qmp_timer: Optional[float] =3D 30): ''' Initialize a QEMUMachine =20 --=20 2.39.0 From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614175; cv=none; d=zohomail.com; s=zohoarc; b=i5Cf+xXcIPlqm5R6FLAEYfk/UVvvjd1bZd5bkz6BOKTD0cX46W6xRFOGOQsRob76DbWdtTEsreSB+oCYJ6sOpTboscIIWs+aY993ChQG6i9v6qOhiukXYX2/NL7VEyAOjGO62T9aWh1tbSay7f4xmd9nG8F+qdPKVBds4zPLw6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614175; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bdy+8878Rt59YtBZVnB/HheQNmOVeHpRU+HMUqMLmsk=; b=GfdIuUt0FO5thAk0d+L41y0FEO4pAYKnvR26BqPpzMJy99hQn+v2K5nlNFdYbq4ALuP7/gfIXgraE/UvzlPfHzkkikhPIBLt89K/bPK+QZRNVeOSZLEihyRO1GnvP4AsBldVZh0flJUZdjnmdq/IEj5NsoQW+4DEUscAdd+HGdg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614175775765.6265128166635; Tue, 24 Jan 2023 18:36:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcp-0008IU-8I; Tue, 24 Jan 2023 21:34:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcm-0008F0-Tb for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVck-0005Lx-EU for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:56 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-321-JYUIkejjMVmKl7G-zcTtYw-1; Tue, 24 Jan 2023 21:34:49 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD1AB380406A; Wed, 25 Jan 2023 02:34:48 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E6752026D4B; Wed, 25 Jan 2023 02:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614093; 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=bdy+8878Rt59YtBZVnB/HheQNmOVeHpRU+HMUqMLmsk=; b=TTAbhKJ2+6njLeUn/yReaWf95FUeTTg8DzgCMECvsGv14y3P+3ig+sCqBLZHdRo/Uw2whX kfGoWhXcebmZjvOpAzZ6tGAJhxttXshD/MdpByMJG/lDRTQN7PbfWW8n68IzJccZ3WUhmi MawxezdbZe2Sjx69udAMSQmNKOwHER0= X-MC-Unique: JYUIkejjMVmKl7G-zcTtYw-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , Peter Delevoryas , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 3/7] python/machine: Fix AF_UNIX path too long on macOS Date: Tue, 24 Jan 2023 21:34:41 -0500 Message-Id: <20230125023445.3655253-4-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614176630100003 From: Peter Delevoryas On macOS, private $TMPDIR's are the default. These $TMPDIR's are generated from a user's unix UID and UUID [1], which can create a relatively long path: /var/folders/d7/rz20f6hd709c1ty8f6_6y_z40000gn/T/ QEMU's avocado tests create a temporary directory prefixed by "avo_qemu_sock_", and create QMP sockets within _that_ as well. The QMP socket is unnecessarily long, because a temporary directory is created for every QEMUMachine object. /avo_qemu_sock_uh3w_dgc/qemu-37331-10bacf110-monitor.sock The path limit for unix sockets on macOS is 104: [2] /* * [XSI] Definitions for UNIX IPC domain. */ struct sockaddr_un { unsigned char sun_len; /* sockaddr len including null */ sa_family_t sun_family; /* [XSI] AF_UNIX */ char sun_path[104]; /* [XSI] path name (gag) */ }; This results in avocado tests failing on macOS because the QMP unix socket can't be created, because the path is too long: ERROR| Failed to establish connection: OSError: AF_UNIX path too long This change resolves by reducing the size of the socket directory prefix and the suffix on the QMP and console socket names. The result is paths like this: pdel@pdel-mbp:/var/folders/d7/rz20f6hd709c1ty8f6_6y_z40000gn/T $ tree qemu* qemu_df4evjeq qemu_jbxel3gy qemu_ml9s_gg7 qemu_oc7h7f3u qemu_oqb1yf97 =E2=94=9C=E2=94=80=E2=94=80 10a004050.con =E2=94=94=E2=94=80=E2=94=80 10a004050.qmp [1] https://apple.stackexchange.com/questions/353832/why-is-mac-osx-temp-di= rectory-in-weird-path [2] /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys= /un.h Signed-off-by: Peter Delevoryas Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20230110082930.42129-2-peter@pjd.dev Signed-off-by: John Snow --- python/qemu/machine/machine.py | 6 +++--- tests/avocado/avocado_qemu/__init__.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index c759db03e43..a71d87ead40 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -157,7 +157,7 @@ def __init__(self, self._wrapper =3D wrapper self._qmp_timer =3D qmp_timer =20 - self._name =3D name or f"qemu-{os.getpid()}-{id(self):02x}" + self._name =3D name or f"{id(self):x}" self._temp_dir: Optional[str] =3D None self._base_temp_dir =3D base_temp_dir self._sock_dir =3D sock_dir @@ -167,7 +167,7 @@ def __init__(self, self._monitor_address =3D monitor_address else: self._monitor_address =3D os.path.join( - self.sock_dir, f"{self._name}-monitor.sock" + self.sock_dir, f"{self._name}.qmp" ) =20 self._console_log_path =3D console_log @@ -192,7 +192,7 @@ def __init__(self, self._console_set =3D False self._console_device_type: Optional[str] =3D None self._console_address =3D os.path.join( - self.sock_dir, f"{self._name}-console.sock" + self.sock_dir, f"{self._name}.con" ) self._console_socket: Optional[socket.socket] =3D None self._remove_files: List[str] =3D [] diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado= _qemu/__init__.py index 910f3ba1eab..25a546842fa 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -306,7 +306,7 @@ def require_netdev(self, netdevname): self.cancel('no support for user networking') =20 def _new_vm(self, name, *args): - self._sd =3D tempfile.TemporaryDirectory(prefix=3D"avo_qemu_sock_") + self._sd =3D tempfile.TemporaryDirectory(prefix=3D"qemu_") vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.workdir, sock_dir=3Dself._sd.name, log_dir=3Dself.logdir) self.log.debug('QEMUMachine "%s" created', name) --=20 2.39.0 From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614198; cv=none; d=zohomail.com; s=zohoarc; b=ZvztD6kBSeW7I1gqe1FuffJw1+v2gkEhgrPEls07LeKw35MiOezMtk8DazFVLS8D4yGHlzxetPJ8mjYqQTeAxil07dEINW8zr6BmLaMeXrT6F0gKniY0xQ2tXQAhYlfe9lhAaUE5pxmJ6XfHbWFju/fjy/ZA0BaztqH03V4EJ80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614198; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MIODFy/h5ObVaSoRuZwj96eY6dCH1k+EbAWSHegp3UU=; b=ETj4N69eqC96cCuOLfzKtYNPLmS50+Qr20dE2ny/aJxmAw1VymdfFwkMGd/LrAmNi3z0KT/j7xupPK84lBhrXfU+iV2RRV/ueiLZO+2JoHULe0agexLEj4OB0lU+qizMH0WdBQbHiqs0MxP7V40FvoaaDpqdpXR2RFy4iwvOzjw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614198389121.694867016025; Tue, 24 Jan 2023 18:36:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcn-0008GF-GC; Tue, 24 Jan 2023 21:34:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcm-0008Eh-FX for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcj-0005Lr-U7 for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:56 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-286-Nf5lrhOKOJy-MzMEad0yvA-1; Tue, 24 Jan 2023 21:34:50 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 72E6E830F4E; Wed, 25 Jan 2023 02:34:49 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAA312026D4B; Wed, 25 Jan 2023 02:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MIODFy/h5ObVaSoRuZwj96eY6dCH1k+EbAWSHegp3UU=; b=OHG1Y0Lg13VT9vQi/XlMqry4AJFpyzbv+ukhlFckdjn7RkWdTD9IwoGhBE3Z0CmCcLuMzk oBuNKa7Lcm8oJDWUau25roWrJvT+itWbuL8aUmAe+CjxiNMD1Cb/8WbP9UlMjkIbeJT1u5 L3a0+B8hgakeD8zUFrJzYYhrtIRDh90= X-MC-Unique: Nf5lrhOKOJy-MzMEad0yvA-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , Maksim Davydov Subject: [PULL 4/7] python/qmp: increase read buffer size Date: Tue, 24 Jan 2023 21:34:42 -0500 Message-Id: <20230125023445.3655253-5-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614198653100001 Content-Type: text/plain; charset="utf-8" From: Maksim Davydov Current 256KB is not enough for some real cases. As a possible solution limit can be chosen to be the same as libvirt (10MB) Signed-off-by: Maksim Davydov Reviewed-by: John Snow Message-id: 20230112152805.33109-3-davydov-max@yandex-team.ru Signed-off-by: John Snow --- python/qemu/qmp/qmp_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/qemu/qmp/qmp_client.py b/python/qemu/qmp/qmp_client.py index 5dcda04a756..b5772e7f32b 100644 --- a/python/qemu/qmp/qmp_client.py +++ b/python/qemu/qmp/qmp_client.py @@ -197,8 +197,8 @@ async def run(self, address=3D'/tmp/qemu.socket'): #: Logger object used for debugging messages. logger =3D logging.getLogger(__name__) =20 - # Read buffer limit; large enough to accept query-qmp-schema - _limit =3D (256 * 1024) + # Read buffer limit; 10MB like libvirt default + _limit =3D (10 * 1024 * 1024) =20 # Type alias for pending execute() result items _PendingT =3D Union[Message, ExecInterruptedError] --=20 2.39.0 From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614182; cv=none; d=zohomail.com; s=zohoarc; b=NUv58WmrlQiGjT0J5LAuwNqSAbRnlajl3YxIwKHKJj9O1SvBX3C8BUvjufXmKG7PIzEpkVU+22jln0zkR3dF49tYiHGFwqixuhH9ktv7SjS6n6zoKX1/60CStcZPoITY2Mrxy6QE11Yi9bYLFf006LpX2W7FdM6lf9xSsrt1qdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614182; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kh2UIVP0oDViKp1JJ8UeYAuwvNJ0YjmX6dknYE+RpOc=; b=fS943yPa1/ofHOc9vbiK6563kUPgHRbagEikxaY9i6BMRBLcq78PmGcPddDQXAAgTl893HdBQccK/6IAu9dEM9PcOXWu5HwqmxhULUO7GxVxCqvy7B81eZZrEBLVGUvjXbdFV0oJrnK6CwLuboNZO7KjeRwzNq1nUlVP3+b4jBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614182448117.56512807940328; Tue, 24 Jan 2023 18:36:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcq-0008It-2p; Tue, 24 Jan 2023 21:35:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcm-0008F3-UM for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVck-0005MH-K6 for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:56 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-xFSe0r5XN-uxftm8OrUxXg-1; Tue, 24 Jan 2023 21:34:50 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B79F802BF5; Wed, 25 Jan 2023 02:34:50 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 831182026D4B; Wed, 25 Jan 2023 02:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614094; 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=Kh2UIVP0oDViKp1JJ8UeYAuwvNJ0YjmX6dknYE+RpOc=; b=Tw9pOOO2uCfqKdt3PSjNLVqVgKCCcb9C/q5e68Vuc2rU7EDaGVgil5naB9G1mb9ZtcBSdL c9OeNEeLSYip/7TptVwSzYh9GgnDtR3M/9yW0lISN+LtyeVq2ceKFlFy95iIWkQ/NCB3nl hLk9isGxMO1x9fj3qPApMpOpn6Y/N7g= X-MC-Unique: xFSe0r5XN-uxftm8OrUxXg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 5/7] python/qmp/protocol: add open_with_socket() Date: Tue, 24 Jan 2023 21:34:43 -0500 Message-Id: <20230125023445.3655253-6-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614184614100003 From: Marc-Andr=C3=A9 Lureau Instead of listening for incoming connections with a SocketAddr, add a new method open_with_socket() that accepts an existing socket. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230111080101.969151-2-marcandre.lureau@redhat.com Signed-off-by: John Snow --- python/qemu/qmp/protocol.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py index 15909b7dbad..6d3d739daa7 100644 --- a/python/qemu/qmp/protocol.py +++ b/python/qemu/qmp/protocol.py @@ -18,6 +18,7 @@ from enum import Enum from functools import wraps import logging +import socket from ssl import SSLContext from typing import ( Any, @@ -296,6 +297,19 @@ async def start_server_and_accept( await self.accept() assert self.runstate =3D=3D Runstate.RUNNING =20 + @upper_half + @require(Runstate.IDLE) + async def open_with_socket(self, sock: socket.socket) -> None: + """ + Start connection with given socket. + + :param sock: A socket. + + :raise StateError: When the `Runstate` is not `IDLE`. + """ + self._reader, self._writer =3D await asyncio.open_connection(sock= =3Dsock) + self._set_state(Runstate.CONNECTING) + @upper_half @require(Runstate.IDLE) async def start_server(self, address: SocketAddrT, @@ -343,11 +357,12 @@ async def accept(self) -> None: protocol-level failure occurs while establishing a new session, the wrapped error may also be an `QMPError`. """ - if self._accepted is None: - raise QMPError("Cannot call accept() before start_server().") - await self._session_guard( - self._do_accept(), - 'Failed to establish connection') + if not self._reader: + if self._accepted is None: + raise QMPError("Cannot call accept() before start_server()= .") + await self._session_guard( + self._do_accept(), + 'Failed to establish connection') await self._session_guard( self._establish_session(), 'Failed to establish session') --=20 2.39.0 From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614170; cv=none; d=zohomail.com; s=zohoarc; b=NbooMDzpobAN6IX1l4jcKMt+iv2pj6ln1BVdMQbWYRvu+6X7GzlwsCcZFGbKycKW3Aia7u9W7CTgg8ee2lfJZ45Mb+A5vgDmayiykek8PS2fREOThx/0HRDZzItT+kbz3tRcX/YB8gImbXlAZ83bS4a3N8uq4vhOselbuUmS6EQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z9dp3+ElD0q8oYIQuI82XS22mPRKhj2bG1quexdZNrs=; b=h8GvpLy0XbwidZrq47zNBIpAyBFBFMzZxTd1yZoNjOrINtNpgf2mIsiNi3VhKAC437hpJW2w6lx1Jy6JNYpXivawprkNz1SLql6YP2qyJR8h05yLaJahzGtqgsB59WmNM7KU220ctnAoLHRvCWsYV3QzYfTZ3tvsH/Tbf5/jAPs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614170187586.3013197945917; Tue, 24 Jan 2023 18:36:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcp-0008Ie-No; Tue, 24 Jan 2023 21:34:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVco-0008H3-0o for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcl-0005Me-Bi for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:57 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-266-qzZVAyzlNLq3efhTVCDVTA-1; Tue, 24 Jan 2023 21:34:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0AD61C04B67; Wed, 25 Jan 2023 02:34:50 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A6A52026D4B; Wed, 25 Jan 2023 02:34:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614094; 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=z9dp3+ElD0q8oYIQuI82XS22mPRKhj2bG1quexdZNrs=; b=Ddlx0qFGEE7WLUCH9ogi8GOEPpjeR29RdpFNK3S5U+g0Z4JDRW6yZSG0OZxIX+o3VGMabR mzhxiRT5HHdA1KlKqpgSMMmmLhuVdCjJgKxcavE5CRQazsCLkcrG7/QcaNjAU7E8M+aD0z z9DABTf8++/bqQUAiYkWZoNnIZqekL4= X-MC-Unique: qzZVAyzlNLq3efhTVCDVTA-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 6/7] python/qmp/legacy: make QEMUMonitorProtocol accept a socket Date: Tue, 24 Jan 2023 21:34:44 -0500 Message-Id: <20230125023445.3655253-7-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614170570100001 From: Marc-Andr=C3=A9 Lureau Teach QEMUMonitorProtocol to accept an exisiting socket. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230111080101.969151-3-marcandre.lureau@redhat.com Signed-off-by: John Snow --- python/qemu/qmp/legacy.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py index 1951754455a..8b09ee7dbb5 100644 --- a/python/qemu/qmp/legacy.py +++ b/python/qemu/qmp/legacy.py @@ -22,6 +22,7 @@ # =20 import asyncio +import socket from types import TracebackType from typing import ( Any, @@ -69,22 +70,32 @@ class QEMUMonitorProtocol: =20 :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 + connection or None + :param sock: a socket or None :param server: Act as the socket server. (See 'accept') :param nickname: Optional nickname used for logging. """ =20 - def __init__(self, address: SocketAddrT, + def __init__(self, + address: Optional[SocketAddrT] =3D None, + sock: Optional[socket.socket] =3D None, server: bool =3D False, nickname: Optional[str] =3D None): =20 + assert address or sock self._qmp =3D QMPClient(nickname) self._aloop =3D asyncio.get_event_loop() self._address =3D address + self._sock =3D sock self._timeout: Optional[float] =3D None =20 if server: - self._sync(self._qmp.start_server(self._address)) + if sock: + assert self._sock is not None + self._sync(self._qmp.open_with_socket(self._sock)) + else: + assert self._address is not None + self._sync(self._qmp.start_server(self._address)) =20 _T =3D TypeVar('_T') =20 @@ -139,6 +150,7 @@ def connect(self, negotiate: bool =3D True) -> Optional= [QMPMessage]: :return: QMP greeting dict, or None if negotiate is false :raise ConnectError: on connection errors """ + assert self._address is not None self._qmp.await_greeting =3D negotiate self._qmp.negotiate =3D negotiate =20 --=20 2.39.0 From nobody Fri Apr 26 04:17:53 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674614204; cv=none; d=zohomail.com; s=zohoarc; b=OwMsJuNl0NQYjWWGB3RUYXLSvpqBHq5cBDatVaBkaKx+mN1gReZb5NDKeSr17XFL7pvGdGbK1PhoIcmOG2BvbSKV0+4bINwc4qAJo12r6dSV5h8/jUqF/JO8Ti4c9tZGnkiQEBFoBFIN70/lXAApa1AhAPGo3aHAZVTh3VALu44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614204; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eFgFFOfo5jZZDru0T2DPfy03Qokj9J7YN68vjcMzOgs=; b=QhvzXODrzdhRngv0v2Et7IGm1bgkzJHEbtOI0i9QDEuzYBnFyR2b/TvaJjGJubGATARopCMZ5/vjgdzmOwT6XarcLMXnI2gA+c+h9MBLmHIXKoftST1Rl13nHgVzrV60XkOEQmu673TWc63g5MyiFP+YAwTZYAFUsi3eWy6VgSw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674614204032915.5781906516453; Tue, 24 Jan 2023 18:36:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVcs-0008ME-MA; Tue, 24 Jan 2023 21:35:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVco-0008HA-7k for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKVcl-0005Mv-Oe for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:34:57 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-cwMJIGBEP5auXKucFyLIpg-1; Tue, 24 Jan 2023 21:34:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 57FC21869B12; Wed, 25 Jan 2023 02:34:51 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.16.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0F052026D4B; Wed, 25 Jan 2023 02:34:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674614095; 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=eFgFFOfo5jZZDru0T2DPfy03Qokj9J7YN68vjcMzOgs=; b=QDHAZUvvxzYQyS3c1q5EQBY4Cb5hmxWAWlDP3rvVq4lPIa242B3wQ9pyDA+48xq/Ta2tr7 2B4cdnZYDAZcA/wcMPQmFsTY8KnQE0gDyzVIg2HIf2MTE3Tyk5pAoQFyroVTeGWSj9vcTN 3yUXLuNGxpb3j/KCO0uzma6BA3GhTSw= X-MC-Unique: cwMJIGBEP5auXKucFyLIpg-1 From: John Snow To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Wainer dos Santos Moschetta , Eduardo Habkost , John Snow , Hanna Reitz , qemu-block@nongnu.org, Cleber Rosa , Vladimir Sementsov-Ogievskiy , Beraldo Leal , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 7/7] python/qemu/machine: use socketpair() for QMP by default Date: Tue, 24 Jan 2023 21:34:45 -0500 Message-Id: <20230125023445.3655253-8-jsnow@redhat.com> In-Reply-To: <20230125023445.3655253-1-jsnow@redhat.com> References: <20230125023445.3655253-1-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674614204684100001 From: Marc-Andr=C3=A9 Lureau When no monitor address is given, establish the QMP communication through a socketpair() (API is also supported on Windows since Python 3.5) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20230111080101.969151-4-marcandre.lureau@redhat.com [Resolved conflicts, fixed typing error. --js] Signed-off-by: John Snow --- python/qemu/machine/machine.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index a71d87ead40..e57c2544842 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -158,17 +158,13 @@ def __init__(self, self._qmp_timer =3D qmp_timer =20 self._name =3D name or f"{id(self):x}" + self._sock_pair: Optional[Tuple[socket.socket, socket.socket]] =3D= None self._temp_dir: Optional[str] =3D None self._base_temp_dir =3D base_temp_dir self._sock_dir =3D sock_dir self._log_dir =3D log_dir =20 - if monitor_address is not None: - self._monitor_address =3D monitor_address - else: - self._monitor_address =3D os.path.join( - self.sock_dir, f"{self._name}.qmp" - ) + self._monitor_address =3D monitor_address =20 self._console_log_path =3D console_log if self._console_log_path: @@ -303,7 +299,11 @@ def _base_args(self) -> List[str]: args =3D ['-display', 'none', '-vga', 'none'] =20 if self._qmp_set: - if isinstance(self._monitor_address, tuple): + if self._sock_pair: + fd =3D self._sock_pair[0].fileno() + os.set_inheritable(fd, True) + moncdev =3D f"socket,id=3Dmon,fd=3D{fd}" + elif isinstance(self._monitor_address, tuple): moncdev =3D "socket,id=3Dmon,host=3D{},port=3D{}".format( *self._monitor_address ) @@ -337,10 +337,17 @@ def _pre_launch(self) -> None: self._remove_files.append(self._console_address) =20 if self._qmp_set: + monitor_address =3D None + sock =3D None + if self._monitor_address is None: + self._sock_pair =3D socket.socketpair() + sock =3D self._sock_pair[1] if isinstance(self._monitor_address, str): self._remove_files.append(self._monitor_address) + monitor_address =3D self._monitor_address self._qmp_connection =3D QEMUMonitorProtocol( - self._monitor_address, + address=3Dmonitor_address, + sock=3Dsock, server=3DTrue, nickname=3Dself._name ) @@ -360,6 +367,8 @@ def _pre_launch(self) -> None: )) =20 def _post_launch(self) -> None: + if self._sock_pair: + self._sock_pair[0].close() if self._qmp_connection: self._qmp.accept(self._qmp_timer) =20 --=20 2.39.0