[ 
https://issues.apache.org/jira/browse/HDDS-1663?focusedWorklogId=257334&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-257334
 ]

ASF GitHub Bot logged work on HDDS-1663:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jun/19 02:40
            Start Date: 11/Jun/19 02:40
    Worklog Time Spent: 10m 
      Work Description: ChenSammi commented on pull request #937: HDDS-1663. 
Add datanode to network topology cluster during node regis…
URL: https://github.com/apache/hadoop/pull/937#discussion_r292258974
 
 

 ##########
 File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
 ##########
 @@ -515,5 +551,36 @@ public void onMessage(CommandForDatanode 
commandForDatanode,
     return commandQueue.getCommand(dnID);
   }
 
+  /**
+   * Given datanode address or host name, returns the DatanodeDetails for the
+   * node.
+   *
+   * @param address node host address
+   * @return the given datanode, or null if not found
+   */
+  @Override
+  public DatanodeDetails getNode(String address) {
+    Node node = null;
+    String location = nodeResolve(address);
+    if (location != null) {
+      node = clusterMap.getNode(location + NetConstants.PATH_SEPARATOR_STR +
+          address);
+    }
+    return node == null ? null : (DatanodeDetails)node;
+  }
 
+  private String nodeResolve(String hostname) {
+    List<String> hosts = new ArrayList<>(1);
+    hosts.add(hostname);
+    List<String> resolvedHosts = dnsToSwitchMapping.resolve(hosts);
+    if (resolvedHosts != null && !resolvedHosts.isEmpty()) {
+      String location = resolvedHosts.get(0);
 
 Review comment:
   It will not return null so far. If no match found, 
dnsToSwitchMapping.resolve will return /default-rack.
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 257334)
    Time Spent: 2h 50m  (was: 2h 40m)

> Add datanode to network topology cluster during node register
> -------------------------------------------------------------
>
>                 Key: HDDS-1663
>                 URL: https://issues.apache.org/jira/browse/HDDS-1663
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Sammi Chen
>            Assignee: Sammi Chen
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to