GeorgeJahad commented on code in PR #3186:
URL: https://github.com/apache/ozone/pull/3186#discussion_r901936685


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -362,33 +362,33 @@ public RegisteredCommand register(
           .build();
     }
 
+    InetAddress dnAddress = Server.getRemoteIp();
+    if (dnAddress != null) {
+      // Mostly called inside an RPC, update ip
+      datanodeDetails.setIpAddress(dnAddress.getHostAddress());
+    }
+
+    String dnsName;
+    String networkLocation;
+    datanodeDetails.setNetworkName(datanodeDetails.getUuidString());
+    if (useHostname) {
+      dnsName = datanodeDetails.getHostName();
+    } else {
+      dnsName = datanodeDetails.getIpAddress();
+    }
+    networkLocation = nodeResolve(dnsName);
+    if (networkLocation != null) {
+      datanodeDetails.setNetworkLocation(networkLocation);
+    }
+
     if (!isNodeRegistered(datanodeDetails)) {
-      InetAddress dnAddress = Server.getRemoteIp();
-      if (dnAddress != null) {
-        // Mostly called inside an RPC, update ip and peer hostname
-        datanodeDetails.setHostName(dnAddress.getHostName());

Review Comment:
   @sokui @adoroszlai Sorry to say that I'm nervous about removing the call to  
setHostName().
   
   I just took around and it seems to get used in many places.  I've included 
some below:
   
https://github.com/apache/ozone/blob/f57a0193c114ac2f17dc255ec1a052dcf12781b8/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java#L259
   
   
https://github.com/apache/ozone/blob/f57a0193c114ac2f17dc255ec1a052dcf12781b8/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java#L171
   
   
https://github.com/apache/ozone/blob/f57a0193c114ac2f17dc255ec1a052dcf12781b8/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java#L576
   
   Why does restart not work when it returns the IP string instead of the host 
string?
   



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