[pve-devel] [PATCH v2 storage] lvm: improve warning in case vgs output contains unexpected lines
Friedrich Weber
f.weber at proxmox.com
Tue Jan 23 11:01:29 CET 2024
On 19/01/2024 12:31, Fiona Ebner wrote:
> Am 19.01.24 um 11:59 schrieb Fiona Ebner:
>> Am 18.01.24 um 12:11 schrieb Friedrich Weber:
>>> diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
>>> index 4b951e7..5377823 100644
>>> --- a/src/PVE/Storage/LVMPlugin.pm
>>> +++ b/src/PVE/Storage/LVMPlugin.pm
>>> @@ -130,6 +130,11 @@ sub lvm_vgs {
>>>
>>> my ($name, $size, $free, $lvcount, $pvname, $pvsize, $pvfree) = split (':', $line);
>>>
>>> + if (!defined($size) || !defined($free) || !defined($lvcount)) {
>>> + warn "unexpected output from vgs: $line\n";
>>> + return;
>>> + }
>>> +
>>
>> Nit: maybe quote 'vgs' and/or say "command 'vgs'"?
Sounds good!
>> Please use log_warn() from PVE::RESTEnvironment for new warnings, so
>> they also show up in task logs.
>
> Sorry, I mean "show up more visibly", because they count towards the
> warning count shown in the task result.
Thanks, wasn't aware of this benefit of `log_warn`.
Will send a v3 with the two changes.
More information about the pve-devel
mailing list