Skip to content

Commit

Permalink
Merge pull request #9269 from rook/mergify/bp/release-1.7/pr-9264
Browse files Browse the repository at this point in the history
cephfs-mirror: various fixes for random bootstrap peer import errors (backport #9264)
  • Loading branch information
leseb committed Nov 29, 2021
2 parents 3a7dfdd + c0d0f16 commit cf2b787
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions pkg/daemon/ceph/client/command.go
Expand Up @@ -96,16 +96,18 @@ type CephToolCommand struct {
args []string
timeout time.Duration
JsonOutput bool
combinedOutput bool
RemoteExecution bool
}

func newCephToolCommand(tool string, context *clusterd.Context, clusterInfo *ClusterInfo, args []string) *CephToolCommand {
return &CephToolCommand{
context: context,
tool: tool,
clusterInfo: clusterInfo,
args: args,
JsonOutput: true,
context: context,
tool: tool,
clusterInfo: clusterInfo,
args: args,
JsonOutput: true,
combinedOutput: false,
}
}

Expand Down Expand Up @@ -168,7 +170,11 @@ func (c *CephToolCommand) run() ([]byte, error) {
output, err = c.context.Executor.ExecuteCommandWithTimeout(c.timeout, command, args...)
}
} else if c.timeout == 0 {
output, err = c.context.Executor.ExecuteCommandWithOutput(command, args...)
if c.combinedOutput {
output, err = c.context.Executor.ExecuteCommandWithCombinedOutput(command, args...)
} else {
output, err = c.context.Executor.ExecuteCommandWithOutput(command, args...)
}
} else {
output, err = c.context.Executor.ExecuteCommandWithTimeout(c.timeout, command, args...)
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/daemon/ceph/client/filesystem_mirror.go
Expand Up @@ -170,8 +170,10 @@ func ImportFSMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *Cluster
logger.Infof("importing cephfs bootstrap peer token for filesystem %q", fsName)

// Build command
args := []string{"fs", "snapshot", "mirror", "peer_bootstrap", "import", fsName, token}
args := []string{"fs", "snapshot", "mirror", "peer_bootstrap", "import", fsName, strings.TrimSpace(token)}
cmd := NewCephCommand(context, clusterInfo, args)
cmd.JsonOutput = false
cmd.combinedOutput = true

// Run command
output, err := cmd.Run()
Expand Down

0 comments on commit cf2b787

Please sign in to comment.