]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/API2/Ceph/Pools.pm
api: ceph: $get_storages check if data-pool too
[pve-manager.git] / PVE / API2 / Ceph / Pools.pm
index b7b1460e0027162366332c64b30e8e7bf888fa6e..05855e15d317441264538e53e346ea34854235f2 100644 (file)
@@ -302,8 +302,13 @@ my $get_storages = sub {
     my $res = {};
     foreach my $storeid (keys %$storages) {
        my $curr = $storages->{$storeid};
-       $res->{$storeid} = $storages->{$storeid}
-           if $curr->{type} eq 'rbd' && $pool eq $curr->{pool};
+       next if $curr->{type} ne 'rbd';
+       if (
+           $pool eq $curr->{pool} ||
+           (defined $curr->{'data-pool'} && $pool eq $curr->{'data-pool'})
+       ) {
+           $res->{$storeid} = $storages->{$storeid};
+       }
     }
 
     return $res;
@@ -370,14 +375,8 @@ __PACKAGE__->register_method ({
            PVE::Ceph::Tools::create_pool($pool, $param);
 
            if ($add_storages) {
-               my $err;
-               eval { $add_storage->($pool, "${pool}"); };
-               if ($@) {
-                   warn "failed to add storage: $@";
-                   $err = 1;
-               }
-               die "adding storage for pool '$pool' failed, check log and add manually!\n"
-                   if $err;
+               eval { $add_storage->($pool, "${pool}") };
+               die "adding PVE storage for ceph pool '$pool' failed: $@\n" if $@;
            }
        };