[pve-devel] [RFC storage] zfspoolplugin: check if mounted instead of imported

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Feb 18 14:37:17 CET 2021


On 18.02.21 14:34, Thomas Lamprecht wrote:
>>>> +    if (!defined($dataset_mounted->())) {  
>>> don't complicated boolean, drop the defined.
>> in that case the return value of $dataset_mounted->() is ternary:
> Then the more NAK'd for my taste, that method being ternary is IMO
> not nice and sensible.
> 
> Please, make it boolean (in the perverse sense perl defines bool)
> 
>> * undefined - error during `zfs get` -> we most likely need to import the
>>   pool

And here I do not mean I do not want to have such a heuristic or the like,
but I'd like it a bit more explicit, as having defined but false and undefined
differ is always a bit a recipe for misuse (yeah it's a local closure so it
doesn't need to be held against the standards of a "public" method but still,
not ideal.

Maybe avoid the eval in the closure and handle the error explicit?





More information about the pve-devel mailing list