* [pve-devel] [PATCH v2 storage] api: config: add/update storage: check for type mismatch first
@ 2023-06-12 14:27 Fiona Ebner
2023-06-15 12:19 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2023-06-12 14:27 UTC (permalink / raw)
To: pve-devel
This avoids confusing errors about other properties when the storage
type doesn't match. By highlighting that the type doesn't match, users
should know right away what the issue is.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Changes in v2:
* Avoid unshift, prepend type directly to loop list.
src/PVE/API2/Storage/Config.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/API2/Storage/Config.pm b/src/PVE/API2/Storage/Config.pm
index 821db21..0716916 100755
--- a/src/PVE/API2/Storage/Config.pm
+++ b/src/PVE/API2/Storage/Config.pm
@@ -87,8 +87,8 @@ sub create_or_update {
die "Storage ID '${sid}' already exists on node ${node}\n"
if !defined($scfg->{nodes}) || $scfg->{nodes}->{$node};
- push @$verify_params, 'type';
- for my $key (@$verify_params) {
+ # check for type mismatch first to get a clear error
+ for my $key ('type', $verify_params->@*) {
if (!defined($scfg->{$key})) {
die "Option '${key}' is not configured for storage '$sid', "
."expected it to be '$storage_params->{$key}'";
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-15 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 14:27 [pve-devel] [PATCH v2 storage] api: config: add/update storage: check for type mismatch first Fiona Ebner
2023-06-15 12:19 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox