From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791289859; cv=none; d=zohomail.com; s=zohoarc; b=FyNIglJug3R4DMZeIv6NWZsFCxE7kZuE8n5eq26lwEmlKRW1z0riqVIwKiN5REZpsGGRHDR4jMUo5YT+WsPsOC4JuKcu6quv9iV4B3SVUCJvdoiHOTlGn1xvQ9du2IpLvmEBUOFFsWYu0RHTjQblya591toD90RaWOdrRvMhiro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791289859; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=w11CWLogoPG2gKLbMheXWdxEMIyhNTPG/AhgnHc/BiM=; b=FjZ77DDYUlL9fnytQ6ZO67HXXaJESAwc3mX68da/BAzygmvXESz4si/GURo2GvBXTn9AF3kZyW98F7G4zJN47VNTj/Zi7XP1F20rpshjman0vWFkoOhUOFbZY8UDiKImRyH1OVu3JV4vUltdIMgIa3F548hxrM9on6liGhdEFYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 17912898598074.711488533932879; Tue, 6 Oct 2026 05:30:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7EC5141B05; Tue, 6 Oct 2026 08:30:57 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A86AD41B48; Tue, 6 Oct 2026 08:28:49 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1D87341830; Tue, 6 Oct 2026 08:28:39 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A47424187A for ; Tue, 6 Oct 2026 08:28:32 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-_fh1MclCOje8cGxJFwR41A-1; Tue, 06 Oct 2026 08:28:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CBD5F1830919 for ; Tue, 6 Oct 2026 12:28:27 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A3B3830000E3; Tue, 6 Oct 2026 12:28:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289712; 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=w11CWLogoPG2gKLbMheXWdxEMIyhNTPG/AhgnHc/BiM=; b=TucC0uo/Qe2j4YMclymxuvmVBpr99oSJAFtQbLHxyXFPQTgocqWyzZ4YKVEyyb+FFzAVcm 6z/aQYfEF/y1f5Nr08s8gSvkcH+sqN6x9QelQp34n0KqWNYNPhoodCQFL5hEgScPhUe3xr +siAc70pfLONPec+aTFt0Tbw7ekQe0M= X-MC-Unique: _fh1MclCOje8cGxJFwR41A-1 X-Mimecast-MFC-AGG-ID: _fh1MclCOje8cGxJFwR41A_1791289708 Date: Tue, 06 Oct 2026 16:28:17 +0400 Subject: [PATCH 1/7] Add .b4-config MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-1-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=913; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=WjVor6aHj0viXVoiZwUGzJ+zcEyHxOratQlsVaihfvk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqxOljNGEQS7vDYMImEvsY7B0CpdxG/keyzplE/ trHO5NmhyuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCasTpYwAKCRDa6OEJdZac 5bi9EACiNFMcJhCQ6xLXRsjLb04LrrRf8Hyj5xqN63kCaQi0rHQIhHl06KUCBytrcKkXu7Mz/FV D+U1LheMn7Okezwym89trV0wL6y0F++G8qh5ZgWCTiSs4l5CIpt9+5fwKXEiuo0CNlLRV2Yvual 7bQCLrkuqZbHmg+BA29rS7GjfJyYL7lycUaEoev0aKLyC8Yj6t3u91FJ2HmZ8eGYJ3Wmcqh+i9t mdP2ihLBRJIaVuGnEJvw4yzp1bKhw5Ip4WHXAX7f2/H2alZ39Mz/vL68BrjMhNJzr9HmzErrA8t CzHEu01dt1/z8ZvjOersWaKF8hHtczy4/SIY6pcTE8J6GHMrPq7A4SgapCIDogexwR3OVuuNATt VtVTpfSgVQPkijNc71Jf+0RwAsxH3UrWEquUODKlGeSRJnpJUZ+XSh/8gyUSCrhWgzgHZDV1XiB XlrV07p44CvtRW0tyPmxuBb8ITV74aXUjiRT4jpNZz8PhZBzlbD9XkJUNPveezcWwzGbqM8vi4O x6mFMWkB51O6FHyTvARqBFyMGS4oVxPgn3Yd0Pz1z5vUzeLZu7JiJ34dTvPeTdmMA1sF6LVJzQn yXfgaYHJOGXyRCvhil26EzZNGmBI7Zeod1YpZOqgcr3STkTnarieFLEgmtpAR1j7yPt3B/vgXZ/ dFiLLKQh8PF5vYg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: r5psGKB6RkhU0CDCeL4xeF9hVIOBm9vapktOuOpiB6Q_1791289708 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CXPGDFODWWEBXOTVHXWW7L4H7P3EM4A2 X-Message-ID-Hash: CXPGDFODWWEBXOTVHXWW7L4H7P3EM4A2 X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791289864731158500 B4 is a tool created to make it easier for project developers and maintainers to use a distributed development workflow that relies on patches and distribution lists for code contributions and review. With this config, it can be used as a git-publish alternative to easily send and manage patch series. Signed-off-by: Marc-Andr=C3=A9 Lureau --- .b4-config | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.b4-config b/.b4-config new file mode 100644 index 000000000000..00c442650543 --- /dev/null +++ b/.b4-config @@ -0,0 +1,9 @@ +# +# b4 settings for submitting patches to libvirt upstream. +# https://b4.docs.kernel.org/ +# +[b4] + send-series-to =3D devel@lists.libvirt.org + send-auto-to-cmd =3D + send-auto-cc-cmd =3D + linkmask =3D https://lists.libvirt.org/archives/list/devel@lists.libvirt= .org/message/%s --=20 2.56.0.rc0.29.g47ce80527c56 From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791289941; cv=none; d=zohomail.com; s=zohoarc; b=QYtXx2DkC++O0agVBBCBB6+/h3ex3F6MZ/tRp9kc9IQ+oEtsODEkZi8rIC+3Aak4V06x1nO/hUb8Yo5X9YE016Jm4KoyFzCogjmCzlW1KwfvAo9voYGGM9PSp2Y4PtT57PrVvRWmdkrFOK6opUlpayTW/ggmFkwG6+HFvZH5Yww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791289941; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=kRdLusvtCQEnMosnL7ew7lq8BwbmiWfoZg1MAym7Xpw=; b=VQSnORZBrXbdQq3Kre8LEYDY43pGSXvpcIve6DwrTt4OAVRnF8O4fzQgdyMIB/gP6PxPfyCCTTCSM+Us/IQ2kRxeqLdRWqo/O6t+R7XtTl/6ONGvYMQjxnL9DuWoWBRgPUE+NPU0bnk+qRUd6M7ex6DBqWDMlKyyx6KlNzRgLGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1791289941794382.172503924833; Tue, 6 Oct 2026 05:32:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D70374198F; Tue, 6 Oct 2026 08:32:19 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 76EA641B77; Tue, 6 Oct 2026 08:29:06 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 31FC041967; Tue, 6 Oct 2026 08:28:49 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 038E541938 for ; Tue, 6 Oct 2026 08:28:33 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-Wy1ZafVaPQ-bCEq4sMKa2g-1; Tue, 06 Oct 2026 08:28:32 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 65EEE1944D11 for ; Tue, 6 Oct 2026 12:28:31 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 757AA1956042; Tue, 6 Oct 2026 12:28:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289713; 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=kRdLusvtCQEnMosnL7ew7lq8BwbmiWfoZg1MAym7Xpw=; b=Z9aONRDtZHFtRgLwklOEz7ZacKg/SMNOxW8IfMO+tlBVaa6LBq9F2fGS2JcV9gMBmjvCEM BjOkTrjb/2R0ErIvhAk8pbt+PNO5jjoYB+jDG5HmmPd2j3eiwrjobEDXEedcQdCzV3zyvf yOX3FBfjtwnUzxz9Q2YYoCQcy8ugBRM= X-MC-Unique: Wy1ZafVaPQ-bCEq4sMKa2g-1 X-Mimecast-MFC-AGG-ID: Wy1ZafVaPQ-bCEq4sMKa2g_1791289711 Date: Tue, 06 Oct 2026 16:28:18 +0400 Subject: [PATCH 2/7] util: extract virHookCheckDir from virHookCheck MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-2-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2618; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=7VQGywDqLFyg6244GeCD5H1jagVoxOJ9j/sORZqfMlw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqxOlk1OHdmCuUmfADQj8X5QCUi3oIZDznIiagD tRBcqWsnR2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCasTpZAAKCRDa6OEJdZac 5bRUD/9KNN6RW0OXdl2lmiJZ8HjZ6mCtfhOKbgGgL0/EGG+6UonUHm3baHGVZZ5a0+Mjc/mL72g a6kZqaTGBuppml6J+OwVJdtUvrwQ/CfCga+TnBlfsQy7FeHU46s9sScuFi0N40psQWWD69DLdD3 IhwqIuRSpmelGhusLnDziInmM8lyjn0GO2zV70hvKeROJ0yLTawVPnuWvC3imNJ5BsDMbioIXc0 wyNRR+H5DMc95kqA1vmyek+WrihTXS0uFLmA5F8+K5GKDxlLEUpEjDWVHQMg/W1h1RlHvjDqWnJ GQzaCY7d1tsMyb9akyCwV7YGDUvcJjAXokW8f9vclDsaCDrAzXpLHzgL5zxe1ZNbSjNm5JZ1ku2 Ja2dBv1Pv0c+DvOW7CyNapuxvY6xcHEKg+chOSDkNxgkIegm0+NowQGLQ0raB2pki0mNoj8Y4gW aN7IqPMEvNs9gYgqA5iam1QLUKkF7ywnqJg7wXWpIhVuxAYEOkDDa3rn4SeKkEYZxlZZxCy76v6 ouZoVhjMo9gfjE9Qeu8DpJ3Y5u1qFBEp3rlsuW54AHfnWAnZmmbOoI6s9dBioPDBwOAFjzxI0j+ +WiV2qtOlXV6lphGucTaPw67dhYHhPtJWZiBU+ZlPY3uft249nDHO9K2aAgOpI+bF0Jhzb7rPSZ uhlgMJzWRkcYFeg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JCYW8smp-UP19U5mMp-Dtos7wGIcNmB5ct9BwtW4w9o_1791289711 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TSBZNIMWZRTAPZEWSRUOD5LAAXYKHF4S X-Message-ID-Hash: TSBZNIMWZRTAPZEWSRUOD5LAAXYKHF4S X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791289945288158500 Extract the per-directory hook checking logic into a new virHookCheckDir() helper function, separating it from the input validation done in virHookCheck(). This prepares for supporting multiple hook directories by making virHookCheckDir() reusable per directory. No functional change. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virhook.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/util/virhook.c b/src/util/virhook.c index d012bb182576..9cbe55faa03e 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -129,17 +129,17 @@ VIR_ENUM_IMPL(virHookBhyveOp, static int virHooksFound =3D -1; =20 /** - * virHookCheck: + * virHookCheckDir: + * @hook_dir: the directory to check for hooks * @driver: the driver name "daemon", "qemu", "lxc"... * - * Check is there is an installed hook for the given driver, if this - * is the case register it. Then subsequent calls to virHookCall - * will call the hook if found. + * Check if there is an installed hook for the given driver in the + * specified directory. * * Returns 1 if found, 0 if not found, and -1 in case of error */ static int -virHookCheck(int no, const char *driver) +virHookCheckDir(const char *hook_dir, const char *driver) { int ret; g_autoptr(DIR) dir =3D NULL; @@ -147,13 +147,7 @@ virHookCheck(int no, const char *driver) g_autofree char *path =3D NULL; g_autofree char *dir_path =3D NULL; =20 - if (driver =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid hook name for #%1$d"), no); - return -1; - } - - path =3D g_build_filename(LIBVIRT_HOOK_DIR, driver, NULL); + path =3D g_build_filename(hook_dir, driver, NULL); =20 if (!virFileExists(path)) { VIR_DEBUG("No hook script %s", path); @@ -196,6 +190,27 @@ virHookCheck(int no, const char *driver) return ret; } =20 +/** + * virHookCheck: + * @no: the driver number + * @driver: the driver name "daemon", "qemu", "lxc"... + * + * Check if there is an installed hook for the given driver. + * + * Returns 1 if found, 0 if not found, and -1 in case of error + */ +static int +virHookCheck(int no, const char *driver) +{ + if (driver =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid hook name for #%1$d"), no); + return -1; + } + + return virHookCheckDir(LIBVIRT_HOOK_DIR, driver); +} + /* * virHookInitialize: * --=20 2.56.0.rc0.29.g47ce80527c56 From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791290050; cv=none; d=zohomail.com; s=zohoarc; b=chWHFWC2vNp7GTnIgNdrdXy3Y7jUdlEuqnup8nehlkkkkhMIdT9tk1BwbZg/IU1iHN8WfT0Aa7HzsQWnI1tAjjhblldjqNf5M5XleoAz6mpaE2Z8zvwR58sePH7tvJ99dForCzerXefoctupEmxuaBTaTmtqYjorPGgcgAmrOgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791290050; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=TvnWrB+pJkHRoR4WDcvWbP7SYJrNMfIo7grx6um1Xd8=; b=FbcQb75z0vzx7NPq/FAEFC2IHoBUnspeC7BrhsyO6wUUc6jPfbmrb8vJJDGt0tupPXtP2sKpe/44N4axZFwFaXNjpl0QFYNeYFkNXyyDIgzNolWOIG7X/Gfgs0ugrdpmCgFN/2jAfwksSwlkbRu8NAfegtz3KaKhnkBrSg2pdwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1791290050386204.16865226421487; Tue, 6 Oct 2026 05:34:10 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id EE4FF4198A; Tue, 6 Oct 2026 08:34:08 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 01F5E41C12; Tue, 6 Oct 2026 08:29:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 29B31419A9; Tue, 6 Oct 2026 08:29:50 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A708041882 for ; Tue, 6 Oct 2026 08:28:37 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-196-r13XGe0cP7iN5C7SwppWXg-1; Tue, 06 Oct 2026 08:28:35 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C1EC81805A22 for ; Tue, 6 Oct 2026 12:28:34 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CAD4E19560AB; Tue, 6 Oct 2026 12:28:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289716; 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=TvnWrB+pJkHRoR4WDcvWbP7SYJrNMfIo7grx6um1Xd8=; b=P466NoO1RHZkS5Q8OKZiF76XWqXuHaKrxEydY9lf7Xc8rrUNet7bH9NPAy1Sfmjzzw3VOW Kqodux+m1ZW8AWJwXbFmo3kd5yZq0oH+rV9dVWzhUFqDanfDhEEOc2wrZ72D3yBxHInT/V VbJduDhsyQX810KXr6O11Y6gRA1xHhw= X-MC-Unique: r13XGe0cP7iN5C7SwppWXg-1 X-Mimecast-MFC-AGG-ID: r13XGe0cP7iN5C7SwppWXg_1791289714 Date: Tue, 06 Oct 2026 16:28:19 +0400 Subject: [PATCH 3/7] util: handle EACCES when opening hook directories MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-3-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1452; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+aDcPXXJ61izmBY52dFE+cIIEjHEnwh09WzASoGg9SA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqxOlkywj+/F0e6AAEXzjXJhjfEmWbqxUOGupH3 9iSo8o/5ICJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCasTpZAAKCRDa6OEJdZac 5dMHEAClv4tztfCmownt0cy0SjyPXQ262KsVIfDcpH3BtC05TXiKxkxTIO6RUqKDIlytVZh/QFg OIkE511RbheBMqxG9BAyYQ//Gtf1LY6G29oXkOQ2DE9HJdCtGk7JhyZOOReyTJDzmfO9qG7Du59 7K4M0IfNFBLEPGwaKltjpmUpb73wmvhuzpSSiJVVKKhO+6ieQfYnsvTXeHwlV6DmZ/cvGu0V9Sk ftaB8WmsBJWFZx3g6pcTWONQvuMMV9X69hsYvWzENHv6F9v4iFZkZIxts1jANpLVJfSGtx84XJa +DnZYBHWJlmACEU/fad0FeO0u3wkfZO2C+4MrkUyWhPEwnARkcLoYbRGLw1saNke6kNs4UdA7My So2rmSSMwA56B5Otysa5QR4Jrek4szzEd9Mm3wDJVvyUdWJRr4FAXpCtw4jHIhGt54H80FCncQS qlFWh1cd2m9sk5XN4rTrZ/lrXZrRuP+3b/w2IBrSFJTFQtGhd5TnhvXOE0eUm5PIvDJjQFYxowR pOBNk+PDVSih/59Qusankb2A/SCd3LKDE5O/NPnt46BR7ObPCGBaYRD3mq8EWGwiKuvpIL/AWRB elRjEbFSX3agJK2u7IIoNiAE5JPeVr3nsrw7uRx2NxH1jRbMPXvYzEhPtzG/khqFmHhOcMnnZrl iTeuyQilqn/xidA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: P9HqUhi3hd3OIzO1PnOaiPkFyjnG-LEkaYOB5WUn1NU_1791289714 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HBUHMDXIX6LH22BMLF6TBNOXYJPQF5N7 X-Message-ID-Hash: HBUHMDXIX6LH22BMLF6TBNOXYJPQF5N7 X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791290052250158500 When running as a session (non-root) daemon, system hook directories (/etc/libvirt/hooks/.d/) may not be readable by the user, causing EACCES errors that abort hook execution. Switch from virDirOpenIfExists() to virDirOpenQuiet() in virHookCheckDir() and handle both ENOENT and EACCES gracefully by skipping inaccessible directories instead of failing. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virhook.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/util/virhook.c b/src/util/virhook.c index 9cbe55faa03e..bd206f8cf1c2 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -165,12 +165,15 @@ virHookCheckDir(const char *hook_dir, const char *dri= ver) return 0; } =20 - if ((ret =3D virDirOpenIfExists(&dir, dir_path)) < 0) + if ((ret =3D virDirOpenQuiet(&dir, dir_path)) < 0) { + if (errno =3D=3D ENOENT || errno =3D=3D EACCES) { + VIR_DEBUG("Hook dir %s is not accessible: %s", + dir_path, g_strerror(errno)); + return 0; + } + virReportSystemError(errno, + _("cannot open directory '%1$s'"), dir_path); return -1; - - if (!ret) { - VIR_DEBUG("No hook script dir %s", dir_path); - return 0; } =20 while ((ret =3D virDirRead(dir, &entry, dir_path)) > 0) { --=20 2.56.0.rc0.29.g47ce80527c56 From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791290152; cv=none; d=zohomail.com; s=zohoarc; b=D6lkPqI5Os/FqylFceWgoafTukqjagqxA4XPnEUgfg4ODCgaHh6IVw6mS5vbisGP8+Ea7x2MGJ0b/R2jNE8e5H1eUT8W5ZL9rLI8QMYNzaf0m+56EWn7Ga4qCtCz2sLb6D9MEWZCgnIgFzbRsG8ay07w2+KSOxsQvBM17C8SSBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791290152; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=4BH0AyjpyXiHajGouFXmqtHUvGOQGBf3a+xfgdrkMNM=; b=Hb2RoCRyByc5BXb6NcIHJI8HYVlBiGDo/ebP7dR7Nxlcp3H6zH6uGk9vP+fjs5fpBZryPgEytYCo7fXkqALFutn8Q0KkKZNgNEkgGf5II9/PB5BjPvD4IwdGp82551spE15YPsTtCF1UvuhHE4++OJ5FkOku5p3zqGaAkNDgq20= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1791290152073969.7559447331545; Tue, 6 Oct 2026 05:35:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A412D41B55; Tue, 6 Oct 2026 08:35:49 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 14A9841C64; Tue, 6 Oct 2026 08:30:07 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 36F82419CD; Tue, 6 Oct 2026 08:29:50 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C4CBC4189E for ; Tue, 6 Oct 2026 08:28:40 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-W--o8IOaO06bgype8YSCZA-1; Tue, 6 Oct 2026 12:28:39 +0000 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 508361955D5B for ; Tue, 6 Oct 2026 12:28:38 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6E02C30000E3; Tue, 6 Oct 2026 12:28:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289720; 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=4BH0AyjpyXiHajGouFXmqtHUvGOQGBf3a+xfgdrkMNM=; b=TNRqYOsu7utRUfF9z+C776ZCKTBcOS5H+bwOj+nzWEwQW8b39Q8XHX1j7faqQzWFDihcM0 fgBsTkSXXE0GDt36K1ozhF+AH3XU8e14G89Syh7m4h2HBeXnzWmajceZJx6CngtTd2VkYm dnrIk2oTd2ujpvAoV8o09WXQc5NBADc= X-MC-Unique: W--o8IOaO06bgype8YSCZA-1 X-Mimecast-MFC-AGG-ID: W--o8IOaO06bgype8YSCZA_1791289718 Date: Tue, 06 Oct 2026 16:28:20 +0400 Subject: [PATCH 4/7] util: search hooks in both system and user directories MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-4-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=9192; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=J8gAsKS6GlV96O+kw3uSDBwGUww/ED/wMOMcYPth28w=; b=kA0DAAoB2ujhCXWWnOUByyZiAGrE6WTIQ7/vyeztLmcOzPvAlCfY0LcPC/LQ9YCzAkf4ea22Y IkCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJqxOlkAAoJENro4Ql1lpzlV6MQAJLL veRp7sSBqfffMVNf1byTYZ5i6eB3MWMCdyr7xjTziypiK7JPHrWRzMsQk5hUYWYgkE2uuehn0F6 jeTZfvL7jl7Z5XVj2p62IZRvVnRsNZ5RNnWdbPCVtTxG0xJ9xV2/+XWCO4DBQbgeYNkcFpnhD/S dSKtiWquzdwK+yd7Uh36q52Ud89/0o0louUeiCI4Ff3EzvSATI3QambXYg1sdWVh1p5ZJNkstnH klw9in6nbzVFnH+66QS0U+74qaQeoBdxbsbM2DIz47i7JZg+swTDpJEzROEsi4eS8jCInI43nPa Ntm4+/l9Kat6B4959wt0BqU+I+AR7e1Es7afazPMimfWKgVAoWu1GYsnhl9qh9d4VQ08MhEXIDG 8k5KKQyPlA7sQAVmOnW1N1yaC2L/UpDh6Gh19y3i/fSkpoAownNyg68+1e4tObP+R6fm60jMl4i ICFjI+zIlea3A0rxfeLRrewO6cMPzOGTn38yib7+rin+XhhG+L4R5/bCd/r0/E2gsCCSrYb1Hhk 29/+Ei1wAwOE9KLU4PukiziK2b/9UuoYfYUQwJv79arCRpNgvZ4b5jNgKaPPwR77HUw88ZtidJN +r81mUJIg5oVRo2rTsY/SWzM7GFBEDEkrM1cvYlvR/9c7HFMq5empYW1r5Gt4ckUl4fCKXWx50h tdtIC X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: d0wd9FlpmlR2T5-GI7_gGJF-YL0tyEqnqK0vy5TRnU0_1791289718 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ENXZR55KGVD4EW64TA5BDVU2B265EL63 X-Message-ID-Hash: ENXZR55KGVD4EW64TA5BDVU2B265EL63 X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791290152854158500 For non-root (session) daemons, hooks were previously only searched in /etc/libvirt/hooks. Add support for also searching in the user directory (~/.config/libvirt/hooks), with the system directory checked first. Introduce virHookGetDirs() which returns an ordered list of hook directories to search. Update virHookCheck() and virHookCall() to iterate over all directories, chaining hook output across them. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/util/virhook.c | 169 ++++++++++++++++++++++++++++++++++++-------------= ---- 1 file changed, 115 insertions(+), 54 deletions(-) diff --git a/src/util/virhook.c b/src/util/virhook.c index bd206f8cf1c2..f62ac902bb40 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -33,6 +33,7 @@ #include "vircommand.h" #include "virstring.h" #include "virglibutil.h" +#include "virutil.h" =20 #define VIR_FROM_THIS VIR_FROM_HOOK =20 @@ -40,6 +41,34 @@ VIR_LOG_INIT("util.hook"); =20 #define LIBVIRT_HOOK_DIR SYSCONFDIR "/libvirt/hooks" =20 + +/** + * virHookGetDirs: + * + * Returns a NULL-terminated array of hook directories to search, + * in priority order. For root, only /etc/libvirt/hooks is returned. + * For non-root users, both /etc/libvirt/hooks and + * ~/.config/libvirt/hooks are returned (system first, then user). + * + * The caller must free the result with g_strfreev(). + */ +static char ** +virHookGetDirs(void) +{ + g_autofree char *configdir =3D NULL; + GPtrArray *dirs =3D g_ptr_array_new(); + + g_ptr_array_add(dirs, g_strdup(LIBVIRT_HOOK_DIR)); + + if (geteuid() !=3D 0) { + configdir =3D virGetUserConfigDirectory(); + g_ptr_array_add(dirs, g_build_filename(configdir, "hooks", NULL)); + } + + g_ptr_array_add(dirs, NULL); + return (char **) g_ptr_array_free(dirs, FALSE); +} + VIR_ENUM_DECL(virHookDriver); VIR_ENUM_DECL(virHookDaemonOp); VIR_ENUM_DECL(virHookSubop); @@ -205,13 +234,22 @@ virHookCheckDir(const char *hook_dir, const char *dri= ver) static int virHookCheck(int no, const char *driver) { + g_auto(GStrv) hook_dirs =3D virHookGetDirs(); + size_t i; + if (driver =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid hook name for #%1$d"), no); return -1; } =20 - return virHookCheckDir(LIBVIRT_HOOK_DIR, driver); + for (i =3D 0; hook_dirs[i]; i++) { + int ret =3D virHookCheckDir(hook_dirs[i], driver); + if (ret !=3D 0) + return ret; + } + + return 0; } =20 /* @@ -332,11 +370,12 @@ virRunScript(const char *path, * allocated after successful virHookCall, and is best-effort allocated af= ter * failed virHookCall; the caller is responsible for freeing *output. * - * The script from LIBVIRT_HOOK_DIR is executed the first, followed by scr= ipts - * found under "$driver.d/" directory (sorted alphabetically. If output fr= om - * the hook script is expected, then the output produced by LIBVIRT_HOOK_D= IR - * script is fed as input to the first script from the "$driver.d/" direct= ory - * and its output is fed as input to the second and so on. + * For each hook directory (system /etc/libvirt/hooks first, then user + * ~/.config/libvirt/hooks for non-root), the main script is executed firs= t, + * followed by scripts found under "$driver.d/" directory (sorted + * alphabetically). If output from the hook script is expected, then the + * output produced by each script is fed as input to the next script and + * so on, chaining across directories. * * Returns: 0 if the execution succeeded, 1 if the script was not found or * invalid parameters, and -1 if script returned an error @@ -351,15 +390,11 @@ virHookCall(int driver, char **output) { int ret, script_ret; - g_autoptr(DIR) dir =3D NULL; - struct dirent *entry; - g_autofree char *path =3D NULL; - g_autofree char *dir_path =3D NULL; - g_autoptr(virGSListString) entries =3D NULL; + g_auto(GStrv) hook_dirs =3D NULL; const char *drvstr; const char *opstr; const char *subopstr; - GSList *next; + size_t i; =20 if (output) *output =3D NULL; @@ -416,60 +451,86 @@ virHookCall(int driver, if (extra =3D=3D NULL) extra =3D "-"; =20 - path =3D g_build_filename(LIBVIRT_HOOK_DIR, drvstr, NULL); + hook_dirs =3D virHookGetDirs(); =20 script_ret =3D 1; =20 - if (virFileIsExecutable(path)) { - script_ret =3D virRunScript(path, id, opstr, subopstr, extra, - input, output); - } + for (i =3D 0; hook_dirs[i]; i++) { + g_autofree char *path =3D NULL; + g_autofree char *dir_path =3D NULL; + g_autoptr(DIR) dir =3D NULL; + struct dirent *entry; + g_autoptr(virGSListString) entries =3D NULL; + GSList *next; =20 - dir_path =3D g_strdup_printf("%s.d", path); + path =3D g_build_filename(hook_dirs[i], drvstr, NULL); =20 - if ((ret =3D virDirOpenIfExists(&dir, dir_path)) < 0) - return -1; + if (virFileIsExecutable(path)) { + const char *cur_input; + int hook_ret; =20 - if (!ret) - return script_ret; + if (!script_ret && output && !virStringIsEmpty(*output)) + cur_input =3D *output; + else + cur_input =3D input; =20 - while ((ret =3D virDirRead(dir, &entry, dir_path)) > 0) { - g_autofree char *entry_path =3D g_build_filename(dir_path, - entry->d_name, - NULL); - if (!virFileIsExecutable(entry_path)) + hook_ret =3D virRunScript(path, id, opstr, subopstr, extra, + cur_input, output); + if (hook_ret < script_ret) + script_ret =3D hook_ret; + } + + dir_path =3D g_strdup_printf("%s.d", path); + + if ((ret =3D virDirOpenQuiet(&dir, dir_path)) < 0) { + if (errno =3D=3D ENOENT || errno =3D=3D EACCES) { + VIR_DEBUG("Hook dir %s is not accessible: %s", + dir_path, g_strerror(errno)); + continue; + } + virReportSystemError(errno, + _("cannot open directory '%1$s'"), dir_pa= th); + return -1; + } + + while ((ret =3D virDirRead(dir, &entry, dir_path)) > 0) { + g_autofree char *entry_path =3D g_build_filename(dir_path, + entry->d_name, + NULL); + if (!virFileIsExecutable(entry_path)) + continue; + + entries =3D g_slist_prepend(entries, g_steal_pointer(&entry_pa= th)); + } + + if (ret < 0) + return -1; + + if (!entries) continue; =20 - entries =3D g_slist_prepend(entries, g_steal_pointer(&entry_path)); - } + entries =3D g_slist_sort(entries, (GCompareFunc) strcmp); =20 - if (ret < 0) - return -1; + for (next =3D entries; next; next =3D next->next) { + int entry_ret; + const char *entry_input; + g_autofree char *entry_output =3D NULL; + const char *filename =3D next->data; =20 - if (!entries) - return script_ret; + /* Get input from previous output */ + entry_input =3D (!script_ret && output && + !virStringIsEmpty(*output)) ? *output : input; + entry_ret =3D virRunScript(filename, id, opstr, + subopstr, extra, entry_input, + (output) ? &entry_output : NULL); + if (entry_ret < script_ret) + script_ret =3D entry_ret; =20 - entries =3D g_slist_sort(entries, (GCompareFunc) strcmp); - - for (next =3D entries; next; next =3D next->next) { - int entry_ret; - const char *entry_input; - g_autofree char *entry_output =3D NULL; - const char *filename =3D next->data; - - /* Get input from previous output */ - entry_input =3D (!script_ret && output && - !virStringIsEmpty(*output)) ? *output : input; - entry_ret =3D virRunScript(filename, id, opstr, - subopstr, extra, entry_input, - (output) ? &entry_output : NULL); - if (entry_ret < script_ret) - script_ret =3D entry_ret; - - /* Replace output to new output from item */ - if (!entry_ret && output && !virStringIsEmpty(entry_output)) { - g_free(*output); - *output =3D g_steal_pointer(&entry_output); + /* Replace output to new output from item */ + if (!entry_ret && output && !virStringIsEmpty(entry_output)) { + g_free(*output); + *output =3D g_steal_pointer(&entry_output); + } } } =20 --=20 2.56.0.rc0.29.g47ce80527c56 From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791290216; cv=none; d=zohomail.com; s=zohoarc; b=YaG+hBnhkArWnKssrPDbR43TsAYCAj2eQq353kM/b5cd7PuJazuUyOcot7Q5sY0Uw8tWC9ombzPqu0eApZeagtbJeSDQ0HzIuA3piS51EXqdMbXhiPYI/qImwFkoHfdiE6d5Of1esWX2RXXujgNqkCYEuxtQJ7n7tUwVg0EQz2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791290216; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=ZlsIRqt6b9hmhBx0bJsUFdosvN3qWZf6ihyvwGJLrKk=; b=T3SIC86zFEr1Hd4R0RhdldD7OdKweQHGTcAt5V3lmhBx2YQoEnPM+MPATZfgRBCJPSg9LRLffLyxDdSTydS4MSSdYd1h1/2AzFYzPlv4EUFMxvCUKmIXiVv+rilnUTVsA2eRDiHZzp075r4vuhHjL02Y9RqaB+0pTnc2UgkFcro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1791290216457536.9432039515999; Tue, 6 Oct 2026 05:36:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 2A09F41BC3; Tue, 6 Oct 2026 08:36:54 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id EF4F241CD7; Tue, 6 Oct 2026 08:30:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8284E4185B; Tue, 6 Oct 2026 08:30:03 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DD81541903 for ; Tue, 6 Oct 2026 08:28:43 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-66ZFMZwZNgOR2-sxmg7oSg-1; Tue, 06 Oct 2026 08:28:42 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A8CC61955E9E for ; Tue, 6 Oct 2026 12:28:41 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ADCA01800595; Tue, 6 Oct 2026 12:28:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289723; 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=ZlsIRqt6b9hmhBx0bJsUFdosvN3qWZf6ihyvwGJLrKk=; b=fzUHk737+ZAXFwaqdYm4QpMmm+NmJUIuo/PBkVjCSUslNMyHJcppPfSRi6hKM7gWp+cL25 q4REacE9yGWkf2DqPaT9SFT9Sk1/aK9eMEC5QLkXG3sLwKFcv2imCfhiSS/UiNEUrZ37Bx V1qIFhwiK+V2lDxbmqHyXWvf1xwmdMY= X-MC-Unique: 66ZFMZwZNgOR2-sxmg7oSg-1 X-Mimecast-MFC-AGG-ID: 66ZFMZwZNgOR2-sxmg7oSg_1791289721 Date: Tue, 06 Oct 2026 16:28:21 +0400 Subject: [PATCH 5/7] util: add virHookSetSkipSystemHooks API MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-5-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=3600; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Px1bOStWpc9vDxQjAbsrPqJ1GDJ5yAW8XaqzDLaB1uI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqxOlkTBtMhXcUw0e0mW+HXrw22Cwf19kbbc3je BzFG8NO0NWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCasTpZAAKCRDa6OEJdZac 5fTmD/0SszkWtpkufEvCzj64uq4e0rqN9UunbnAA40e95Qdde3yauDOe26FsfJE+9h1FEN124fT NXTHgxqSRh9KPBQvqi7w1Rbh+crCsUe0/ZnlHcZRMlVIKS4TBscyjmHR+hHjtUwrUISpCKTteb3 voOMRRHX1zWHdR3fm+8MXedeX7jXV6Aek/EXNOT1djSWXjWu9oin4O7CHwC3L+gsdh6e7cYG9gz CA2ZrKNvNi6iIma/2MnkDwE2bgDsaSCPMi0fLkRhld4AmDnj6fqJD+SUROsCyCZywBS/fz6bIiF LTso5nyYXBQ3TIumgcBcW96DLQlKXFKrScbtSyAQGeAHv7ZjM2GXwNd+2BnpIcX6vl5IVyEQqzn Y9h6zvxIq6zeyKHYNuaD2VhSo/DKLaRZPggMECKd1N6fr1M8u7yw/MZcg0kABgwA9ZzOMRS0vIK d7hZWbsLA4YdhL+Gho/+CVnKvdpU1PWLg6dt32ClvYyduOf0+I77wpdqm4px33e0nwqz9Txd17U 4IG7n/SbR+JEf0o1LsmQ4+nCr4fy1AdWjaVULJOFZu/ibIE8340sMQy9/kZDjOuJY2yAcjeRlPq /8nhf5Da1wXqyOefy8CuH+iarQ41m+1m+JpW/OPefecyxE8kQLdHeslK8D4fRoIgDWrQ0eUhCum gzgY7F6g8sd919g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vr6ZgM7UJ8EVYHl7jTVpzvHZsilmOsgRG_s_8_MBSjY_1791289721 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: H52ISCM5FNCLCK3TNZ2UM4LKOU3NP5ZS X-Message-ID-Hash: H52ISCM5FNCLCK3TNZ2UM4LKOU3NP5ZS X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791290217255158500 Add an API to allow skipping the system-wide hooks directory (/etc/libvirt/hooks) for non-root users. When enabled, only the user hooks directory (~/.config/libvirt/hooks) is searched. This allows daemon config to control whether system hooks should be used in session mode. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/libvirt_private.syms | 1 + src/util/virhook.c | 30 +++++++++++++++++++++++++++--- src/util/virhook.h | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 798d2d28c893..ce00f961b678 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2618,6 +2618,7 @@ virHashCodeGen; virHookCall; virHookInitialize; virHookPresent; +virHookSetSkipSystemHooks; =20 =20 # util/virhostcpu.h diff --git a/src/util/virhook.c b/src/util/virhook.c index f62ac902bb40..aa68109ff193 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -41,6 +41,21 @@ VIR_LOG_INIT("util.hook"); =20 #define LIBVIRT_HOOK_DIR SYSCONFDIR "/libvirt/hooks" =20 +static bool virHookSkipSystemHooks; + +/** + * virHookSetSkipSystemHooks: + * @skip: if true, skip system hooks directory for non-root + * + * Configure whether the system-wide hooks directory (/etc/libvirt/hooks) + * should be skipped for non-root users. By default, both the system + * directory and the user directory (~/.config/libvirt/hooks) are searched. + */ +void +virHookSetSkipSystemHooks(bool skip) +{ + virHookSkipSystemHooks =3D skip; +} =20 /** * virHookGetDirs: @@ -48,7 +63,10 @@ VIR_LOG_INIT("util.hook"); * Returns a NULL-terminated array of hook directories to search, * in priority order. For root, only /etc/libvirt/hooks is returned. * For non-root users, both /etc/libvirt/hooks and - * ~/.config/libvirt/hooks are returned (system first, then user). + * ~/.config/libvirt/hooks are returned (system first, then user), + * unless virHookSetSkipSystemHooks(true) has been called (via the + * skip_system_hooks config option), in which case only the user + * directory is returned. * * The caller must free the result with g_strfreev(). */ @@ -58,9 +76,12 @@ virHookGetDirs(void) g_autofree char *configdir =3D NULL; GPtrArray *dirs =3D g_ptr_array_new(); =20 - g_ptr_array_add(dirs, g_strdup(LIBVIRT_HOOK_DIR)); + if (geteuid() =3D=3D 0) { + g_ptr_array_add(dirs, g_strdup(LIBVIRT_HOOK_DIR)); + } else { + if (!virHookSkipSystemHooks) + g_ptr_array_add(dirs, g_strdup(LIBVIRT_HOOK_DIR)); =20 - if (geteuid() !=3D 0) { configdir =3D virGetUserConfigDirectory(); g_ptr_array_add(dirs, g_build_filename(configdir, "hooks", NULL)); } @@ -377,6 +398,9 @@ virRunScript(const char *path, * output produced by each script is fed as input to the next script and * so on, chaining across directories. * + * For non-root users, the system hooks directory can be skipped by setting + * the skip_system_hooks daemon config option. + * * Returns: 0 if the execution succeeded, 1 if the script was not found or * invalid parameters, and -1 if script returned an error */ diff --git a/src/util/virhook.h b/src/util/virhook.h index d8237c837e94..47d5bf4266e9 100644 --- a/src/util/virhook.h +++ b/src/util/virhook.h @@ -109,6 +109,7 @@ typedef enum { } virHookBhyveOpType; =20 int virHookInitialize(void); +void virHookSetSkipSystemHooks(bool skip); =20 int virHookPresent(int driver); =20 --=20 2.56.0.rc0.29.g47ce80527c56 From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791290287; cv=none; d=zohomail.com; s=zohoarc; b=FsImU0JxHtfJRFm7XNmnXGTRcJ04H4tArweVrfGkMllhIKAFe6oGBlN4KhapzF9CCjMLRxpHnQjONgQQyg8MFiB/3LAfi4pSv6aZsOptxfVn1xuF1TuVgD6UW5XoyQoEuOsPOkXf26DwGz/7/QoCbnpTwucYqpgnHpxIl9pKCuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791290287; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=rAbCZITGtBonagFcAVSdjqdjHZnM3u+P2trhIUyq010=; b=dWYx0XFZKHDlmFIrf+9jco4VUCdefzPy5kWRerNXF7KGhOQHXnM+DCAIpAybTO51NQGCeUs/uL7MFfIBBk+hZqwfv3h2AgWUBWAS9BZLUyCrhIyQCcmpYMxzsZ8jgLRWSJ2pEBMZ2AV+A5juEORewigKV2CVwRDvQZIQGxfhrt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1791290287760134.46576387065068; Tue, 6 Oct 2026 05:38:07 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0D999418C2; Tue, 6 Oct 2026 08:38:05 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 6CC5A41934; Tue, 6 Oct 2026 08:30:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 05F5B418EC; Tue, 6 Oct 2026 08:30:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0AAC64187F for ; Tue, 6 Oct 2026 08:28:47 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-IXxhMFbxOOy1I9XOdBagmQ-1; Tue, 06 Oct 2026 08:28:46 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53B9818088B8 for ; Tue, 6 Oct 2026 12:28:45 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 54EE11800345; Tue, 6 Oct 2026 12:28:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289727; 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=rAbCZITGtBonagFcAVSdjqdjHZnM3u+P2trhIUyq010=; b=INaTVGySpu3rzJ9F1rey61gK0G6g8mIxHCjkeX5dPT0Q2ZCCd8W+gpEkm4vjIYSFl9U/h3 iz+guwjVdMwMjQm1FpQARv9zk4O19gyAPwazzoQ+d9hs5iN4bgcjJdmvS+s4ASNWmJ7uhE J9+5+lM1HEqm8R839vvpq5MubvLSbnI= X-MC-Unique: IXxhMFbxOOy1I9XOdBagmQ-1 X-Mimecast-MFC-AGG-ID: IXxhMFbxOOy1I9XOdBagmQ_1791289725 Date: Tue, 06 Oct 2026 16:28:22 +0400 Subject: [PATCH 6/7] remote: add skip_system_hooks daemon config option MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-6-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=3732; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4Ftsied6rgkWhxQhvTA+3RB/EOrw/AIRPCVSR7WuNVM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqxOlkXKrQ7F2MOBnIoQr480yNV9WVcHPDivV2t dtB7N0xZnGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCasTpZAAKCRDa6OEJdZac 5RgyD/9rxAz7mDR5+dkT+AKNMscMPh624TLWLZj2l0g517052sUPfMhAnZWSj2E2Mx3FDyQLB4J 82rN3mIzmnvuxOWmbuHnKalg1xkUWQjfJiSb7bnGbM3ev7Ccoxn++D09azkvNajqluO7ZHWeroa 0Ez4+yt0TFC2w/9T1mAqGEAyt/oKtFbzSYNuh9yPO2MlL3uULcX78s/AuHUiOFmzSfOfzKFXjNK bEyvH19oDu8HB8IjboVJj1wl/9v5E828kvNDasRgJpyrSA8USB/qgJPRje6IonDWd+jG6bQjgrT /urvJwRcsrbN0ys8cM0UwTAehM+hl8jjUS3JTgtzNNJrxinPE9BFzDbs1oE4i0pWs8ae/8he13s 8WGbBqAkeTaduKmS9gbDRM/2c1VXcVyU35+3CD0iFJm6138GyDhCbO96HojRsb5bKi8VF3AVjYu uQy07Vsk0gSNf2+7hbo1hDQadlG35qkijfg8VO6IIgmrn0QM1gzj40YFpin4/35qx0WJxp8ILd4 31NX/7iEubQpkUSKcvmj2P1q9u3xnjK+u29MA24AwzibLkF9iEbz5Iew67r4jvGFY5PtX1Js/RL KWamdo2tTySmaD0qD6272LrA15ILkKje2XMZuI2LlSMn4hIazfkduPZ8aWHGOS6G1wULBHnLZBl iq2LMtsBst5/rGw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: oRSJPKisYRiiJ_ibVCZ2cmZnpxnd0e1LFMy6p7DBI90_1791289725 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7NAJO6XC3DOAO33QR6KYAKZSLQNB23L3 X-Message-ID-Hash: 7NAJO6XC3DOAO33QR6KYAKZSLQNB23L3 X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791290289648158500 Add a new 'skip_system_hooks' boolean option to the daemon configuration file. When set to true, session (non-root) daemons will only search for hooks in the user directory (~/.config/libvirt/hooks), skipping the system-wide /etc/libvirt/hooks directory. The default is false, preserving backward compatibility by searching both system and user hook directories. Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/remote/libvirtd.aug.in | 1 + src/remote/libvirtd.conf.in | 9 +++++++++ src/remote/remote_daemon.c | 1 + src/remote/remote_daemon_config.c | 3 +++ src/remote/remote_daemon_config.h | 2 ++ src/remote/test_libvirtd.aug.in | 1 + 6 files changed, 17 insertions(+) diff --git a/src/remote/libvirtd.aug.in b/src/remote/libvirtd.aug.in index 1f3bb5d0e212..85fb2fe7ca93 100644 --- a/src/remote/libvirtd.aug.in +++ b/src/remote/libvirtd.aug.in @@ -93,6 +93,7 @@ module @DAEMON_NAME_UC@ =3D let misc_entry =3D str_entry "host_uuid" | str_entry "host_uuid_source" | int_entry "ovs_timeout" + | bool_entry "skip_system_hooks" =20 (* Each entry in the config is one of the following three ... *) let entry =3D sock_acl_entry diff --git a/src/remote/libvirtd.conf.in b/src/remote/libvirtd.conf.in index e4460e61ef1a..403adbefb475 100644 --- a/src/remote/libvirtd.conf.in +++ b/src/remote/libvirtd.conf.in @@ -558,3 +558,12 @@ # potential infinite waits blocking libvirt. # #ovs_timeout =3D 5 + +################################################################### +# Hooks: +# For non-root (session) daemons, hooks are searched in both the +# system directory (@SYSCONFDIR@/libvirt/hooks) and the user directory +# ($XDG_CONFIG_HOME/libvirt/hooks), with system hooks executed first. +# Set skip_system_hooks to 1 to only use user hooks. +# +#skip_system_hooks =3D 0 diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index ee3d10bc2312..b76e28c5db7c 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -1115,6 +1115,7 @@ int main(int argc, char **argv) { virAuditLog(config->audit_logging > 0); =20 /* setup the hooks if any */ + virHookSetSkipSystemHooks(config->skip_system_hooks); if (virHookInitialize() < 0) { ret =3D VIR_DAEMON_ERR_HOOKS; goto cleanup; diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_c= onfig.c index bb6078967f96..9a4a6da4219d 100644 --- a/src/remote/remote_daemon_config.c +++ b/src/remote/remote_daemon_config.c @@ -396,6 +396,9 @@ daemonConfigLoadOptions(struct daemonConfig *data, if (virConfGetValueUInt(conf, "ovs_timeout", &data->ovs_timeout) < 0) return -1; =20 + if (virConfGetValueBool(conf, "skip_system_hooks", &data->skip_system_= hooks) < 0) + return -1; + return 0; } =20 diff --git a/src/remote/remote_daemon_config.h b/src/remote/remote_daemon_c= onfig.h index e699889191cb..39357977b406 100644 --- a/src/remote/remote_daemon_config.h +++ b/src/remote/remote_daemon_config.h @@ -96,6 +96,8 @@ struct daemonConfig { unsigned int admin_keepalive_count; =20 unsigned int ovs_timeout; + + bool skip_system_hooks; }; =20 =20 diff --git a/src/remote/test_libvirtd.aug.in b/src/remote/test_libvirtd.aug= .in index a37b0daa55c9..bbd308d2be8a 100644 --- a/src/remote/test_libvirtd.aug.in +++ b/src/remote/test_libvirtd.aug.in @@ -75,3 +75,4 @@ module Test_@DAEMON_NAME@ =3D { "admin_keepalive_interval" =3D "5" } { "admin_keepalive_count" =3D "5" } { "ovs_timeout" =3D "5" } + { "skip_system_hooks" =3D "0" } --=20 2.56.0.rc0.29.g47ce80527c56 From nobody Sat Oct 24 20:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1791290372; cv=none; d=zohomail.com; s=zohoarc; b=diMd61f9kR5a8glr0hYKtqfmnMgVshbCanmYyq0TtxpDiYA0ZHE/VurNUn4FiXnrTmI8pwXQk/GVfytGA4Tc8hb4V7WkN5XAhZxuqxFG2EZ/BP8fdWwxqyEEhljseJ5aT5URRrTB+Ry8RRZqp3IdGO2wS8DLS3cpkiPofZVOFJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791290372; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=lkj21QpGNEApXs90kmGOPoRtCt9eWMEcOYFL26BjxEM=; b=G4It95FftLlNdv3wpSpkDilYkMZvxivA6bLSOMNc/diPFamX1UZ0pBun5tRYWwmjdXFx5Ef5jLb4Ry71UuZ9jI000aUBCXJV2aOe85zY7aGvMe+L/cjTYxJYGdSfyzI6uKlKSvcCQau8sFKBASRaW3yrxxKDvBFIHz50ohjqZO4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1791290372143890.6164486822522; Tue, 6 Oct 2026 05:39:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 5370A4187B; Tue, 6 Oct 2026 08:39:30 -0400 (EDT) Received: from [172.19.199.16] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 1311A41D57; Tue, 6 Oct 2026 08:31:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9D22741B19; Tue, 6 Oct 2026 08:31:13 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C2ADE41957 for ; Tue, 6 Oct 2026 08:28:52 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-A86pozUgNxCEb3pVy4_fKw-1; Tue, 06 Oct 2026 08:28:49 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 557961840C7A for ; Tue, 6 Oct 2026 12:28:48 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8BA291800351; Tue, 6 Oct 2026 12:28:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791289732; 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=lkj21QpGNEApXs90kmGOPoRtCt9eWMEcOYFL26BjxEM=; b=ecsKzvAd6zgCiifnVmIuzqN+ajZzWnekvm/TjOd3CX9zXTNml8HGIQ0aTS7HHoKE1Ubw8C zCOB8T+k/NBLl4+Ek/DkHYqLLB/zM/KDiJdt0Lc4oCo+M661B2jznFGDx1t4wB7+9XK1hz Q3n0+fQv0caWQoQHq8khTErX8A74PVA= X-MC-Unique: A86pozUgNxCEb3pVy4_fKw-1 X-Mimecast-MFC-AGG-ID: A86pozUgNxCEb3pVy4_fKw_1791289728 Date: Tue, 06 Oct 2026 16:28:23 +0400 Subject: [PATCH 7/7] docs: document session hooks support MIME-Version: 1.0 Message-Id: <20261006-session-hook-v1-7-475574de736a@redhat.com> References: <20261006-session-hook-v1-0-475574de736a@redhat.com> In-Reply-To: <20261006-session-hook-v1-0-475574de736a@redhat.com> To: devel@lists.libvirt.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1814; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9tbktyQKg6jYW2JKM0diklrwSS2yErCromfirsUJ8Ik=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqxOlkFfM8PgXcOYXr5pIQbgvTahJt1CoMxFZ09 H4kx3f+1h2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCasTpZAAKCRDa6OEJdZac 5UVmD/0bCWZMdRUJjYPowKzpRDMkZPClraqrwdpsWb5fApsY0Wb2jqfFXtoY512ErgqOfNNVJqW KQsLnXMIdaxSvOmxi/rPgvulSHjpxxz0za8prXD6gSRKNKdwjts3YMxJ0Mf8CKae+vXaThHs4R/ zEHyPydTckoecCvwQMYjr7UT/szecNt1BHGB6693FVzwef3lx0TfRGu+eq/sziPjOyhnijNygDD xlbqy8KxprOo3WagYRczTJfa+iIu0ryb5XUu7UzDGY7dV1vu5xt6rCQtV7e09Gk7eFUDtoIdrrV MRY0eOyP3/5pi7WbWEwosBy8tX9v3XF7+GTEVB4HQdyHV6bOA1EQ22ZTD0yxb12RNqj8rjWzh11 MIJ6ZEwgsCNwdRNATCXXnpEvJ8prwiC/f4wXWjbduaHVivbLstmf/LKz5Sg0cU6Kp8wrtlLIW7L v5aemvPxNFoWo9Gee+d7L0HtJKjO+aMuBSKLDm5oo/e/pmsEdX8tLgiDFaQCaKQoG9SKiJNCMAK Aq21JB7XpIHKByfrp1c7E0ZOztsbP8HeLyodvb1pfCB1Ka1qYDqUdOau6QvzFfOeRoPBzlTj0P0 1x1PodjnNJczy0wHjzIg0Bs/KeXLeO4+mW+2VRDc+J0GIVIxJJw1jYsJsOXUzrpThcFM4XMLRn6 kLf5swj9fVKsLdg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _mF2TxbGVp5Xvb7KV9VI1bT4jW9YsRj_UJVgg_Dqk8E_1791289728 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KDB3HH5YGFIWNIKZMZM7BXS6LPUVIMAO X-Message-ID-Hash: KDB3HH5YGFIWNIKZMZM7BXS6LPUVIMAO X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Marc-Andr=C3=A9_Lureau_via_Devel?= Reply-To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1791290374144158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- NEWS.rst | 7 +++++++ docs/hooks.rst | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 6ffc803118c2..2acba86f3896 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,13 @@ v12.9.0 (unreleased) =20 * **New features** =20 + * hooks: Support user-level hook scripts for session daemons + + Session daemons now search for hook scripts in + ``$XDG_CONFIG_HOME/libvirt/hooks/`` (typically + ``~/.config/libvirt/hooks/``) in addition to the system-wide + ``/etc/libvirt/hooks/`` directory. + * **Improvements** =20 * **Bug fixes** diff --git a/docs/hooks.rst b/docs/hooks.rst index e1745b8cc71d..68166474d53f 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -37,6 +37,16 @@ The libvirt hook scripts are located in the directory - :since:`Since 6.5.0`, you can also place several hook scripts in the directories ``/etc/libvirt/hooks/.d/``. =20 +:since:`Since 12.9.0`, for non-root (session) daemons, hooks are also sear= ched +in the user configuration directory ``$XDG_CONFIG_HOME/libvirt/hooks/`` +(typically ``~/.config/libvirt/hooks/``). When both directories exist, the +system hooks (``/etc/libvirt/hooks/``) are executed first, followed by the= user +hooks. Output from the system hooks is chained as input to the user hooks. + +The system-wide hook directory can be skipped for session daemons by setti= ng +``skip_system_hooks =3D 1`` in the daemon configuration file (e.g. +``virtqemud.conf``). When enabled, only the user directory is searched. + To use hook scripts, you will need to create this ``hooks`` directory manu= ally, place the desired hook scripts inside, then make them executable. =20 --=20 2.56.0.rc0.29.g47ce80527c56