[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 11:59:53 CET 2024


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.




More information about the pve-devel mailing list