public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH guest-common 4/4] cleanup storeid_list creation
Date: Thu,  1 Oct 2020 13:15:35 +0200	[thread overview]
Message-ID: <20201001111535.13721-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20201001111535.13721-1-f.ebner@proxmox.com>

Signed-off-by: Fabian Ebner <f.ebner@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





      parent reply	other threads:[~2020-10-01 11:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 11:15 [pve-devel] [PATCH manager 1/4] remove all stale replicated volumes Fabian Ebner
2020-10-01 11:15 ` [pve-devel] [PATCH guest-common 2/4] also consider storages from replication state on full removal Fabian Ebner
2020-10-01 11:15 ` [pve-devel] [PATCH guest-common 3/4] rely only on storeid_list " Fabian Ebner
2020-10-01 11:15 ` Fabian Ebner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201001111535.13721-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal