[pve-devel] [PATCH] Pass what storage ID is being used to vzdump hook scripts

Mark Casey markc at unifiedgroup.com
Tue Sep 10 19:48:51 CEST 2013


This version includes a mention in the sample hook script, which I 
forgot to include in the first version.



On 9/9/2013 10:57 PM, Mark Casey wrote:
> Hello,
>
> This patch is in reference to: 
> http://forum.proxmox.com/threads/16005-Minor-feature-request-Add-a-var-to-ENV-for-vzdump-hook-scripts-to-use.
>
> Not much git experience here, so I'm only *kinda* sure I didn't screw 
> anything up. :)
>
> Thank you,
> Mark
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20130910/f9f10a01/attachment.htm>
-------------- next part --------------
>From 815cac359e0b41b55da7c1eaa8dc06c081f09b9c Mon Sep 17 00:00:00 2001
From: Local User <luser at proxdev.unifiedgroup.com>
Date: Tue, 10 Sep 2013 12:40:10 -0500
Subject: [PATCH] Pass what storage ID is being used to vzdump hook scripts


Signed-off-by: Local User <luser at proxdev.unifiedgroup.com>
---
 PVE/VZDump.pm         |    4 ++--
 vzdump-hook-script.pl |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index e749938..0bef3fd 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -646,7 +646,7 @@ sub run_hook_script {
 
     local %ENV;
 
-    foreach my $ek (qw(vmtype dumpdir hostname tarfile logfile)) {
+    foreach my $ek (qw(vmtype dumpdir hostname tarfile logfile storeid)) {
 	$ENV{uc($ek)} = $task->{$ek} if $task->{$ek};
     }
 
@@ -764,7 +764,7 @@ sub exec_backup_task {
 	    die "unable to create log file '$tmplog'";
 
 	$task->{dumpdir} = $opts->{dumpdir};
-
+	$task->{storeid} = $opts->{storage};
 	$task->{tmplog} = $tmplog;
 
 	unlink $logfile;
diff --git a/vzdump-hook-script.pl b/vzdump-hook-script.pl
index 27075dc..b345677 100755
--- a/vzdump-hook-script.pl
+++ b/vzdump-hook-script.pl
@@ -29,6 +29,8 @@ if ($phase eq 'job-start' ||
 
     my $dumpdir = $ENV{DUMPDIR};
 
+    my $storeid = $ENV{STOREID};
+
     my $hostname = $ENV{HOSTNAME};
 
     # tarfile is only available in phase 'backup-end'
-- 
1.5.4.3



More information about the pve-devel mailing list