]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage.pm
prune mark: correctly keep track of already included backups
[pve-storage.git] / PVE / Storage.pm
index 8d904d74903e8af2d3780d24e6949c8b63e2ccf9..c1a21b43d96adfa7e587c87b2b3828fa57df1d85 100755 (executable)
@@ -217,6 +217,26 @@ sub file_size_info {
     return PVE::Storage::Plugin::file_size_info($filename, $timeout);
 }
 
+sub get_volume_notes {
+    my ($cfg, $volid, $timeout) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid);
+    my $scfg = storage_config($cfg, $storeid);
+    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+
+    return $plugin->get_volume_notes($scfg, $storeid, $volname, $timeout);
+}
+
+sub update_volume_notes {
+    my ($cfg, $volid, $notes, $timeout) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid);
+    my $scfg = storage_config($cfg, $storeid);
+    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+
+    $plugin->update_volume_notes($scfg, $storeid, $volname, $notes, $timeout);
+}
+
 sub volume_size_info {
     my ($cfg, $volid, $timeout) = @_;
 
@@ -1626,13 +1646,14 @@ my $prune_mark = sub {
     foreach my $prune_entry (@{$prune_entries}) {
        my $mark = $prune_entry->{mark};
        my $id = $id_func->($prune_entry->{ctime});
+       $already_included->{$id} = 1 if defined($mark) && $mark eq 'keep';
+    }
 
-       next if $already_included->{$id};
+    foreach my $prune_entry (@{$prune_entries}) {
+       my $mark = $prune_entry->{mark};
+       my $id = $id_func->($prune_entry->{ctime});
 
-       if (defined($mark)) {
-           $already_included->{$id} = 1 if $mark eq 'keep';
-           next;
-       }
+       next if defined($mark) || $already_included->{$id};
 
        if (!$newly_included->{$id}) {
            last if scalar(keys %{$newly_included}) >= $keep_count;