Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cephfs-mirror: various fixes for random bootstrap peer import errors #9264

Merged
merged 3 commits into from Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -173,7 +175,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