]> git.proxmox.com Git - pve-manager.git/commitdiff
api: ceph ec pools: make add_storages overridable default
authorAaron Lauterer <a.lauterer@proxmox.com>
Fri, 29 Apr 2022 09:28:59 +0000 (11:28 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 29 Apr 2022 12:24:04 +0000 (14:24 +0200)
The behavior of always adding the storage config was lost in commit
23c407e. But it is more sensible to make it a default that can be
changed if needed.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
PVE/API2/Ceph/Pools.pm

index 4e28453cc23140f70f3b42c440d270f889ca195d..adc2de1d6fadb53e9c861fe616e0d821609ac43d 100644 (file)
@@ -381,10 +381,10 @@ __PACKAGE__->register_method ({
        properties => {
            node => get_standard_option('pve-node'),
            add_storages => {
-               description => "Configure VM and CT storage using the new pool. ".
-                               "Always enabled for erasure coded pools.",
+               description => "Configure VM and CT storage using the new pool.",
                type => 'boolean',
                optional => 1,
+               default => "0; for erasure coded pools: 1",
            },
            'erasure-coding' => {
                description => "Create an erasure coded pool for RBD with an ".
@@ -409,6 +409,10 @@ __PACKAGE__->register_method ({
 
        my $rpcenv = PVE::RPCEnvironment::get();
        my $user = $rpcenv->get_user();
+       my $rados = PVE::RADOS->new();
+
+       my $ec = ec_parse_and_check(extract_param($param, 'erasure-coding'), $rados);
+       $add_storages = 1 if $ec && !defined $add_storages;
 
        # Ceph uses target_size_bytes
        if (defined($param->{'target_size'})) {
@@ -429,10 +433,6 @@ __PACKAGE__->register_method ({
        $param->{application} //= 'rbd';
        $param->{pg_autoscale_mode} //= 'warn';
 
-       my $rados = PVE::RADOS->new();
-
-       my $ec = ec_parse_and_check(extract_param($param, 'erasure-coding'), $rados);
-
        my $worker = sub {
            # reopen with longer timeout
            $rados = PVE::RADOS->new(timeout => PVE::Ceph::Tools::get_config('long_rados_timeout'));