From nobody Sat May 18 14:10:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693321963; cv=none; d=zohomail.com; s=zohoarc; b=To5X/Bcp4IyjnA6vmZa8K1Q1S/OE1jfpFs4O+ikBybuGSVgXG5tf9VICfeTTQgQuShK+2RgA9J8ookd0nHHIJUqJvMz4l3RWGcU5BRjob/6VJ2gHyIxea/eWG3rOKhY4gV+i+8aWz8FkQcqhr4ehJT2AAGlzbGXc8bGABePE6nM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693321963; h=Content-Type:Content-Transfer-Encoding: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=yuhT5Fsdltd3pfvJC6wLx10wNyQ+4fn506NqJuBpBnI=; b=RwmeMUiCHoNL2CIn5lYWtNQcvMZem3jgAkrl1w3VqOxK+Ja0zy4+bMM5bSWWgQl7u51inQC51ARgNgLVG5f7Na+nBybWENlBwJiLSkwbA6sbfavVP7yq9Fh/ZY9txUG/HAKAcRXIQQRLZIsKC27obs5/sM9gURMnJJwe6TUxxrY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693321963826717.8614295344902; Tue, 29 Aug 2023 08:12:43 -0700 (PDT) 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-556-A7RGO1VsMQ-qTIAy6Hm9gA-1; Tue, 29 Aug 2023 11:12:39 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD1BE101B429; Tue, 29 Aug 2023 15:12:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B533492C18; Tue, 29 Aug 2023 15:12:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 36AAE19451C8; Tue, 29 Aug 2023 15:12:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BCCB219465B6 for ; Tue, 29 Aug 2023 15:12:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5F696492C18; Tue, 29 Aug 2023 15:12:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 064C4492C13 for ; Tue, 29 Aug 2023 15:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693321962; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yuhT5Fsdltd3pfvJC6wLx10wNyQ+4fn506NqJuBpBnI=; b=WSbtJ1v1VaVz4BMM8KrMZonXoWmrJudfSiM2k2IzaUiSF6cDoJpgMXE82T9lhN5vk2wuOb 36njtARh07+yA8pwwe4N8TnAAIr4u6Z+LZ19K3ScULtGS/LeNUCmJAvqcdr9U622g8V6Me tQIg2/2oGy/ec4kY7chUE2X5FIZQyeQ= X-MC-Unique: A7RGO1VsMQ-qTIAy6Hm9gA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/3] docs: Document that libxl hooks are also given full domain XML Date: Tue, 29 Aug 2023 17:12:09 +0200 Message-ID: <99660db962e9debe2019ee5b738782a193d014ff.1693321916.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693321966077100005 Content-Type: text/plain; charset="utf-8"; x-default="true" Our hooks.rst document existence of libxl hook scripts, but mentions only qemu and lxc as receivers of full domain XML. But since their introduction in v2.2.0-rc1~201 they are also given full domain XML. Fix our wording. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- docs/hooks.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index 9387676a55..b127ec4202 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -89,7 +89,7 @@ Script arguments The hook scripts are called with specific command line arguments, dependin= g upon the script, and the operation being performed. =20 -The guest hook scripts, qemu and lxc, are also given the **full** XML +The guest hook scripts, qemu, lxc and libxl are also given the **full** XML description for the domain on their stdin. This includes items such the UU= ID of the domain and its storage information, and is intended to provide all the libvirt information the script needs. @@ -126,8 +126,8 @@ followed with the full XML description of the port: =20 Please note that this approach is different from other cases such as ``dae= mon``, -``qemu`` or ``lxc`` hook scripts, because two XMLs may be passed here, whi= le in -the other cases only a single XML is passed. +``qemu``, ``lxc`` or ``libxl`` hook scripts, because two XMLs may be passed +here, while in the other cases only a single XML is passed. =20 The command line arguments take this approach: =20 --=20 2.41.0 From nobody Sat May 18 14:10:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693321962; cv=none; d=zohomail.com; s=zohoarc; b=QrBoHYsS4zl2mBJqL5W10qb1WtO0GvKsul5FLMoPSHWdVTmUKB9c3Bc8oE6tcOVK6SNn+ttEa6XD7aGuPqIfd0A5L2W5W+uirE/U0Szxmh810ub7iOvNJkmSF0CNpFwFhj4JVN+yUbedRMNA9uMQmSKL4pdkVXmw0EC5QhqwjFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693321962; h=Content-Type:Content-Transfer-Encoding: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=hBOG4H9JfQXhkIueroIjC5mLqgj+evm4aSPbwOgqWtw=; b=ReeKGtn/nZfzS0dVH8KLiu3wVVS84VMpQ5PL82VUH4qK4VjSCaVPJDwUB45rgmxMp4tOU19FnyajEbWfA1jIA+H9A9x8By3PxTF5+lvzW14jtAQY1pC3k8ItNc3x1ziXdLWf7670h87w02w4m4dDfGb39/FKy7aPF3ikq5+VHfI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693321962933888.5156203587613; Tue, 29 Aug 2023 08:12:42 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-556-NnFQ67TDNlSUCjLF33u0mA-1; Tue, 29 Aug 2023 11:12:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E3B138149AC; Tue, 29 Aug 2023 15:12:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8429D1121318; Tue, 29 Aug 2023 15:12:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DCCF91946A43; Tue, 29 Aug 2023 15:12:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BCD1F1946A4A for ; Tue, 29 Aug 2023 15:12:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EFC63492C1B; Tue, 29 Aug 2023 15:12:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96258492C13 for ; Tue, 29 Aug 2023 15:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693321961; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hBOG4H9JfQXhkIueroIjC5mLqgj+evm4aSPbwOgqWtw=; b=OcCapAZ+tUBE4WnWCD3CbB/cwFyEdM8AkzJxdUiPKl4uicjZoBVr36yRdcUJDVT6TKFUVB qhZCjDr+hB1bUfcIppiiIT/hkyKdDH2RIc9zHg8etbLmA0DpMNYBzCPpRXWSsOLWA+Zt9+ nl72voHgdEmYajZWjdfromsDraVvv1M= X-MC-Unique: NnFQ67TDNlSUCjLF33u0mA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] docs: Document bhyve hook scripts Date: Tue, 29 Aug 2023 17:12:10 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693321964770100003 Content-Type: text/plain; charset="utf-8"; x-default="true" We have bhyve hook scripts since v6.1.0-rc1~42 but never mention them in hooks.rst. Fill the blanks. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- docs/hooks.rst | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/hooks.rst b/docs/hooks.rst index b127ec4202..4e02ba0f8f 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -20,6 +20,7 @@ occur: - A QEMU guest is started or stopped ( :since:`since 0.8.0` ) - An LXC guest is started or stopped ( :since:`since 0.8.0` ) - A libxl-handled Xen guest is started or stopped ( :since:`since 2.1.0` ) +- An bhyve guest is started or stopped ( :since:`since 6.1.0` ) - A network is started or stopped or an interface is plugged/unplugged to= /from the network ( :since:`since 1.2.2` ) =20 @@ -53,6 +54,8 @@ At present, there are five hook scripts that can be calle= d: Executed when an LXC guest is started or stopped - ``/etc/libvirt/hooks/libxl`` Executed when a libxl-handled Xen guest is started, stopped, or migrated +- ``/etc/libvirt/hooks/bhyve`` + Executed when an bhyve guest is started or stopped - ``/etc/libvirt/hooks/network`` Executed when a network is started or stopped or an interface is plugged/unplugged to/from the network @@ -393,6 +396,49 @@ operation. There is no specific operation to indicate = a "restart" is occurring. =20 /etc/libvirt/hooks/libxl guest_name reconnect begin - =20 +/etc/libvirt/hooks/bhyve +^^^^^^^^^^^^^^^^^^^^^^^^ + +- | Before an bhyve guest is started, the bhyve hook script is called in = three + locations; if any location fails, the guest is not started. The first + location, :since:`since 6.1.0` , is before libvirt performs any resou= rce + labeling, and the hook can allocate resources not managed by libvirt.= This is + called as: + + :: + + /etc/libvirt/hooks/bhyve guest_name prepare begin - + + | The second location, available :since:`Since 6.1.0` , occurs after li= bvirt + has finished labeling all resources, but has not yet started the gues= t, + called as: + + :: + + /etc/libvirt/hooks/bhyve guest_name start begin - + + | The third location, :since:`6.1.0` , occurs after the bhyve process h= as + successfully started up: + + :: + + /etc/libvirt/hooks/bhyve guest_name started begin - + +- | When an bhyve guest is stopped, the bhyve hook script is called in two + locations, to match the startup. First, :since:`since 6.1.0` , the ho= ok is + called before libvirt restores any labels: + + :: + + /etc/libvirt/hooks/bhyve guest_name stopped end - + + | Then, after libvirt has released all resources, the hook is called ag= ain, + :since:`since 6.1.0` , to allow any additional resource cleanup: + + :: + + /etc/libvirt/hooks/bhyve guest_name release end - + /etc/libvirt/hooks/network ^^^^^^^^^^^^^^^^^^^^^^^^^^ =20 --=20 2.41.0 From nobody Sat May 18 14:10:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693321968; cv=none; d=zohomail.com; s=zohoarc; b=GXnxCyeh4tA33e9Gekv3kjXHY02G9UZx31a9nq8ejIwxuh40FwNIO+gixWy2pXQF1dhXstZupfgTQPV/l1/bo2y2khwttwUQ6j06VMjUPx2USyn/c6wXNIJqHy7oZK/pugr05LbD+yXRiDvt9ReqBS9KNToOAUrnmsje5EUe9dQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693321968; h=Content-Type:Content-Transfer-Encoding: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=9INyq1JEcaFcknmAl8/GcJ6UMToiBiuFjAuXbFnYrEo=; b=cZ4k1ZLXF4Yd7ZsJ7JOuWV/6oOqDGJbOU18Xg7x/4V6nI9IMQTViFnFw5RKMP91DtZJil8Zq6Ilz3ytI07WPqlU6+oqvKvEiUtxxZ38cma63H/NoA51x8AzJkk53nDOiPtxjDsPrUy021rnbfQXTIuqedvX06+y3OFXeoxJdaYM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1693321968358649.6802506549582; Tue, 29 Aug 2023 08:12:48 -0700 (PDT) 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-487-rUkw9PPIMs293ZgmMqXXLA-1; Tue, 29 Aug 2023 11:12:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB1BA1021E14; Tue, 29 Aug 2023 15:12:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6FC4C15BC0; Tue, 29 Aug 2023 15:12:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6C9C719451D9; Tue, 29 Aug 2023 15:12:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BF8331946A4B for ; Tue, 29 Aug 2023 15:12:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8B061492C3A; Tue, 29 Aug 2023 15:12:15 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 324EB492C13 for ; Tue, 29 Aug 2023 15:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693321966; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9INyq1JEcaFcknmAl8/GcJ6UMToiBiuFjAuXbFnYrEo=; b=FOhuA13vDkzptuoDI64N7ndlwymYSw+frD1R2mLpld11EFZqFYBCYoll0gRrCqly1CIhDG r7IeijLaeEnQbDU4K22bIFHB9GgYGztLY26lTo99Q88rQiz0hkv+NFkJIZ1t3byzFgulKK v3CPKMctlZqWP4IRTmVRs5YMoMdG0P8= X-MC-Unique: rUkw9PPIMs293ZgmMqXXLA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] bhyve: Feed hook scripts with domain XML Date: Tue, 29 Aug 2023 17:12:11 +0200 Message-ID: <5512688ae2d7d9e31ab338899a15b580ac75daa6.1693321916.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693321991445100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Domain related hook scripts are all fed with domain XML on their stdin, except for bhyve. Fix this. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/528 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- docs/hooks.rst | 10 +++++----- src/bhyve/bhyve_process.c | 35 ++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index 4e02ba0f8f..bd197c0d6e 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -92,9 +92,9 @@ Script arguments The hook scripts are called with specific command line arguments, dependin= g upon the script, and the operation being performed. =20 -The guest hook scripts, qemu, lxc and libxl are also given the **full** XML -description for the domain on their stdin. This includes items such the UU= ID of -the domain and its storage information, and is intended to provide all the +The guest hook scripts, qemu, lxc, libxl and bhyve are also given the **fu= ll** +XML description for the domain on their stdin. This includes items such th= e UUID +of the domain and its storage information, and is intended to provide all = the libvirt information the script needs. =20 For all cases, stdin of the network hook script is provided with the full = XML @@ -129,8 +129,8 @@ followed with the full XML description of the port: =20 Please note that this approach is different from other cases such as ``dae= mon``, -``qemu``, ``lxc`` or ``libxl`` hook scripts, because two XMLs may be passed -here, while in the other cases only a single XML is passed. +``qemu``, ``lxc``, ``libxl`` or ``bhyve`` hook scripts, because two XMLs m= ay be +passed here, while in the other cases only a single XML is passed. =20 The command line arguments take this approach: =20 diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 80d5a8804f..d476ff401f 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -94,21 +94,34 @@ virBhyveFormatDevMapFile(const char *vm_name, char **fn= _out) } =20 static int -bhyveProcessStartHook(virDomainObj *vm, virHookBhyveOpType op) +bhyveProcessStartHook(struct _bhyveConn *driver, + virDomainObj *vm, + virHookBhyveOpType op) { + g_autofree char *xml =3D NULL; + if (!virHookPresent(VIR_HOOK_DRIVER_BHYVE)) return 0; =20 + xml =3D virDomainDefFormat(vm->def, driver->xmlopt, 0); + return virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op, - VIR_HOOK_SUBOP_BEGIN, NULL, NULL, NULL); + VIR_HOOK_SUBOP_BEGIN, NULL, xml, NULL); } =20 static void -bhyveProcessStopHook(virDomainObj *vm, virHookBhyveOpType op) +bhyveProcessStopHook(struct _bhyveConn *driver, + virDomainObj *vm, + virHookBhyveOpType op) { - if (virHookPresent(VIR_HOOK_DRIVER_BHYVE)) - virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op, - VIR_HOOK_SUBOP_END, NULL, NULL, NULL); + g_autofree char *xml =3D NULL; + if (!virHookPresent(VIR_HOOK_DRIVER_BHYVE)) + return; + + xml =3D virDomainDefFormat(vm->def, driver->xmlopt, 0); + + virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op, + VIR_HOOK_SUBOP_END, NULL, xml, NULL); } =20 static int @@ -194,7 +207,7 @@ virBhyveProcessStartImpl(struct _bhyveConn *driver, goto cleanup; } =20 - if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_START) < 0) + if (bhyveProcessStartHook(driver, vm, VIR_HOOK_BHYVE_OP_START) < 0) goto cleanup; =20 /* Now we can start the domain */ @@ -216,7 +229,7 @@ virBhyveProcessStartImpl(struct _bhyveConn *driver, BHYVE_STATE_DIR) < 0) goto cleanup; =20 - if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_STARTED) < 0) + if (bhyveProcessStartHook(driver, vm, VIR_HOOK_BHYVE_OP_STARTED) < 0) goto cleanup; =20 ret =3D 0; @@ -265,7 +278,7 @@ virBhyveProcessStart(virConnectPtr conn, struct _bhyveConn *driver =3D conn->privateData; =20 /* Run an early hook to setup missing devices. */ - if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) + if (bhyveProcessStartHook(driver, vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) return -1; =20 if (flags & VIR_BHYVE_PROCESS_START_AUTODESTROY) @@ -307,7 +320,7 @@ virBhyveProcessStop(struct _bhyveConn *driver, if ((priv !=3D NULL) && (priv->mon !=3D NULL)) bhyveMonitorClose(priv->mon); =20 - bhyveProcessStopHook(vm, VIR_HOOK_BHYVE_OP_STOPPED); + bhyveProcessStopHook(driver, vm, VIR_HOOK_BHYVE_OP_STOPPED); =20 /* Cleanup network interfaces */ bhyveNetCleanup(vm); @@ -329,7 +342,7 @@ virBhyveProcessStop(struct _bhyveConn *driver, vm->pid =3D 0; vm->def->id =3D -1; =20 - bhyveProcessStopHook(vm, VIR_HOOK_BHYVE_OP_RELEASE); + bhyveProcessStopHook(driver, vm, VIR_HOOK_BHYVE_OP_RELEASE); =20 cleanup: virPidFileDelete(BHYVE_STATE_DIR, vm->def->name); --=20 2.41.0