From b89854ad4615bd3cb6d983e4efe7f74cf23ef1bd Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 17 Jun 2023 14:51:20 +0200 Subject: [PATCH] disk management api: comment how storages are added and cleanup style Signed-off-by: Thomas Lamprecht --- src/PVE/API2/Disks/Directory.pm | 14 +++----------- src/PVE/API2/Disks/LVM.pm | 14 +++----------- src/PVE/API2/Disks/LVMThin.pm | 14 +++----------- src/PVE/API2/Disks/ZFS.pm | 14 +++----------- 4 files changed, 12 insertions(+), 44 deletions(-) diff --git a/src/PVE/API2/Disks/Directory.pm b/src/PVE/API2/Disks/Directory.pm index 4fdb068..efc701a 100644 --- a/src/PVE/API2/Disks/Directory.pm +++ b/src/PVE/API2/Disks/Directory.pm @@ -221,13 +221,9 @@ __PACKAGE__->register_method ({ my $verify_params = [qw(path)]; if ($param->{add_storage}) { + # reserve the name and add as disabled, will be enabled below if creation works out PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - 1, - ); + $name, $node, $storage_params, $verify_params, 1); } my $mounted = PVE::Diskmanage::mounted_paths(); @@ -306,11 +302,7 @@ __PACKAGE__->register_method ({ if ($param->{add_storage}) { PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - ); + $name, $node, $storage_params, $verify_params); } }); }; diff --git a/src/PVE/API2/Disks/LVM.pm b/src/PVE/API2/Disks/LVM.pm index fe87545..c091e37 100644 --- a/src/PVE/API2/Disks/LVM.pm +++ b/src/PVE/API2/Disks/LVM.pm @@ -162,13 +162,9 @@ __PACKAGE__->register_method ({ my $verify_params = [qw(vgname)]; if ($param->{add_storage}) { + # reserve the name and add as disabled, will be enabled below if creation works out PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - 1, - ); + $name, $node, $storage_params, $verify_params, 1); } my $worker = sub { @@ -188,11 +184,7 @@ __PACKAGE__->register_method ({ if ($param->{add_storage}) { PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - ); + $name, $node, $storage_params, $verify_params); } }); }; diff --git a/src/PVE/API2/Disks/LVMThin.pm b/src/PVE/API2/Disks/LVMThin.pm index 038310a..89b6401 100644 --- a/src/PVE/API2/Disks/LVMThin.pm +++ b/src/PVE/API2/Disks/LVMThin.pm @@ -120,13 +120,9 @@ __PACKAGE__->register_method ({ my $verify_params = [qw(vgname thinpool)]; if ($param->{add_storage}) { + # reserve the name and add as disabled, will be enabled below if creation works out PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - 1, - ); + $name, $node, $storage_params, $verify_params, 1); } my $worker = sub { @@ -167,11 +163,7 @@ __PACKAGE__->register_method ({ if ($param->{add_storage}) { PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - ); + $name, $node, $storage_params, $verify_params); } }); }; diff --git a/src/PVE/API2/Disks/ZFS.pm b/src/PVE/API2/Disks/ZFS.pm index a9dc3a7..afd9a3e 100644 --- a/src/PVE/API2/Disks/ZFS.pm +++ b/src/PVE/API2/Disks/ZFS.pm @@ -383,13 +383,9 @@ __PACKAGE__->register_method ({ my $verify_params = [qw(pool)]; if ($param->{add_storage}) { + # reserve the name and add as disabled, will be enabled below if creation works out PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - 1, - ); + $name, $node, $storage_params, $verify_params, 1); } my $pools = get_pool_data(); @@ -495,11 +491,7 @@ __PACKAGE__->register_method ({ if ($param->{add_storage}) { PVE::API2::Storage::Config->create_or_update( - $name, - $node, - $storage_params, - $verify_params, - ); + $name, $node, $storage_params, $verify_params); } };