[pve-devel] [PATCH v2 storage] lvm: improve warning in case vgs output contains unexpected lines

Fiona Ebner f.ebner at proxmox.com
Fri Jan 19 12:31:44 CET 2024


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'"?
> 
> 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.




More information about the pve-devel mailing list