[pve-devel] [PATCH storage v2 3/3] fix #1929: only check storage if user want to create one

Dominik Csapak d.csapak at proxmox.com
Tue Sep 25 10:38:02 CEST 2018


this is useful if a user wants to create similar storage on each host

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* renamed
* only fixes the bug

 PVE/API2/Disks/Directory.pm | 2 +-
 PVE/API2/Disks/LVM.pm       | 2 +-
 PVE/API2/Disks/LVMThin.pm   | 2 +-
 PVE/API2/Disks/ZFS.pm       | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Disks/Directory.pm b/PVE/API2/Disks/Directory.pm
index f076ee7..d76cf10 100644
--- a/PVE/API2/Disks/Directory.pm
+++ b/PVE/API2/Disks/Directory.pm
@@ -202,7 +202,7 @@ __PACKAGE__->register_method ({
 
 	$dev = PVE::Diskmanage::verify_blockdev_path($dev);
 	PVE::Diskmanage::check_unused($dev);
-	PVE::Storage::check_available($name);
+	PVE::Storage::check_available($name) if $param->{add_storage};
 
 	my $worker = sub {
 	    my $path = "/mnt/pve/$name";
diff --git a/PVE/API2/Disks/LVM.pm b/PVE/API2/Disks/LVM.pm
index 82c1502..9556a24 100644
--- a/PVE/API2/Disks/LVM.pm
+++ b/PVE/API2/Disks/LVM.pm
@@ -150,7 +150,7 @@ __PACKAGE__->register_method ({
 
 	$dev = PVE::Diskmanage::verify_blockdev_path($dev);
 	PVE::Diskmanage::check_unused($dev);
-	PVE::Storage::check_available($name);
+	PVE::Storage::check_available($name) if $param->{add_storage};
 
 	my $worker = sub {
 	    PVE::Diskmanage::locked_disk_action(sub {
diff --git a/PVE/API2/Disks/LVMThin.pm b/PVE/API2/Disks/LVMThin.pm
index 62d3b61..717897d 100644
--- a/PVE/API2/Disks/LVMThin.pm
+++ b/PVE/API2/Disks/LVMThin.pm
@@ -104,7 +104,7 @@ __PACKAGE__->register_method ({
 
 	$dev = PVE::Diskmanage::verify_blockdev_path($dev);
 	PVE::Diskmanage::check_unused($dev);
-	PVE::Storage::check_available($name);
+	PVE::Storage::check_available($name) if $param->{add_storage};
 
 	my $worker = sub {
 	    PVE::Diskmanage::locked_disk_action(sub {
diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm
index 19ccedf..a44f573 100644
--- a/PVE/API2/Disks/ZFS.pm
+++ b/PVE/API2/Disks/ZFS.pm
@@ -344,7 +344,7 @@ __PACKAGE__->register_method ({
 	    PVE::Diskmanage::check_unused($dev);
 	}
 
-	PVE::Storage::check_available($name);
+	PVE::Storage::check_available($name) if $param->{add_storage};
 
 	my $numdisks = scalar(@$devs);
 	my $mindisks = {
-- 
2.11.0





More information about the pve-devel mailing list