public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/3] close #3476: allow user to prepare storage for activation in job-start hook
@ 2021-12-02 11:00 Fabian Ebner
  2021-12-02 11:00 ` [pve-devel] [RFC manager 2/3] vzdump: exec_backup: pick up latest version of storage.cfg after " Fabian Ebner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabian Ebner @ 2021-12-02 11:00 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/VZDump.pm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index b5a5fadd..667c92d3 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -501,11 +501,8 @@ sub new {
 
     if ($opts->{storage}) {
 	my $storage_cfg = PVE::Storage::config();
+	# Ignore errors here. exec_backup will die if activation fails there.
 	eval { PVE::Storage::activate_storage($storage_cfg, $opts->{storage}) };
-	if (my $err = $@) {
-	    chomp($err);
-	    $errors .= "could not activate storage '$opts->{storage}': $err";
-	}
 
 	my $info = eval { storage_info ($opts->{storage}) };
 	if (my $err = $@) {
@@ -1168,6 +1165,12 @@ sub exec_backup {
 
 	$self->run_hook_script ('job-start', undef, $job_start_fd);
 
+	my $storage_cfg = PVE::Storage::config();
+
+	# activating after job-start hook, so it has a chance to prepare, e.g. wake up remote node.
+	eval { PVE::Storage::activate_storage($storage_cfg, $opts->{storage}) };
+	die "could not activate storage '$opts->{storage}': $@" if $@;
+
 	foreach my $task (@$tasklist) {
 	    $self->exec_backup_task ($task);
 	    $errcount += 1 if $task->{state} ne 'ok';
-- 
2.30.2





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

end of thread, other threads:[~2022-01-14 13:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 11:00 [pve-devel] [PATCH manager 1/3] close #3476: allow user to prepare storage for activation in job-start hook Fabian Ebner
2021-12-02 11:00 ` [pve-devel] [RFC manager 2/3] vzdump: exec_backup: pick up latest version of storage.cfg after " Fabian Ebner
2021-12-02 11:00 ` [pve-devel] [RFC manager 3/3] vzdump: new: add reminder to get rid of duplicate activate_storage Fabian Ebner
2022-01-14 11:46 ` [pve-devel] [PATCH manager 1/3] close #3476: allow user to prepare storage for activation in job-start hook Fabian Grünbichler
2022-01-14 12:39   ` Fabian Ebner
2022-01-14 13:07     ` Fabian Grünbichler

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