[pve-devel] [PATCH manager 1/1] add_storage creates only one ceph storage entry
Alwin Antreich
a.antreich at proxmox.com
Thu Nov 8 14:05:15 CET 2018
This patch removes the separate storage entries for CT & VM to the same
ceph pool. Instead only one entry is made.
Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
PVE/API2/Ceph.pm | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index f3a6d19e..808f4c6a 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);
@@ -1603,8 +1603,8 @@ __PACKAGE__->register_method ({
enum => ['rbd', 'cephfs', 'rgw'],
optional => 1,
},
- add_storages => {
- description => "Configure VM and CT storages using the new pool.",
+ add_storage => {
+ description => "Configure VM and CT storage using the new pool.",
type => 'boolean',
optional => 1,
},
@@ -1626,7 +1626,7 @@ __PACKAGE__->register_method ({
my $rpcenv = PVE::RPCEnvironment::get();
my $user = $rpcenv->get_user();
- if ($param->{add_storages}) {
+ if ($param->{add_storage}) {
$rpcenv->check($user, '/storage', ['Datastore.Allocate']);
die "pool name contains characters which are illegal for storage naming\n"
if !PVE::JSONSchema::parse_storage_id($pool);
@@ -1679,19 +1679,14 @@ __PACKAGE__->register_method ({
app => $application,
});
- if ($param->{add_storages}) {
+ if ($param->{add_storage}) {
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