[pve-devel] [PATCH v2 storage] plugin: handle invalid storage types

Fiona Ebner f.ebner at proxmox.com
Mon Aug 21 14:11:41 CEST 2023


Am 21.06.23 um 15:47 schrieb Christian Ebner:
> Warn and skip if a storage with unknown storage type is encountered.
> This might happen by manually editing the storage config.
> 

or having used a third-party plugin in the past.

> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> Changes since v1:
>   - v1 contained the wrong diff
> 
>  src/PVE/Storage/Plugin.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 9d3b1ae..732f27e 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -518,6 +518,10 @@ sub parse_config {
>      foreach my $storeid (keys %$ids) {
>  	my $d = $ids->{$storeid};
>  	my $type = $d->{type};
> +	if (!$type) {
> +	    warn "invalid storage type for '$storeid'\n";
> +	    next;
> +	}
>  

Isn't this already done by the parent parser in SectionConfig.pm? At
least I get a

> file /etc/pve/storage.cfg line 55 (skip section 'bar'): unsupported type 'foo'

and no other errors with an invalid entry using pvesm status.





More information about the pve-devel mailing list