Gargi-jais11 commented on code in PR #11619:
URL: https://github.com/apache/ozone/pull/11619#discussion_r4312136600


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DiskBalancerSubCommandUtil.java:
##########
@@ -168,14 +168,9 @@ public static DiskBalancerProtocol 
getSingleNodeDiskBalancerProxy(
     UserGroupInformation user = UserGroupInformation.getCurrentUser();
     
     // Parse address and add default port if not specified
-    InetSocketAddress nodeAddr;
-    if (address.contains(":")) {
-      // Port is specified, use NetUtils to parse
-      nodeAddr = NetUtils.createSocketAddr(address);
-    } else {
-      // Port not specified, use default
-      nodeAddr = NetUtils.createSocketAddr(address, 
HDDS_DATANODE_CLIENT_PORT_DEFAULT);
-    }
+    int port = 
HddsUtils.getHostPort(address).orElse(HDDS_DATANODE_CLIENT_PORT_DEFAULT);
+    InetSocketAddress nodeAddr = NetUtils.createSocketAddr(

Review Comment:
   same issue is already handled for `ozone.scm.names` / `ozone.recon.address` 
with `HddsUtils.validateAdvertisedAddress`, which rejects unbracketed literals 
and tells the user which bracketed form to write. Could we use similar check 
here?



-- 
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