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

Christian Ebner c.ebner at proxmox.com
Wed Jun 21 15:43:21 CEST 2023


Oops, I send the wrong patch file here, will send the correct one as v2.

Please ignore this one.

> On 21.06.2023 15:28 CEST Christian Ebner <c.ebner at proxmox.com> wrote:
> 
>  
> Warn and skip if a storage with unknown storage type is encountered.
> This might happen by manually editing the storage config.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
>  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..7e7749d 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -520,6 +520,10 @@ sub parse_config {
>  	my $type = $d->{type};
>  
>  	my $def = $defaultData->{plugindata}->{$type};
> +	if (!$def) {
> +	    warn "invalid storage type for '$d'\n";
> +	    next;
> +	}
>  
>  	if ($def->{content}) {
>  	    $d->{content} = $def->{content}->[1] if !$d->{content};
> -- 
> 2.39.2





More information about the pve-devel mailing list