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

Failing to detect SSDs in copyDir should not be a fatal error. #3653

Merged
merged 6 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions internal/pkg/agent/application/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,16 @@ func copyDir(l *logger.Logger, from, to string, ignoreErrs bool) error {
}
}

// Try to detect if we are running with SSDs. If we are increase the copy concurrency,
// otherwise fall back to the default.
copyConcurrency := 1
block, err := ghw.Block()
if err != nil {
return fmt.Errorf("ghw.Block() returned error: %w", err)
}

copyConcurrency := 1
if install.HasAllSSDs(*block) {
copyConcurrency = runtime.NumCPU() * 4
l.Warnw("Error detecting block storage type", "error.message", err)
} else {
if install.HasAllSSDs(*block) {
copyConcurrency = runtime.NumCPU() * 4
}
}

return copy.Copy(from, to, copy.Options{
Expand Down
Loading