[pve-devel] [PATCH manager] pvesr: prepare_local_job: fixup

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jun 8 11:40:03 CEST 2017


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
note: viewing the diff with -w shows the actual, very small delta.

sorry for the noise (tests give identical output now compared to HEAD^2 - so
this should be OK)

 PVE/CLI/pvesr.pm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/PVE/CLI/pvesr.pm b/PVE/CLI/pvesr.pm
index 3ca01c86..f64a3103 100644
--- a/PVE/CLI/pvesr.pm
+++ b/PVE/CLI/pvesr.pm
@@ -129,18 +129,19 @@ __PACKAGE__->register_method ({
 	my $snapname = PVE::ReplicationState::replication_snapshot_name($jobid, $last_sync);
 
 	# find replication snapshots
+	my $volids = [];
 	foreach my $storeid (@$storage_list) {
 	    my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
 	    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 	    my $images = $plugin->list_images($storeid, $scfg, $vmid, undef, $cache);
-	    my $volids = [ map { $_->{volid} } @$images ];
-	    my ($last_snapshots, $cleaned_replicated_volumes) = PVE::Replication::prepare($storecfg, $volids, $jobid, $last_sync, $parent_snapname, $logfunc);
-	    foreach my $volid (keys %$cleaned_replicated_volumes) {
-		if (!$wanted_volids->{$volid}) {
-		    $logfunc->("$jobid: delete stale volume '$volid'");
-		    PVE::Storage::vdisk_free($storecfg, $volid);
-		    delete $last_snapshots->{$volid};
-		}
+	    push @$volids, map { $_->{volid} } @$images;
+	}
+	my ($last_snapshots, $cleaned_replicated_volumes) = PVE::Replication::prepare($storecfg, $volids, $jobid, $last_sync, $parent_snapname, $logfunc);
+	foreach my $volid (keys %$cleaned_replicated_volumes) {
+	    if (!$wanted_volids->{$volid}) {
+		$logfunc->("$jobid: delete stale volume '$volid'");
+		PVE::Storage::vdisk_free($storecfg, $volid);
+		delete $last_snapshots->{$volid};
 	    }
 	}
 
-- 
2.11.0





More information about the pve-devel mailing list