From c0843f21849741ce05f0cd2f86e1b6062f67d3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 13 Sep 2019 14:27:34 +0200 Subject: [PATCH] nfs: fail if no mds are running MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to run ganesha exporting cephfs we must have an MDS server running. So, we check if the pool was created. If not present we fail the instanciation of the CR. Closes: https://github.com/rook/rook/issues/3835 Signed-off-by: Sébastien Han --- pkg/operator/ceph/nfs/nfs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/operator/ceph/nfs/nfs.go b/pkg/operator/ceph/nfs/nfs.go index 7659c93c2..03849d1f8 100644 --- a/pkg/operator/ceph/nfs/nfs.go +++ b/pkg/operator/ceph/nfs/nfs.go @@ -25,6 +25,7 @@ import ( cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" "github.com/rook/rook/pkg/clusterd" + "github.com/rook/rook/pkg/daemon/ceph/client" cephclient "github.com/rook/rook/pkg/daemon/ceph/client" cephconfig "github.com/rook/rook/pkg/daemon/ceph/config" opmon "github.com/rook/rook/pkg/operator/ceph/cluster/mon" @@ -240,5 +241,12 @@ func validateGanesha(context *clusterd.Context, n cephv1.CephNFS) error { return fmt.Errorf("at least one active server required") } + // We cannot run an NFS server if no MDS is running + // The existence of the pool provided in n.Spec.RADOS.Pool is necessary otherwise addRADOSConfigFile() will fail + _, err := client.GetPoolDetails(context, n.Namespace, n.Spec.RADOS.Pool) + if err != nil { + return fmt.Errorf("pool %s not found, did the filesystem cr successfully complete? %+v", n.Spec.RADOS.Pool, err) + } + return nil }