]> git.proxmox.com Git - pve-storage.git/commitdiff
pbs: wrap getting list volumes for pruning for error context
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Nov 2022 14:22:08 +0000 (15:22 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Nov 2022 14:22:14 +0000 (15:22 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/Storage/PBSPlugin.pm

index 603529faccd34208462f8b96543f03c17ef36941..633c399ca1dcb79a7156ea8274d545c45b4b06dd 100644 (file)
@@ -403,7 +403,8 @@ sub prune_backups {
 
     $logfunc //= sub { print "$_[1]\n" };
 
-    my $backups = $class->list_volumes($storeid, $scfg, $vmid, ['backup']);
+    my $backups = eval { $class->list_volumes($storeid, $scfg, $vmid, ['backup']) };
+    die "failed to get list of all backups to prune - $@" if $@;
 
     $type = 'vm' if defined($type) && $type eq 'qemu';
     $type = 'ct' if defined($type) && $type eq 'lxc';
@@ -411,7 +412,6 @@ sub prune_backups {
     my $backup_groups = {};
     foreach my $backup (@{$backups}) {
        (my $backup_type = $backup->{format}) =~ s/^pbs-//;
-
        next if defined($type) && $backup_type ne $type;
 
        my $backup_group = "$backup_type/$backup->{vmid}";