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

Christian Ebner c.ebner at proxmox.com
Wed Jun 21 15:47:00 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>
---
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;
+	}
 
 	my $def = $defaultData->{plugindata}->{$type};
 
-- 
2.39.2






More information about the pve-devel mailing list