[pve-devel] r5199 - vzdump/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Oct 4 12:02:15 CEST 2010


Author: dietmar
Date: 2010-10-04 10:02:14 +0000 (Mon, 04 Oct 2010)
New Revision: 5199

Modified:
   vzdump/trunk/ChangeLog
   vzdump/trunk/VZDump.pm
   vzdump/trunk/changelog.Debian
   vzdump/trunk/hook-script.pl
Log:


Modified: vzdump/trunk/ChangeLog
===================================================================
--- vzdump/trunk/ChangeLog	2010-10-04 09:13:12 UTC (rev 5198)
+++ vzdump/trunk/ChangeLog	2010-10-04 10:02:14 UTC (rev 5199)
@@ -1,5 +1,10 @@
 2010-10-04  Proxmox Support Team  <support at proxmox.com>
 
+	* VZDump.pm (exec_backup_task): added new hook 'log-end' - called
+	when the log file is finished/closed.
+
+	* hook-script.pl: better example hook script
+
 	* OpenVZ.pm (archive): use sed to quote shell escape character (backslash).
 
 2010-08-09  Proxmox Support Team  <support at proxmox.com>

Modified: vzdump/trunk/VZDump.pm
===================================================================
--- vzdump/trunk/VZDump.pm	2010-10-04 09:13:12 UTC (rev 5198)
+++ vzdump/trunk/VZDump.pm	2010-10-04 10:02:14 UTC (rev 5199)
@@ -1040,6 +1040,8 @@
 	system ("cp '$task->{tmplog}' '$task->{logfile}'");
     }
 
+    eval { $self->run_hook_script ('log-end', $task); };
+
     die $err if $err && $err =~ m/^interrupted by signal$/;
 }
 

Modified: vzdump/trunk/changelog.Debian
===================================================================
--- vzdump/trunk/changelog.Debian	2010-10-04 09:13:12 UTC (rev 5198)
+++ vzdump/trunk/changelog.Debian	2010-10-04 10:02:14 UTC (rev 5199)
@@ -4,6 +4,8 @@
     is now possible to backup files which contain a backslash
     character.
 
+  * added new hook 'log-end' (see hook-script.pl example).
+  
  -- Proxmox Support Team <support at proxmox.com>  Mon, 04 Oct 2010 11:10:49 +0200
 
 vzdump (1.2-7) unstable; urgency=low

Modified: vzdump/trunk/hook-script.pl
===================================================================
--- vzdump/trunk/hook-script.pl	2010-10-04 09:13:12 UTC (rev 5198)
+++ vzdump/trunk/hook-script.pl	2010-10-04 10:02:14 UTC (rev 5199)
@@ -17,11 +17,10 @@
 } elsif ($phase eq 'backup-start' || 
 	 $phase eq 'backup-end' ||
 	 $phase eq 'backup-abort' || 
+	 $phase eq 'log-end' || 
 	 $phase eq 'pre-stop' ||
 	 $phase eq 'pre-restart') {
 
-    print "HOOK: " . join (' ', @ARGV) . "\n";
-
     my $mode = shift; # stop/suspend/snapshot
 
     my $vmid = shift;
@@ -32,19 +31,25 @@
 
     my $hostname = $ENV{HOSTNAME};
 
+    # tarfile is only available in phase 'backup-end'
     my $tarfile = $ENV{TARFILE};
 
-    my $logfile = $ENV{LOGFILE};
+    # logfile is only available in phase 'log-end'
+    my $logfile = $ENV{LOGFILE}; 
 
     print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;hostname=$hostname;tarfile=$tarfile;logfile=$logfile\n";
 
-    # example: copy resulting files to another host using scp
-    #if ($phase eq 'backup-end') {
-    #	system ("scp $tarfile $logfile backup-host:/backup-dir") == 0 ||
-    #	    die "copy to backup-host failed";
-    #	unlink $tarfile;
-    #	unlink $logfile;
-    #}
+    # example: copy resulting backup file to another host using scp
+    if ($phase eq 'backup-end') {
+    	#system ("scp $tarfile backup-host:/backup-dir") == 0 ||
+    	#    die "copy tar file to backup-host failed";
+    }
+
+    # example: copy resulting log file to another host using scp
+    if ($phase eq 'log-end') {
+    	#system ("scp $logfile backup-host:/backup-dir") == 0 ||
+    	#    die "copy log file to backup-host failed";
+    }
     
 } else {
 



More information about the pve-devel mailing list