[pve-devel] [PATCH manager 1/1] add_storage creates only one ceph storage entry
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Nov 9 17:07:18 CET 2018
On 11/8/18 2:05 PM, Alwin Antreich wrote:
> 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 => {
that's an API change! this cannot be done "silently" here and now...
This won't work with our current GUI, and external API users won't be
happy either.
So either just wait for 6.0 to do this or add this as second parameter
and mark the add_storages as outdated but honor it if set (the new one
would be preferred if both are set and contradict each other..)
> + 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;
> }
> };
>
More information about the pve-devel
mailing list