From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH guest-common 1/1] helpers: exec hookscript: add optional parameters
Date: Wed, 14 Jan 2026 16:50:30 +0100 [thread overview]
Message-ID: <20260114155043.3313473-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260114155043.3313473-1-d.csapak@proxmox.com>
sometimes we may want to call the hookscript with additional parameters
in some phases, e.g. we want to call it for each pci device that was
prepared before starting with the correct uuid or pci id.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PVE/GuestHelpers.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/PVE/GuestHelpers.pm b/src/PVE/GuestHelpers.pm
index f8d112b..1da7619 100644
--- a/src/PVE/GuestHelpers.pm
+++ b/src/PVE/GuestHelpers.pm
@@ -115,15 +115,19 @@ sub check_hookscript {
}
sub exec_hookscript {
- my ($conf, $vmid, $phase, $stop_on_error) = @_;
+ my ($conf, $vmid, $phase, $stop_on_error, $params) = @_;
return if !$conf->{hookscript};
+ $params //= [];
+
eval {
my $hookscript = check_hookscript($conf->{hookscript});
die $@ if $@;
- PVE::Tools::run_command([$hookscript, $vmid, $phase]);
+ my $cmd = [$hookscript, $vmid, $phase];
+ push $cmd->@*, $params->@*;
+ PVE::Tools::run_command($cmd);
};
if (my $err = $@) {
my $errmsg = "hookscript error for $vmid on $phase: $err\n";
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2026-01-14 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 15:50 [pve-devel] [PATCH docs/guest-common/qemu-server 0/3] add new pci passthrough specific hookscript phase Dominik Csapak
2026-01-14 15:50 ` Dominik Csapak [this message]
2026-01-14 15:50 ` [pve-devel] [PATCH qemu-server 1/1] pci: call hookscript for each prepared pci device Dominik Csapak
2026-01-14 15:50 ` [pve-devel] [PATCH docs 1/1] examples: add new hookscript phase to example hookscript Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260114155043.3313473-2-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.