From nobody Mon Feb 9 16:13:00 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 1637635257334388.00213694256104; Mon, 22 Nov 2021 18:40:57 -0800 (PST) Received: from localhost ([::1]:35708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpLjr-00018R-3v for importer@patchew.org; Mon, 22 Nov 2021 21:40:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpLhQ-00050e-25 for qemu-devel@nongnu.org; Mon, 22 Nov 2021 21:38:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpLhN-0006BK-KR for qemu-devel@nongnu.org; Mon, 22 Nov 2021 21:38:23 -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-275-UzCaAhqUMceCPifI7Gg9iA-1; Mon, 22 Nov 2021 21:38:17 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 747AA8066EC; Tue, 23 Nov 2021 02:38:16 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.32.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A63564188; Tue, 23 Nov 2021 02:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637635101; 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=PWsqW3Q4twvuXt/vTrLGmfjEypIknSpoksPOB4JxVGU=; b=VIcL8zFQ3lT6yeOCmRJm6wREZi9mZbHkedKcdnDcAgohkzx6zoeDcbZ0idNX9r1ePZxM1M C5fcLVgawhKCREZnKRglAT70VeS8X55T3Rh0kQ1BoEcMqv9p5fWr8iri5IGCNtmKnBPArY yMEebLCRU7qgSMPimsa2F+mV7UfgB9U= X-MC-Unique: UzCaAhqUMceCPifI7Gg9iA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PULL 1/7] python/machine: add @sock_dir property Date: Mon, 22 Nov 2021 21:37:59 -0500 Message-Id: <20211123023805.2745382-2-jsnow@redhat.com> In-Reply-To: <20211123023805.2745382-1-jsnow@redhat.com> References: <20211123023805.2745382-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.709, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , Thomas Huth , Vladimir Sementsov-Ogievskiy , Daniel Berrange , Eduardo Habkost , qemu-block@nongnu.org, John Snow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Markus Armbruster , Willian Rampazzo , Hanna Reitz , Cleber Rosa , =?UTF-8?q?Alex=20Benn=C3=A9e?= 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: 1637635258754100001 Content-Type: text/plain; charset="utf-8" Analogous to temp_dir and log_dir, add a sock_dir property that defaults to @temp_dir -- instead of base_temp_dir -- when the user hasn't overridden the sock dir value in the initializer. This gives us a much more unique directory to put sockfiles in by default. Signed-off-by: John Snow Reviewed-by: Willian Rampazzo Message-id: 20211118204620.1897674-2-jsnow@redhat.com Signed-off-by: John Snow --- python/qemu/machine/machine.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index a487c39745..b1dd77b538 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -134,8 +134,9 @@ def __init__(self, self._qmp_timer =3D qmp_timer =20 self._name =3D name or "qemu-%d" % os.getpid() + self._temp_dir: Optional[str] =3D None self._base_temp_dir =3D base_temp_dir - self._sock_dir =3D sock_dir or self._base_temp_dir + self._sock_dir =3D sock_dir self._log_dir =3D log_dir =20 if monitor_address is not None: @@ -143,7 +144,7 @@ def __init__(self, self._remove_monitor_sockfile =3D False else: self._monitor_address =3D os.path.join( - self._sock_dir, f"{self._name}-monitor.sock" + self.sock_dir, f"{self._name}-monitor.sock" ) self._remove_monitor_sockfile =3D True =20 @@ -163,14 +164,13 @@ def __init__(self, self._qmp_set =3D True # Enable QMP monitor by default. self._qmp_connection: Optional[QEMUMonitorProtocol] =3D None self._qemu_full_args: Tuple[str, ...] =3D () - self._temp_dir: Optional[str] =3D None self._launched =3D False self._machine: Optional[str] =3D None self._console_index =3D 0 self._console_set =3D False self._console_device_type: Optional[str] =3D None self._console_address =3D os.path.join( - self._sock_dir, f"{self._name}-console.sock" + self.sock_dir, f"{self._name}-console.sock" ) self._console_socket: Optional[socket.socket] =3D None self._remove_files: List[str] =3D [] @@ -816,6 +816,15 @@ def temp_dir(self) -> str: dir=3Dself._base_temp_dir) return self._temp_dir =20 + @property + def sock_dir(self) -> str: + """ + Returns the directory used for sockfiles by this machine. + """ + if self._sock_dir: + return self._sock_dir + return self.temp_dir + @property def log_dir(self) -> str: """ --=20 2.31.1