public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] plugin: handle invalid storage types
@ 2023-06-21 13:28 Christian Ebner
  2023-06-21 13:43 ` Christian Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2023-06-21 13:28 UTC (permalink / raw)
  To: pve-devel

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@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH storage] plugin: handle invalid storage types
  2023-06-21 13:28 [pve-devel] [PATCH storage] plugin: handle invalid storage types Christian Ebner
@ 2023-06-21 13:43 ` Christian Ebner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Ebner @ 2023-06-21 13:43 UTC (permalink / raw)
  To: pve-devel

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@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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-21 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 13:28 [pve-devel] [PATCH storage] plugin: handle invalid storage types Christian Ebner
2023-06-21 13:43 ` Christian Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal