HDFS-4448. Allow HA NN to start in secure mode with wildcard address configured (atm via asuresh)

(cherry picked from commit baf8bc6c48)
This commit is contained in:
Arun Suresh 2015-04-23 01:42:24 -07:00
parent 63ccb9167e
commit 889b92fa40
2 changed files with 4 additions and 8 deletions

View File

@ -143,6 +143,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8218. Move classes that used by ClientProtocol into hdfs-client. HDFS-8218. Move classes that used by ClientProtocol into hdfs-client.
(wheat9) (wheat9)
HDFS-4448. Allow HA NN to start in secure mode with wildcard address
configured (atm via asuresh)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -1018,17 +1018,10 @@ public class DFSUtil {
*/ */
@VisibleForTesting @VisibleForTesting
static String substituteForWildcardAddress(String configuredAddress, static String substituteForWildcardAddress(String configuredAddress,
String defaultHost) throws IOException { String defaultHost) {
InetSocketAddress sockAddr = NetUtils.createSocketAddr(configuredAddress); InetSocketAddress sockAddr = NetUtils.createSocketAddr(configuredAddress);
InetSocketAddress defaultSockAddr = NetUtils.createSocketAddr(defaultHost
+ ":0");
final InetAddress addr = sockAddr.getAddress(); final InetAddress addr = sockAddr.getAddress();
if (addr != null && addr.isAnyLocalAddress()) { if (addr != null && addr.isAnyLocalAddress()) {
if (UserGroupInformation.isSecurityEnabled() &&
defaultSockAddr.getAddress().isAnyLocalAddress()) {
throw new IOException("Cannot use a wildcard address with security. " +
"Must explicitly set bind address for Kerberos");
}
return defaultHost + ":" + sockAddr.getPort(); return defaultHost + ":" + sockAddr.getPort();
} else { } else {
return configuredAddress; return configuredAddress;