public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 0/2] readd TARFILE environment variable in VZDump
@ 2020-07-14  8:09 Stoiko Ivanov
  2020-07-14  8:09 ` [pve-devel] [PATCH manager 1/2] vzdump-hook-script: rename TARFILE to TARGET Stoiko Ivanov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2020-07-14  8:09 UTC (permalink / raw)
  To: pve-devel

Reported in our community forum:
https://forum.proxmox.com/threads/vzdump-hook-problem-after-last-update.72889/

The patchset changes the example hook-script and additionally reintroduces
the variable TARFILE to not break existing scripts (with a note to drop this
with PVE 7.0).

The second patch is there for a smoother experience of the existing users of
hook-scripts - Maybe we could also just mention it explicitly in the changelog?

feel free to squash the patches if applying both.

Stoiko Ivanov (2):
  vzdump-hook-script: rename TARFILE to TARGET
  VZDump: add TARFILE to environment for hookscripts

 PVE/VZDump.pm         | 2 ++
 vzdump-hook-script.pl | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH manager 1/2] vzdump-hook-script: rename TARFILE to TARGET
  2020-07-14  8:09 [pve-devel] [PATCH manager 0/2] readd TARFILE environment variable in VZDump Stoiko Ivanov
@ 2020-07-14  8:09 ` Stoiko Ivanov
  2020-07-14  8:09 ` [pve-devel] [PATCH manager 2/2] VZDump: add TARFILE to environment for hookscripts Stoiko Ivanov
  2020-07-14  8:31 ` [pve-devel] applied-series: [PATCH manager 0/2] readd TARFILE environment variable in VZDump Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2020-07-14  8:09 UTC (permalink / raw)
  To: pve-devel

with the change introduced in 848cf539e59b4553559b9ff3207a3c5556dc1cc0 the
exported variable name changed from tarfile to target.

this patch reflects the renaming in the example hook script.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 vzdump-hook-script.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vzdump-hook-script.pl b/vzdump-hook-script.pl
index 4be46211..1be440b3 100755
--- a/vzdump-hook-script.pl
+++ b/vzdump-hook-script.pl
@@ -43,17 +43,17 @@ if ($phase eq 'job-start' ||
 
     my $hostname = $ENV{HOSTNAME};
 
-    # tarfile is only available in phase 'backup-end'
-    my $tarfile = $ENV{TARFILE};
+    # target is only available in phase 'backup-end'
+    my $target = $ENV{TARGET};
 
     # logfile is only available in phase 'log-end'
     my $logfile = $ENV{LOGFILE};
 
-    print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;storeid=$storeid;hostname=$hostname;tarfile=$tarfile;logfile=$logfile\n";
+    print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;storeid=$storeid;hostname=$hostname;target=$target;logfile=$logfile\n";
 
     # example: copy resulting backup file to another host using scp
     if ($phase eq 'backup-end') {
-        #system ("scp $tarfile backup-host:/backup-dir") == 0 ||
+        #system ("scp $target backup-host:/backup-dir") == 0 ||
         #    die "copy tar file to backup-host failed";
     }
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH manager 2/2] VZDump: add TARFILE to environment for hookscripts
  2020-07-14  8:09 [pve-devel] [PATCH manager 0/2] readd TARFILE environment variable in VZDump Stoiko Ivanov
  2020-07-14  8:09 ` [pve-devel] [PATCH manager 1/2] vzdump-hook-script: rename TARFILE to TARGET Stoiko Ivanov
@ 2020-07-14  8:09 ` Stoiko Ivanov
  2020-07-14  8:31 ` [pve-devel] applied-series: [PATCH manager 0/2] readd TARFILE environment variable in VZDump Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2020-07-14  8:09 UTC (permalink / raw)
  To: pve-devel

The renaming of tarfile to target in 848cf539e59b4553559b9ff3207a3c5556dc1cc0
can break existing vzdump hook scripts of users.
by setting the TARFILE variable in addition to TARGET the scripts will continue
to work.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 PVE/VZDump.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 601cd56e..6620e997 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -590,6 +590,8 @@ sub run_hook_script {
     foreach my $ek (qw(vmtype hostname target logfile)) {
 	$ENV{uc($ek)} = $task->{$ek} if $task->{$ek};
     }
+    # FIXME: for backwards compatibility - drop with PVE 7.0
+    $ENV{TARFILE} = $task->{target} if $task->{target};
 
     run_command ($logfd, $cmd);
 }
-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied-series: [PATCH manager 0/2] readd TARFILE environment variable in VZDump
  2020-07-14  8:09 [pve-devel] [PATCH manager 0/2] readd TARFILE environment variable in VZDump Stoiko Ivanov
  2020-07-14  8:09 ` [pve-devel] [PATCH manager 1/2] vzdump-hook-script: rename TARFILE to TARGET Stoiko Ivanov
  2020-07-14  8:09 ` [pve-devel] [PATCH manager 2/2] VZDump: add TARFILE to environment for hookscripts Stoiko Ivanov
@ 2020-07-14  8:31 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2020-07-14  8:31 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

On 14.07.20 10:09, Stoiko Ivanov wrote:
> Reported in our community forum:
> https://forum.proxmox.com/threads/vzdump-hook-problem-after-last-update.72889/
> 
> The patchset changes the example hook-script and additionally reintroduces
> the variable TARFILE to not break existing scripts (with a note to drop this
> with PVE 7.0).
> 
> The second patch is there for a smoother experience of the existing users of
> hook-scripts - Maybe we could also just mention it explicitly in the changelog?
> 
> feel free to squash the patches if applying both.
> 
> Stoiko Ivanov (2):
>   vzdump-hook-script: rename TARFILE to TARGET
>   VZDump: add TARFILE to environment for hookscripts
> 
>  PVE/VZDump.pm         | 2 ++
>  vzdump-hook-script.pl | 8 ++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 



applied series, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-14  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14  8:09 [pve-devel] [PATCH manager 0/2] readd TARFILE environment variable in VZDump Stoiko Ivanov
2020-07-14  8:09 ` [pve-devel] [PATCH manager 1/2] vzdump-hook-script: rename TARFILE to TARGET Stoiko Ivanov
2020-07-14  8:09 ` [pve-devel] [PATCH manager 2/2] VZDump: add TARFILE to environment for hookscripts Stoiko Ivanov
2020-07-14  8:31 ` [pve-devel] applied-series: [PATCH manager 0/2] readd TARFILE environment variable in VZDump Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal