[pve-devel] [PATCH manager] vzdump: pass logfunc down into storage plugin when updating volume attribute

Christoph Heiss c.heiss at proxmox.com
Mon Jan 2 13:36:32 CET 2023


Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 PVE/VZDump.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index a04837e7..6086e80a 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -1079,6 +1079,8 @@ sub exec_backup_task {
 	    debugmsg ('info', "archive file size: $cs", $logfd);
 	}

+	my $logfunc = sub { debugmsg($_[0], $_[1], $logfd) };
+
 	# Mark as protected before pruning.
 	if (my $storeid = $opts->{storage}) {
 	    my $volname = $opts->{pbs} ? $task->{target} : basename($task->{target});
@@ -1090,14 +1092,14 @@ sub exec_backup_task {
 		if (my $err = $@) {
 		    debugmsg('warn', "unable to add notes - $err", $logfd);
 		} else {
-		    eval { PVE::Storage::update_volume_attribute($cfg, $volid, 'notes', $notes) };
+		    eval { PVE::Storage::update_volume_attribute($cfg, $volid, 'notes', $notes, $logfunc) };
 		    debugmsg('warn', "unable to add notes - $@", $logfd) if $@;
 		}
 	    }

 	    if ($opts->{protected}) {
 		debugmsg('info', "marking backup as protected", $logfd);
-		eval { PVE::Storage::update_volume_attribute($cfg, $volid, 'protected', 1) };
+		eval { PVE::Storage::update_volume_attribute($cfg, $volid, 'protected', 1, $logfunc) };
 		die "unable to set protected flag - $@\n" if $@;
 	    }
 	}
@@ -1126,7 +1128,7 @@ sub exec_backup_task {
 		    $vmid,
 		    $vmtype,
 		    0,
-		    sub { debugmsg($_[0], $_[1], $logfd) },
+		    $logfunc,
 		);
 		$pruned = scalar(grep { $_->{mark} eq 'remove' } $pruned_list->@*);
 	    }
--
2.30.2






More information about the pve-devel mailing list