فهرست منبع

HDFS-13018. Block Storage: make the iscsi target addres configurable for discovery. Contributed by Elek, Marton.

Mukul Kumar Singh 7 سال پیش
والد
کامیت
7ea3a3aa5d

+ 8 - 0
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java

@@ -187,6 +187,14 @@ public final class CBlockConfigKeys {
       "dfs.cblock.rpc.timeout";
   public static final String DFS_CBLOCK_RPC_TIMEOUT_DEFAULT = "300s";
 
+  public static final String DFS_CBLOCK_ISCSI_ADVERTISED_IP =
+      "dfs.cblock.iscsi.advertised.ip";
+
+  public static final String DFS_CBLOCK_ISCSI_ADVERTISED_PORT =
+      "dfs.cblock.iscsi.advertised.port";
+
+  public static final int DFS_CBLOCK_ISCSI_ADVERTISED_PORT_DEFAULT = 3260;
+
   private CBlockConfigKeys() {
 
   }

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/pom.xml

@@ -211,7 +211,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <dependency>
       <groupId>org.jscsi</groupId>
       <artifactId>target</artifactId>
-      <version>2.5.3</version>
+      <version>2.6.0</version>
       <optional>true</optional>
       <exclusions>
         <exclusion>

+ 18 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/jscsiHelper/SCSITargetDaemon.java

@@ -17,6 +17,12 @@
  */
 package org.apache.hadoop.cblock.jscsiHelper;
 
+import static org.apache.hadoop.cblock.CBlockConfigKeys
+    .DFS_CBLOCK_ISCSI_ADVERTISED_IP;
+import static org.apache.hadoop.cblock.CBlockConfigKeys
+    .DFS_CBLOCK_ISCSI_ADVERTISED_PORT;
+import static org.apache.hadoop.cblock.CBlockConfigKeys
+    .DFS_CBLOCK_ISCSI_ADVERTISED_PORT_DEFAULT;
 import org.apache.hadoop.cblock.protocolPB.CBlockClientServerProtocolPB;
 import org.apache.hadoop.cblock.protocolPB.CBlockServiceProtocolPB;
 import org.apache.hadoop.ipc.ProtobufRpcEngine;
@@ -97,7 +103,18 @@ public final class SCSITargetDaemon {
                 NetUtils.getDefaultSocketFactory(ozoneConf), 5000)
         );
     CBlockManagerHandler cbmHandler = new CBlockManagerHandler(cbmClient);
-    Configuration jscsiConfig = new Configuration(jscsiServerAddress);
+
+    String advertisedAddress = ozoneConf.
+        getTrimmed(DFS_CBLOCK_ISCSI_ADVERTISED_IP, jscsiServerAddress);
+
+    int advertisedPort = ozoneConf.
+        getInt(DFS_CBLOCK_ISCSI_ADVERTISED_PORT,
+            DFS_CBLOCK_ISCSI_ADVERTISED_PORT_DEFAULT);
+
+    Configuration jscsiConfig =
+        new Configuration(jscsiServerAddress,
+            advertisedAddress,
+            advertisedPort);
     DefaultMetricsSystem.initialize("CBlockMetrics");
     CBlockTargetMetrics metrics = CBlockTargetMetrics.create();
     CBlockTargetServer targetServer = new CBlockTargetServer(

+ 17 - 0
hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml

@@ -277,6 +277,23 @@
     </description>
   </property>
 
+  <property>
+    <name>dfs.cblock.iscsi.advertised.ip</name>
+    <value>0.0.0.0</value>
+    <tag>CBLOCK</tag>
+    <description>
+      IP address returned during the iscsi discovery.
+    </description>
+  </property>
+
+  <property>
+    <name>dfs.cblock.iscsi.advertised.port</name>
+    <value>3260</value>
+    <tag>CBLOCK</tag>
+    <description>
+      TCP port returned during the iscsi discovery.
+    </description>
+  </property>
   <!--Container Settings used by Datanode-->
   <property>
     <name>ozone.container.cache.size</name>