diff --git a/pkg/daemon/ceph/client/filesystem.go b/pkg/daemon/ceph/client/filesystem.go index 920506a3a..5cc2a3f4f 100644 --- a/pkg/daemon/ceph/client/filesystem.go +++ b/pkg/daemon/ceph/client/filesystem.go @@ -108,6 +108,17 @@ func GetFilesystem(context *clusterd.Context, clusterName string, fsName string) return &fs, nil } +// AllowStandbyReplay gets detailed status information about a Ceph filesystem. +func AllowStandbyReplay(context *clusterd.Context, clusterName string, fsName string, allowStandbyReplay bool) error { + args := []string{"fs", "set", fsName, "allow_standby_replay", strconv.FormatBool(allowStandbyReplay)} + _, err := ExecuteCephCommand(context, clusterName, args) + if err != nil { + return fmt.Errorf("failed to set allow_standby_replay to filesystem %s: %+v", fsName, err) + } + + return nil +} + // CreateFilesystem performs software configuration steps for Ceph to provide a new filesystem. func CreateFilesystem(context *clusterd.Context, clusterName, name, metadataPool string, dataPools []string) error { if len(dataPools) == 0 { diff --git a/pkg/operator/ceph/file/filesystem.go b/pkg/operator/ceph/file/filesystem.go index 1fd444461..f01e58b80 100644 --- a/pkg/operator/ceph/file/filesystem.go +++ b/pkg/operator/ceph/file/filesystem.go @@ -73,6 +73,15 @@ func createFilesystem( return fmt.Errorf("failed to get filesystem %s: %+v", fs.Name, err) } + // As of Nautilus, allow_standby_replay is a fs property so we need to apply it + if cephv1.VersionAtLeast(clusterInfo.CephVersionName, cephv1.Nautilus) { + if fs.Spec.MetadataServer.ActiveStandby { + if err = client.AllowStandbyReplay(context, fs.Namespace, fs.Name, fs.Spec.MetadataServer.ActiveStandby); err != nil { + return fmt.Errorf("failed to set allow_standby_replay to filesystem %s: %v", fs.Name, err) + } + } + } + // set the number of active mds instances if fs.Spec.MetadataServer.ActiveCount > 1 { if err = client.SetNumMDSRanks(context, fs.Namespace, fs.Name, fs.Spec.MetadataServer.ActiveCount); err != nil { diff --git a/pkg/operator/ceph/file/mds/spec.go b/pkg/operator/ceph/file/mds/spec.go index 99fe32d28..7c0ed0894 100644 --- a/pkg/operator/ceph/file/mds/spec.go +++ b/pkg/operator/ceph/file/mds/spec.go @@ -20,6 +20,7 @@ import ( "fmt" "strconv" + cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" "github.com/rook/rook/pkg/clusterd" "github.com/rook/rook/pkg/operator/ceph/config" opspec "github.com/rook/rook/pkg/operator/ceph/spec" @@ -78,17 +79,25 @@ func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) *apps.Deployment { } func (c *Cluster) makeMdsDaemonContainer(mdsConfig *mdsConfig) v1.Container { - return v1.Container{ + args := append( + opspec.DaemonFlags(c.clusterInfo, config.MdsType, mdsConfig.DaemonID), + "--foreground", + ) + + // These flags are obsoleted as of Nautilus + if !cephv1.VersionAtLeast(c.cephVersion.Name, cephv1.Nautilus) { + args = append( + args, + config.NewFlag("mds-standby-for-fscid", c.fsID), + config.NewFlag("mds-standby-replay", strconv.FormatBool(c.fs.Spec.MetadataServer.ActiveStandby))) + } + + container := v1.Container{ Name: "mds", Command: []string{ "ceph-mds", }, - Args: append( - opspec.DaemonFlags(c.clusterInfo, config.MdsType, mdsConfig.DaemonID), - "--foreground", - config.NewFlag("mds-standby-for-fscid", c.fsID), - config.NewFlag("mds-standby-replay", strconv.FormatBool(c.fs.Spec.MetadataServer.ActiveStandby)), - ), + Args: args, Image: c.cephVersion.Image, VolumeMounts: opspec.DaemonVolumeMounts(mdsConfig.DataPathMap, mdsConfig.ResourceName), Env: append( @@ -96,6 +105,8 @@ func (c *Cluster) makeMdsDaemonContainer(mdsConfig *mdsConfig) v1.Container { ), Resources: c.fs.Spec.MetadataServer.Resources, } + + return container } func (c *Cluster) podLabels(mdsConfig *mdsConfig) map[string]string {