[pve-devel] [PATCH storage 2/3] disks: die if storage name is already in use

Dominik Csapak d.csapak at proxmox.com
Thu Jul 14 14:30:08 CEST 2022



On 7/14/22 14:12, Fabian Ebner wrote:
> Am 14.07.22 um 13:13 schrieb Dominik Csapak:> On 7/13/22 12:47, Aaron
> Lauterer wrote:
>>> +    my $poollist = { map { $_->{name} => 1 } @{$pools} };
>>
>> does that really make sense here? would it not be easier to just
>> iterate? e.g.
>>
>> ----
>> for my $pool (@$pools) {
>>      die "..." if $pool->{name} eq $name;
>> }
>> ----
>>
>> (i admit, it's 1 line longer, but a bit more readable?)
>>
>>> +    die "pool '${name}' already exists on node '$node'\n" if
> 
> Or just use grep ;)
> 

even better :) (i always forget about perls grep)





More information about the pve-devel mailing list