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

This commit is contained in:
Mukul Kumar Singh 2018-01-25 12:36:55 +05:30 committed by Owen O'Malley
parent 4bb9ad8e8f
commit fb09d75379
3 changed files with 43 additions and 1 deletions

View File

@ -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() {
}

View File

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

View File

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