[pve-devel] [PATCH manager] fix #949: add post-restart hook to vzdump

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Apr 22 10:35:29 CEST 2016


---
Tested with all three modes with Qemu and LXC

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

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 59d0b5f..3101b6a 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -903,6 +903,7 @@ sub exec_backup_task {
 		$cleanup->{resume} = 0;
 		$self->run_hook_script('pre-restart', $task, $logfd);
 		$plugin->resume_vm($task, $vmid);
+		$self->run_hook_script('post-restart', $task, $logfd);
 		my $delay = time () - $vmstoptime;
 		debugmsg('info', "vm is online again after $delay seconds", $logfd);
 	    }
@@ -934,6 +935,8 @@ sub exec_backup_task {
 		debugmsg ('info', "vm is online again after $delay seconds", $logfd);
 	    }
 
+	    $self->run_hook_script ('post-restart', $task, $logfd);
+
 	} else {
 	    die "internal error - unknown mode '$mode'\n";
 	}
@@ -1010,7 +1013,8 @@ sub exec_backup_task {
 			debugmsg ('info', "restarting vm", $logfd);
 			$plugin->start_vm ($task, $vmid);
 		    }
-		} 
+		}
+		$self->run_hook_script ('post-restart', $task, $logfd);
 	    };
 	    my $err = $@;
 	    if ($err) {
diff --git a/vzdump-hook-script.pl b/vzdump-hook-script.pl
index b03fdc2..a93eeec 100755
--- a/vzdump-hook-script.pl
+++ b/vzdump-hook-script.pl
@@ -25,7 +25,8 @@ if ($phase eq 'job-start' ||
 	 $phase eq 'backup-abort' || 
 	 $phase eq 'log-end' || 
 	 $phase eq 'pre-stop' ||
-	 $phase eq 'pre-restart') {
+	 $phase eq 'pre-restart' ||
+	 $phase eq 'post-restart') {
 
     my $mode = shift; # stop/suspend/snapshot
 
-- 
2.1.4





More information about the pve-devel mailing list