forked from rook/rook
ceph: orchestrator cli name change
With https://github.com/ceph/ceph/pull/33131, the CLI has been rename 'orch' instead of 'orchestrator'. Octopus only. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
@@ -27,10 +27,13 @@ import (
|
||||
const (
|
||||
orchestratorModuleName = "orchestrator_cli"
|
||||
rookModuleName = "rook"
|
||||
orchestratorOldCLIName = "orchestrator"
|
||||
orchestratorNewCLIName = "orch"
|
||||
)
|
||||
|
||||
var (
|
||||
orchestratorInitWaitTime = 5 * time.Second
|
||||
orchestratorCLIName = orchestratorOldCLIName
|
||||
)
|
||||
|
||||
// Ceph docs about the orchestrator modules: http://docs.ceph.com/docs/master/mgr/orchestrator_cli/
|
||||
@@ -48,9 +51,12 @@ func (c *Cluster) configureOrchestratorModules() error {
|
||||
}
|
||||
|
||||
func (c *Cluster) setRookOrchestratorBackend() error {
|
||||
if c.clusterInfo.CephVersion.IsAtLeastOctopus() {
|
||||
orchestratorCLIName = orchestratorNewCLIName
|
||||
}
|
||||
// retry a few times in the case that the mgr module is not ready to accept commands
|
||||
_, err := client.ExecuteCephCommandWithRetry(func() ([]byte, error) {
|
||||
args := []string{"orchestrator", "set", "backend", "rook"}
|
||||
args := []string{orchestratorCLIName, "set", "backend", "rook"}
|
||||
return client.NewCephCommand(c.context, c.Namespace, args).RunWithTimeout(client.CmdExecuteTimeout)
|
||||
}, c.exitCode, 5, invalidArgErrorCode, orchestratorInitWaitTime)
|
||||
if err != nil {
|
||||
|
||||
@@ -88,4 +88,23 @@ func TestOrchestratorModules(t *testing.T) {
|
||||
assert.True(t, orchestratorModuleEnabled)
|
||||
assert.True(t, rookModuleEnabled)
|
||||
assert.True(t, rookBackendSet)
|
||||
|
||||
// Simulate the error because of the CLI name change
|
||||
c.clusterInfo.CephVersion = cephver.Octopus
|
||||
err = c.setRookOrchestratorBackend()
|
||||
assert.Error(t, err)
|
||||
executor.MockExecuteCommandWithOutputFileTimeout = func(debug bool, timeout time.Duration, actionName, command, outputFile string, args ...string) (string, error) {
|
||||
logger.Infof("Command: %s %v", command, args)
|
||||
if args[0] == "orch" && args[1] == "set" && args[2] == "backend" && args[3] == "rook" {
|
||||
if backendErrorCount < 5 {
|
||||
backendErrorCount++
|
||||
return "", errors.New("test simulation failure")
|
||||
}
|
||||
rookBackendSet = true
|
||||
return "", nil
|
||||
}
|
||||
return "", errors.Errorf("unexpected ceph command %q", args)
|
||||
}
|
||||
err = c.setRookOrchestratorBackend()
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user