ChenSammi commented on a change in pull request #937: HDDS-1663. Add datanode 
to network topology cluster during node regis…
URL: https://github.com/apache/hadoop/pull/937#discussion_r292258632
 
 

 ##########
 File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
 ##########
 @@ -228,14 +251,27 @@ public RegisteredCommand register(
       datanodeDetails.setIpAddress(dnAddress.getHostAddress());
     }
     try {
+      String location;
+      if (useHostname) {
+        datanodeDetails.setNetworkName(datanodeDetails.getHostName());
+        location = nodeResolve(datanodeDetails.getHostName());
+      } else {
+        datanodeDetails.setNetworkName(datanodeDetails.getIpAddress());
+        location = nodeResolve(datanodeDetails.getIpAddress());
+      }
+      if (location != null) {
 
 Review comment:
   All current implemented DNSToSwitchMapping classes which resolve node to 
location will return "/default-rack" if can not find a match location. But this 
behavior is clearly defined in the interface definition. So the location null 
check is kept here to avoid future break of this assumption if new 
DNSToSwitchMapping classes are introduced. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to