From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id F09081FF13E for ; Fri, 23 Jan 2026 14:26:02 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2FF99D93D; Fri, 23 Jan 2026 14:26:16 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Fri, 23 Jan 2026 14:25:50 +0100 Message-ID: <20260123132611.974310-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260123132611.974310-1-d.csapak@proxmox.com> References: <20260123132611.974310-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.970 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_MAILER 2 Automated Mailer Tag Left in Email RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH docs v2 1/1] examples: add new hookscript phase to example hookscript X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" qemu-server has a new phase 'post-pci-prepare' that is called for vms with pci passthrough for each device prepared. add that to the example hookscript and explain when it's called and it's parameters with a comment. Signed-off-by: Dominik Csapak --- changes from v1: * adapt to the changes from positional parameters to environment variables examples/guest-example-hookscript.pl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/guest-example-hookscript.pl b/examples/guest-example-hookscript.pl index 1cce2e3..a5a50d5 100755 --- a/examples/guest-example-hookscript.pl +++ b/examples/guest-example-hookscript.pl @@ -38,6 +38,31 @@ if ($phase eq 'pre-start') { print "$vmid started successfully.\n"; +} elsif ($phase eq 'post-pci-prepare') { + + # Only called for virtual machines, not containers. + # + # This phase will be called for each pci device that is passed through, + # after it was prepared by the PVE stack. In other words when either + # * the mdev/vGPU was created + # * the driver was changed to vfio-pci and the device was reset + # + # This phase has 3 additional parameters given via the environment + + # the id from the config, e.g. 'hostpci0' + my $hostpci_x = $ENV{ID}; + + # the pciid of the passed through device or the underlying device in case of an mdev/vGPU + # e.g. '0000:01:00.0' + my $pciid = $ENV{PCIID}; + + # the uuid of the mediated device if it was one, + # e.g. '00000001-0000-0000-0000-000000008006' + my $mdev_uuid = $ENV{MDEV_UUID}; + + print "Prepared PCI device for $hostpci_x with pciid: $pciid.\n"; + print "It is a mediated device with UUID: $mdev_uuid\n" if $mdev_uuid; + } elsif ($phase eq 'pre-stop') { # Third phase 'pre-stop' will be executed before stopping the guest -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel