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

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


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