You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/21 11:18:25 UTC

[GitHub] [ozone] symious commented on a diff in pull request #3762: HDDS-7234. Add a common option for DiskBalancer commands

symious commented on code in PR #3762:
URL: https://github.com/apache/ozone/pull/3762#discussion_r976380734


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DiskBalancerStartSubcommand.java:
##########
@@ -55,31 +54,23 @@ public class DiskBalancerStartSubcommand extends ScmSubcommand {
       description = "Max parallelThread for DiskBalancer.")
   private Optional<Integer> parallelThread;
 
-  @Option(names = {"-a", "--allDatanodes"},
-      description = "Start diskBalancer on all datanodes.")
-  private boolean allHosts;
-
-  @Parameters(description = "List of fully qualified host names")
-  private List<String> hosts = new ArrayList<>();
+  @CommandLine.Mixin
+  private DiskBalancerCommonOptions commonOptions =
+      new DiskBalancerCommonOptions();
 
   @Override
   public void execute(ScmClient scmClient) throws IOException {
-    if (hosts.size() == 0 && !allHosts) {
-      System.out.println("Datanode not specified. Please specify " +
-          "\"--allDatanodes\" to start diskBalancer on all datanodes");
-      return;
-    }
-    if (hosts.size() != 0 && allHosts) {
-      System.out.println("Confused options. Omit \"--allDatanodes\" or " +
-          "Datanodes.");
+    if (!commonOptions.check()) {
       return;
     }
     List<DatanodeAdminError> errors =
         scmClient.startDiskBalancer(threshold, bandwidthInMB, parallelThread,
-            hosts.size() == 0 ? Optional.empty() : Optional.of(hosts));
+            commonOptions.getHosts().size() == 0 ? Optional.empty() :
+                Optional.of(commonOptions.getHosts()));

Review Comment:
   @lokeshj1703 Updated the patch, please have a look.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org