From 028af34e3db6f8fa7bdae879d9ff6df662ea306d Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 25 Oct 2021 16:01:31 +0200 Subject: [PATCH] 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 --- PVE/API2/Ceph/FS.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/API2/Ceph/FS.pm b/PVE/API2/Ceph/FS.pm index cdced31a..845c4fbd 100644 --- a/PVE/API2/Ceph/FS.pm +++ b/PVE/API2/Ceph/FS.pm @@ -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};