From fb09d7537961935f3ed2506dca1d6e2cd2829a80 Mon Sep 17 00:00:00 2001 From: Mukul Kumar Singh Date: Thu, 25 Jan 2018 12:36:55 +0530 Subject: [PATCH] HDFS-13018. Block Storage: make the iscsi target addres configurable for discovery. Contributed by Elek, Marton. --- .../hadoop/cblock/CBlockConfigKeys.java | 8 ++++++++ .../cblock/jscsiHelper/SCSITargetDaemon.java | 19 ++++++++++++++++++- .../src/main/resources/ozone-default.xml | 17 +++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java index 81ad8f5ec3..fb8f17e65a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java +++ b/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() { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/jscsiHelper/SCSITargetDaemon.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/jscsiHelper/SCSITargetDaemon.java index 37544f5973..ce7717be7b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/jscsiHelper/SCSITargetDaemon.java +++ b/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 static void main(String[] args) throws Exception { 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( diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml index 434f5c7c76..e09afb2721 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml @@ -277,6 +277,23 @@ + + dfs.cblock.iscsi.advertised.ip + 0.0.0.0 + CBLOCK + + IP address returned during the iscsi discovery. + + + + + dfs.cblock.iscsi.advertised.port + 3260 + CBLOCK + + TCP port returned during the iscsi discovery. + + ozone.container.cache.size