[59/83] [abbrv] hadoop git commit: HDFS-13348. Ozone: Update IP and hostname in Datanode from SCM's response to the register call. Contributed by Shashikant Banerjee.

2018-04-24 Thread xyao
HDFS-13348. Ozone: Update IP and hostname in Datanode from SCM's response to 
the register call. Contributed by Shashikant Banerjee.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4a8aa0e1
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4a8aa0e1
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4a8aa0e1

Branch: refs/heads/trunk
Commit: 4a8aa0e1c85944342a80b0a2110fd6210853b0b7
Parents: e6da4d8
Author: Nanda kumar 
Authored: Wed Apr 11 17:05:33 2018 +0530
Committer: Nanda kumar 
Committed: Wed Apr 11 17:05:33 2018 +0530

--
 .../states/endpoint/RegisterEndpointTask.java   | 34 
 .../protocol/commands/RegisteredCommand.java| 88 
 .../StorageContainerDatanodeProtocol.proto  |  2 +
 .../hadoop/hdds/scm/node/SCMNodeManager.java| 19 +++--
 .../ozone/container/common/TestEndPoint.java|  4 +-
 5 files changed, 106 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a8aa0e1/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
--
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
index 6913896..de186a7 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
@@ -20,9 +20,10 @@ import com.google.common.annotations.VisibleForTesting;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos.DatanodeDetailsProto;
 import org.apache.hadoop.ozone.container.common.statemachine
 .EndpointStateMachine;
+import org.apache.hadoop.hdds.protocol.proto
+.StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,7 +41,7 @@ public final class RegisterEndpointTask implements
   private final EndpointStateMachine rpcEndPoint;
   private final Configuration conf;
   private Future result;
-  private DatanodeDetailsProto datanodeDetailsProto;
+  private DatanodeDetails datanodeDetails;
 
   /**
* Creates a register endpoint task.
@@ -57,22 +58,22 @@ public final class RegisterEndpointTask implements
   }
 
   /**
-   * Get the DatanodeDetailsProto Proto.
+   * Get the DatanodeDetails.
*
* @return DatanodeDetailsProto
*/
-  public DatanodeDetailsProto getDatanodeDetailsProto() {
-return datanodeDetailsProto;
+  public DatanodeDetails getDatanodeDetails() {
+return datanodeDetails;
   }
 
   /**
* Set the contiainerNodeID Proto.
*
-   * @param datanodeDetailsProto - Container Node ID.
+   * @param datanodeDetails - Container Node ID.
*/
-  public void setDatanodeDetailsProto(
-  DatanodeDetailsProto datanodeDetailsProto) {
-this.datanodeDetailsProto = datanodeDetailsProto;
+  public void setDatanodeDetails(
+  DatanodeDetails datanodeDetails) {
+this.datanodeDetails = datanodeDetails;
   }
 
   /**
@@ -84,8 +85,8 @@ public final class RegisterEndpointTask implements
   @Override
   public EndpointStateMachine.EndPointStates call() throws Exception {
 
-if (getDatanodeDetailsProto() == null) {
-  LOG.error("Container ID proto cannot be null in RegisterEndpoint task, " 
+
+if (getDatanodeDetails() == null) {
+  LOG.error("DatanodeDetails cannot be null in RegisterEndpoint task, " +
   "shutting down the endpoint.");
   return 
rpcEndPoint.setState(EndpointStateMachine.EndPointStates.SHUTDOWN);
 }
@@ -94,8 +95,13 @@ public final class RegisterEndpointTask implements
 try {
 
   // TODO : Add responses to the command Queue.
-  rpcEndPoint.getEndPoint().register(datanodeDetailsProto,
-  conf.getStrings(ScmConfigKeys.OZONE_SCM_NAMES));
+  SCMRegisteredCmdResponseProto response = rpcEndPoint.getEndPoint()
+  .register(datanodeDetails.getProtoBufMessage(),
+  conf.getStrings(ScmConfigKeys.OZONE_SCM_NAMES));
+  if (response.hasHostname() && response.hasIpAddress()) {
+datanodeDetails.setHostName(response.getHostname());
+datanodeDetails.setIpAddress(response.getIpAddress());
+  }
   EndpointStateMachine.EndPointStates nextState =
   

hadoop git commit: HDFS-13348. Ozone: Update IP and hostname in Datanode from SCM's response to the register call. Contributed by Shashikant Banerjee.

2018-04-11 Thread nanda
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 e6da4d8da -> 4a8aa0e1c


HDFS-13348. Ozone: Update IP and hostname in Datanode from SCM's response to 
the register call. Contributed by Shashikant Banerjee.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4a8aa0e1
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4a8aa0e1
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4a8aa0e1

Branch: refs/heads/HDFS-7240
Commit: 4a8aa0e1c85944342a80b0a2110fd6210853b0b7
Parents: e6da4d8
Author: Nanda kumar 
Authored: Wed Apr 11 17:05:33 2018 +0530
Committer: Nanda kumar 
Committed: Wed Apr 11 17:05:33 2018 +0530

--
 .../states/endpoint/RegisterEndpointTask.java   | 34 
 .../protocol/commands/RegisteredCommand.java| 88 
 .../StorageContainerDatanodeProtocol.proto  |  2 +
 .../hadoop/hdds/scm/node/SCMNodeManager.java| 19 +++--
 .../ozone/container/common/TestEndPoint.java|  4 +-
 5 files changed, 106 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a8aa0e1/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
--
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
index 6913896..de186a7 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/endpoint/RegisterEndpointTask.java
@@ -20,9 +20,10 @@ import com.google.common.annotations.VisibleForTesting;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos.DatanodeDetailsProto;
 import org.apache.hadoop.ozone.container.common.statemachine
 .EndpointStateMachine;
+import org.apache.hadoop.hdds.protocol.proto
+.StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,7 +41,7 @@ public final class RegisterEndpointTask implements
   private final EndpointStateMachine rpcEndPoint;
   private final Configuration conf;
   private Future result;
-  private DatanodeDetailsProto datanodeDetailsProto;
+  private DatanodeDetails datanodeDetails;
 
   /**
* Creates a register endpoint task.
@@ -57,22 +58,22 @@ public final class RegisterEndpointTask implements
   }
 
   /**
-   * Get the DatanodeDetailsProto Proto.
+   * Get the DatanodeDetails.
*
* @return DatanodeDetailsProto
*/
-  public DatanodeDetailsProto getDatanodeDetailsProto() {
-return datanodeDetailsProto;
+  public DatanodeDetails getDatanodeDetails() {
+return datanodeDetails;
   }
 
   /**
* Set the contiainerNodeID Proto.
*
-   * @param datanodeDetailsProto - Container Node ID.
+   * @param datanodeDetails - Container Node ID.
*/
-  public void setDatanodeDetailsProto(
-  DatanodeDetailsProto datanodeDetailsProto) {
-this.datanodeDetailsProto = datanodeDetailsProto;
+  public void setDatanodeDetails(
+  DatanodeDetails datanodeDetails) {
+this.datanodeDetails = datanodeDetails;
   }
 
   /**
@@ -84,8 +85,8 @@ public final class RegisterEndpointTask implements
   @Override
   public EndpointStateMachine.EndPointStates call() throws Exception {
 
-if (getDatanodeDetailsProto() == null) {
-  LOG.error("Container ID proto cannot be null in RegisterEndpoint task, " 
+
+if (getDatanodeDetails() == null) {
+  LOG.error("DatanodeDetails cannot be null in RegisterEndpoint task, " +
   "shutting down the endpoint.");
   return 
rpcEndPoint.setState(EndpointStateMachine.EndPointStates.SHUTDOWN);
 }
@@ -94,8 +95,13 @@ public final class RegisterEndpointTask implements
 try {
 
   // TODO : Add responses to the command Queue.
-  rpcEndPoint.getEndPoint().register(datanodeDetailsProto,
-  conf.getStrings(ScmConfigKeys.OZONE_SCM_NAMES));
+  SCMRegisteredCmdResponseProto response = rpcEndPoint.getEndPoint()
+  .register(datanodeDetails.getProtoBufMessage(),
+  conf.getStrings(ScmConfigKeys.OZONE_SCM_NAMES));
+  if (response.hasHostname() && response.hasIpAddress()) {
+datanodeDetails.setHostName(response.getHostname());
+