[pve-devel] [PATCH v2 pve-guest-common 1/1] Add run_params to exec_hookscript function

Stefan Hanreich s.hanreich at proxmox.com
Thu Oct 6 14:44:40 CEST 2022


This enables us to pass parameters to the run_command call so the
hookscripts have a more fine-grained control over how the script should
get executed.

Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 src/PVE/GuestHelpers.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/GuestHelpers.pm b/src/PVE/GuestHelpers.pm
index 0fe3fd6..79c02e2 100644
--- a/src/PVE/GuestHelpers.pm
+++ b/src/PVE/GuestHelpers.pm
@@ -101,7 +101,7 @@ sub check_hookscript {
 }
 
 sub exec_hookscript {
-    my ($conf, $vmid, $phase, $stop_on_error) = @_;
+    my ($conf, $vmid, $phase, $stop_on_error, $run_params) = @_;
 
     return if !$conf->{hookscript};
 
@@ -109,7 +109,7 @@ sub exec_hookscript {
 	my $hookscript = check_hookscript($conf->{hookscript});
 	die $@ if $@;
 
-	PVE::Tools::run_command([$hookscript, $vmid, $phase]);
+	PVE::Tools::run_command([$hookscript, $vmid, $phase], %$run_params);
     };
     if (my $err = $@) {
 	my $errmsg = "hookscript error for $vmid on $phase: $err\n";
-- 
2.30.2





More information about the pve-devel mailing list