Skip to content

Conversation

@sodonnel
Copy link
Contributor

@sodonnel sodonnel commented Feb 5, 2024

What changes were proposed in this pull request?

The current status command only shows nodes where the disk balancer is RUNNING. The different states can be filtered via the -s switch (RUNNING, STOPPED, UNKNOWN). The current CLI gives no way to list "all nodes".

It would be better to just output all the states by default and then allow them to be filtered with the -s switch. That way, we can list all nodes, or filter down by a specific status.

This change also simplifies the code in the CLI command a little by using an enum for the status state value, rather than a string, which can result in better errors if a wrong value is given.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-10299

How was this patch tested?

Manually via docker compose. Now the output by default looks like:

sodonnell@sodonnell-MBP16 ozone % docker exec -it ozone_scm_1 /bin/bash
bash-4.2$ ozone admin datanode diskbalancer status
Status result:
Datanode                                           VolumeDensity Status Threshold BandwidthInMB ParallelThread
ozone_datanode_1.ozone_default                     0.0 UNKNOWN 0.0 0 0

If you give an incorrect status, you get a reasonable error:

bash-4.2$ ozone admin datanode diskbalancer status --state RUNNI
Invalid value for option '--state': expected one of [RUNNING, STOPPED, UNKNOWN] (case-sensitive) but was 'RUNNI'
Usage: ozone admin datanode diskbalancer status [-hV] [-id=<scmServiceId>]
       [-s=<state>] [--scm=<scm>] [-d=<hosts>]...
Get Datanode DiskBalancer Status
  -d, --datanodes=<hosts>   Get diskBalancer status on specific datanodes.
  -h, --help                Show this help message and exit.
      -id, --service-id=<scmServiceId>
                            ServiceId of SCM HA Cluster
  -s, --state=<state>       Display only datanodes with the given status:
                              RUNNING, STOPPED, UNKNOWN.
      --scm=<scm>           The destination scm (host:port)
  -V, --version             Print version information and exit.

@sodonnel sodonnel requested a review from symious February 5, 2024 15:43
Copy link
Contributor

@symious symious left a comment

Choose a reason for hiding this comment

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

Yes, it helps with users' experience.

LGTM.

@sodonnel sodonnel merged commit d7651d1 into apache:HDDS-5713 Feb 6, 2024
symious pushed a commit that referenced this pull request Mar 17, 2024
…by default (#6170)

Co-authored-by: S O'Donnell <sodonnell@cloudera.com>
sadanand48 pushed a commit to sadanand48/hadoop-ozone that referenced this pull request Apr 17, 2024
…by default (apache#6170)

Co-authored-by: S O'Donnell <sodonnell@cloudera.com>
sadanand48 pushed a commit to sadanand48/hadoop-ozone that referenced this pull request Apr 17, 2024
…by default (apache#6170)

Co-authored-by: S O'Donnell <sodonnell@cloudera.com>
sadanand48 pushed a commit that referenced this pull request Apr 30, 2024
…by default (#6170)

Co-authored-by: S O'Donnell <sodonnell@cloudera.com>
ChenSammi pushed a commit to ChenSammi/ozone that referenced this pull request Feb 19, 2025
…by default (apache#6170)

Co-authored-by: S O'Donnell <sodonnell@cloudera.com>
ChenSammi pushed a commit to ChenSammi/ozone that referenced this pull request Feb 20, 2025
…by default (apache#6170)

Co-authored-by: S O'Donnell <sodonnell@cloudera.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants