Skip to content

HDDS-16182. Extend container balancer start command with auto-config - #11906

Open
sreejasahithi wants to merge 3 commits into
apache:masterfrom
sreejasahithi:HDDS-16182
Open

sreejasahithi wants to merge 3 commits into
apache:masterfrom
sreejasahithi:HDDS-16182

Conversation

@sreejasahithi

@sreejasahithi sreejasahithi commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR adds --auto-config (and optional --profile) to ozone admin containerbalancer start. The command reads current datanode usage from SCM, runs the existing container balancer advisor (MEDIUM profile by default), and starts the balancer with the recommended settings. Explicit flags (for example -i, -e, size and timeout options) still apply during recommendation and at start. If the cluster is already balanced, it prints a message and does not start the balancer.

What is the link to the Apache JIRA

HDDS-16182

How was this patch tested?

Unit tests in TestContainerBalancerSubCommand for --auto-config, overrides, --profile validation, and the balanced-cluster no-start path.

Green CI : https://github.com/sreejasahithi/ozone/actions/runs/41023328534

@sreejasahithi
sreejasahithi marked this pull request as ready for review November 17, 2026 04:43
@sreejasahithi

Copy link
Copy Markdown
Contributor Author

@ashishkumar50 could you please review this PR.

@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks @sreejasahithi for the patch.

Workflows are not currently being run on this fork due to the scale of GitHub Actions usage. A repository maintainer can choose to re-enable these

Can you please re-enable workflows in your fork and push a change to trigger it for this PR? Afterwards you may want to manually disable:

  • close-stale-prs
  • scheduled-label-pull-requests

@sarvekshayr sarvekshayr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sreejasahithi for working on this.

  1. Currently start command with --auto-config only prints -
Starting with auto-configured parameters (profile: MEDIUM).
Container Balancer started successfully.

The user can’t see what was actually applied. Could we print the effective parameters (and where each came from: user override, profile or configuration) before starting? The rationale map is already available, or we could reuse the suggested-command builder. That makes a bad override visible and lets users reproduce the run.

Alternatively, print the equivalent ozone admin containerbalancer start ... command that estimate and recommend already build, so the user can copy and re-run it.

The values it started with aren’t shown. As discussed, status -v already prints the configuration the balancer is running with, so that is enough and we don’t need to print them again at start.

It would help to say so where users will look. Could we mention it in the --auto-config option description and/or in the output, for example:

Starting with auto-configured parameters (profile: MEDIUM).
Use "ozone admin containerbalancer status -v" to see the configuration in use.
  1. Normalize all recommended values to the units start command accepts, in one place. Then floorToWholeGb, bytesToGb and the / 60000 helpers can be removed.

… to minutes in one place, and added a status --verbose hint to start --auto-config

@ashishkumar50 ashishkumar50 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sreejasahithi Thanks for the patch.

byteDesc(estimation.getMaxSizeLeavingSource())));
rationale.put("maxSizeEnteringTarget", String.format(
"profile default (%d GB)", estimation.getMaxSizeEnteringTarget() / OzoneConsts.GB));
"profile default (%d GB)", maxSizeEnteringTargetGb));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommendation calculation supports user-provided overrides, but the rationale still reports configuration/profile defaults?

? request.maxSizeToMovePerIteration
: computeRecommendedMaxSizeToMove(configCeiling, initialEstimation);
// Normalize to whole GB, the unit accepted by the start command.
long maxSizeToMoveGb = recommendedMaxMove / OzoneConsts.GB;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the normalized values always satisfy:

- maxSizeToMovePerIteration > 0
- maxSizeEnteringTarget <= maxSizeToMovePerIteration
- maxSizeLeavingSource <= maxSizeToMovePerIteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants