public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH guest-common] replication: avoid passing removed storages to target
Date: Wed, 30 Aug 2023 11:42:25 +0200	[thread overview]
Message-ID: <0ca984a7-f7bf-2e39-6b96-456b55d674fe@proxmox.com> (raw)
In-Reply-To: <793984cf-d2cb-4e83-b617-6f641cd8b100@proxmox.com>

Am 30.08.23 um 11:27 schrieb Thomas Lamprecht:
> Am 23/06/2023 um 12:08 schrieb Fiona Ebner:
>> +    # filter out left-over non-existing/removed storages - avoids error on target
>> +    $state->{storeid_list} = [ grep { $storecfg->{ids}->{$_} } $state->{storeid_list}->@* ];
> 
> looks fine in general, just wondering if we'd be better of to make
> the grep include-condition a bit more explicit by using `exists` on
> the hash:
> 
> $state->{storeid_list} = [ grep { exists $storecfg->{ids}->{$_} } $state->{storeid_list}->@* ];
> 
> albeit, the value should be always truthy, so might be redundant,
> depending on how you see this I can apply this patch or a v2.

I don't like using exists() expect when it's really necessary, because
it's way too easy picking up something that was auto-vivified
accidentally (shouldn't happen in this case, but still). And yes, we can
assume the value is truthy if it's an existing storage, so I didn't
bother with defined() either.




  reply	other threads:[~2023-08-30  9:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 10:08 Fiona Ebner
2023-08-30  9:12 ` Fiona Ebner
2023-08-30  9:27 ` Thomas Lamprecht
2023-08-30  9:42   ` Fiona Ebner [this message]
2023-09-01  7:40     ` Thomas Lamprecht

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=0ca984a7-f7bf-2e39-6b96-456b55d674fe@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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