api: cephfs: more checks on fs create

namely if the fs is already existing, and if there is currently a
standby mds that can be used for the new fs
previosuly, only one cephfs was possible, so these checks were not
necessary. now with pacific, it is possible to have multiple cephfs'
and we should check for those.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-10-25 16:01:31 +02:00 committed by Thomas Lamprecht
parent 0ab69d6e88
commit 028af34e3d

View File

@ -128,8 +128,14 @@ __PACKAGE__->register_method ({
die "ceph pools '$pool_data' and/or '$pool_metadata' already exist\n"
if $existing_pools->{$pool_data} || $existing_pools->{$pool_metadata};
my $fs = PVE::Ceph::Tools::ls_fs($rados);
die "ceph fs '$fs_name' already exists\n"
if (grep { $_->{name} eq $fs_name } @$fs);
my $running_mds = PVE::Ceph::Services::get_cluster_mds_state($rados);
die "no running Metadata Server (MDS) found!\n" if !scalar(keys %$running_mds);
die "no standby Metadata Server (MDS) found!\n"
if !grep { $_->{state} eq 'up:standby' } values(%$running_mds);
PVE::Storage::assert_sid_unused($fs_name) if $param->{add_storage};