From 9bc7debca597aad122d3aad3c802d51b74ec03f2 Mon Sep 17 00:00:00 2001 From: parth-gr Date: Fri, 28 Apr 2023 17:35:32 +0530 Subject: [PATCH] mgr: fix ceph dashboard login issue Dashboard ac-user-create cmd was taking more time then the usual ceph command to run, So increased the timeout to run the cmd, and now dashboard admin user is sucessfully created Closes: https://github.com/rook/rook/issues/12113 Signed-off-by: parth-gr (cherry picked from commit ed61d25fc3800005dc714475523fa42b660d25fe) --- pkg/daemon/ceph/client/command.go | 14 +++----------- pkg/operator/ceph/cluster/mgr/dashboard.go | 2 +- pkg/operator/ceph/cluster/mgr/orchestrator.go | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pkg/daemon/ceph/client/command.go b/pkg/daemon/ceph/client/command.go index 5c4e761da..ffc38fd02 100644 --- a/pkg/daemon/ceph/client/command.go +++ b/pkg/daemon/ceph/client/command.go @@ -253,23 +253,15 @@ func ExecuteRBDCommandWithTimeout(context *clusterd.Context, args []string) (str func ExecuteCephCommandWithRetry( cmd func() (string, []byte, error), - getExitCode func(err error) (int, bool), retries int, - retryOnExitCode int, waitTime time.Duration, ) ([]byte, error) { for i := 0; i < retries; i++ { action, data, err := cmd() if err != nil { - exitCode, parsed := getExitCode(err) - if parsed { - if exitCode == retryOnExitCode { - logger.Infof("command failed for %s. trying again...", action) - time.Sleep(waitTime) - continue - } - } - return nil, errors.Wrapf(err, "failed to complete command for %s", action) + logger.Infof("command failed for %s. trying again...", action) + time.Sleep(waitTime) + continue } if i > 0 { logger.Infof("action %s succeeded on attempt %d", action, i) diff --git a/pkg/operator/ceph/cluster/mgr/dashboard.go b/pkg/operator/ceph/cluster/mgr/dashboard.go index 7f0d68977..2fa57dd6d 100644 --- a/pkg/operator/ceph/cluster/mgr/dashboard.go +++ b/pkg/operator/ceph/cluster/mgr/dashboard.go @@ -230,7 +230,7 @@ func (c *Cluster) setLoginCredentials(password string) error { _, err = client.ExecuteCephCommandWithRetry(func() (string, []byte, error) { output, err := client.NewCephCommand(c.context, c.clusterInfo, args).RunWithTimeout(exec.CephCommandsTimeout) return "set dashboard creds", output, err - }, c.exitCode, 5, invalidArgErrorCode, dashboardInitWaitTime) + }, 5, dashboardInitWaitTime) if err != nil { return errors.Wrap(err, "failed to set login creds on mgr") } diff --git a/pkg/operator/ceph/cluster/mgr/orchestrator.go b/pkg/operator/ceph/cluster/mgr/orchestrator.go index 6a8a83d90..366e7e442 100644 --- a/pkg/operator/ceph/cluster/mgr/orchestrator.go +++ b/pkg/operator/ceph/cluster/mgr/orchestrator.go @@ -50,7 +50,7 @@ func (c *Cluster) setRookOrchestratorBackend() error { args := []string{"orch", "set", "backend", "rook"} output, err := client.NewCephCommand(c.context, c.clusterInfo, args).RunWithTimeout(exec.CephCommandsTimeout) return "set rook backend", output, err - }, c.exitCode, 5, invalidArgErrorCode, orchestratorInitWaitTime) + }, 5, orchestratorInitWaitTime) if err != nil { return errors.Wrap(err, "failed to set rook as the orchestrator backend") }