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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to