[pve-devel] [PATCH guest-common 4/4] cleanup storeid_list creation

Fabian Ebner f.ebner at proxmox.com
Thu Oct 1 13:15:35 CEST 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Not sure if the expression for map{} is too cluttered here...

 PVE/Replication.pm | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/PVE/Replication.pm b/PVE/Replication.pm
index 60cfc67..132e8bb 100644
--- a/PVE/Replication.pm
+++ b/PVE/Replication.pm
@@ -262,12 +262,8 @@ sub replicate {
     my ($base_snapshots, $last_snapshots, $last_sync_snapname) = find_common_replication_snapshot(
 	$ssh_info, $jobid, $vmid, $storecfg, $sorted_volids, $state->{storeid_list}, $last_sync, $parent_snapname, $logfunc);
 
-    my $storeid_hash = {};
-    foreach my $volid (@$sorted_volids) {
-	my ($storeid) = PVE::Storage::parse_volume_id($volid);
-	$storeid_hash->{$storeid} = 1;
-    }
-    $state->{storeid_list} = [ sort keys %$storeid_hash ];
+    my %storeid_hash = map { (PVE::Storage::parse_volume_id($_))[0] => 1 } @$sorted_volids;
+    $state->{storeid_list} = [ sort keys %storeid_hash ];
 
     # freeze filesystem for data consistency
     if ($freezefs) {
-- 
2.20.1






More information about the pve-devel mailing list