nfs: fail if no mds are running

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 <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2019-09-16 09:48:58 +02:00
1 parent 4dc63402a5
commit c0843f2184
1 file changed
+8
+8
View File
@@ -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
}