[pve-devel] [PATCH manager v2] add_storage creates only one ceph storage entry

Alwin Antreich a.antreich at proxmox.com
Fri Nov 9 17:43:16 CET 2018


This patch removes the separate storage entries for CT & VM to the same
ceph pool. Instead only one entry is made.

Changes v1 -> v2:
 - refert API change

Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/API2/Ceph.pm | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index f3a6d19e..8584cb51 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -712,14 +712,14 @@ __PACKAGE__->register_method ({
     }});
 
 my $add_storage = sub {
-    my ($pool, $storeid, $krbd) = @_;
+    my ($pool, $storeid) = @_;
 
     my $storage_params = {
 	type => 'rbd',
 	pool => $pool,
 	storage => $storeid,
-	krbd => $krbd // 0,
-	content => $krbd ? 'rootdir' : 'images',
+	krbd => 0,
+	content => 'rootdir,images',
     };
 
     PVE::API2::Storage::Config->create($storage_params);
@@ -1604,7 +1604,7 @@ __PACKAGE__->register_method ({
 		optional => 1,
 	    },
 	    add_storages => {
-		description => "Configure VM and CT storages using the new pool.",
+		description => "Configure VM and CT storage using the new pool.",
 		type => 'boolean',
 		optional => 1,
 	    },
@@ -1681,17 +1681,12 @@ __PACKAGE__->register_method ({
 
 	    if ($param->{add_storages}) {
 		my $err;
-		eval { $add_storage->($pool, "${pool}_vm", 0); };
+		eval { $add_storage->($pool, "${pool}"); };
 		if ($@) {
-		    warn "failed to add VM storage: $@";
+		    warn "failed to add storage: $@";
 		    $err = 1;
 		}
-		eval { $add_storage->($pool, "${pool}_ct", 1); };
-		if ($@) {
-		    warn "failed to add CT storage: $@";
-		    $err = 1;
-		}
-		die "adding storages for pool '$pool' failed, check log and add manually!\n"
+		die "adding storage for pool '$pool' failed, check log and add manually!\n"
 		    if $err;
 	    }
 	};
-- 
2.11.0





More information about the pve-devel mailing list