api: config: add/update storage: check for type mismatch first

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>
This commit is contained in:
Fiona Ebner
2023-06-12 16:27:33 +02:00
committed by Thomas Lamprecht
parent da6be324d9
commit 46b9c1fe31

View File

@ -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}'";