* [pve-devel] [PATCH v2 storage] plugin: handle invalid storage types
@ 2023-06-21 13:47 Christian Ebner
2023-08-21 12:11 ` Fiona Ebner
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2023-06-21 13:47 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>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pve-devel] [PATCH v2 storage] plugin: handle invalid storage types
2023-06-21 13:47 [pve-devel] [PATCH v2 storage] plugin: handle invalid storage types Christian Ebner
@ 2023-08-21 12:11 ` Fiona Ebner
0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2023-08-21 12:11 UTC (permalink / raw)
To: Proxmox VE development discussion, Christian Ebner
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@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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-21 12:11 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:47 [pve-devel] [PATCH v2 storage] plugin: handle invalid storage types Christian Ebner
2023-08-21 12:11 ` Fiona Ebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal