merge YARN-848 from trunk. Fix NodeManager to register with RM using the fully qualified hostname. Contributed by Hitesh Shah.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1494389 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Siddharth Seth 2013-06-18 23:50:32 +00:00
parent 368c7ae735
commit 5de952dca0
3 changed files with 15 additions and 2 deletions

View File

@ -596,6 +596,9 @@ Release 2.1.0-beta - UNRELEASED
YARN-812. Set default logger for application summary logger to
hadoop.root.logger. (sseth via acmurthy)
YARN-848. Nodemanager does not register with RM using the fully qualified
hostname. (Hitesh Shah via sseth)
BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
YARN-158. Yarn creating package-info.java must not depend on sh.

View File

@ -253,8 +253,9 @@ public class ContainerManagerImpl extends CompositeService implements
this.setBlockNewContainerRequests(true);
server.start();
InetSocketAddress connectAddress = NetUtils.getConnectAddress(server);
NodeId nodeId = NodeId.newInstance(connectAddress.getHostName(),
connectAddress.getPort());
NodeId nodeId = NodeId.newInstance(
connectAddress.getAddress().getCanonicalHostName(),
connectAddress.getPort());
((NodeManager.NMContext)context).setNodeId(nodeId);
this.context.getNMTokenSecretManager().setNodeId(nodeId);
this.context.getContainerTokenSecretManager().setNodeId(nodeId);

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -125,6 +126,14 @@ public class TestContainerManager extends BaseContainerManagerTest {
containerManager.start();
InetAddress localAddr = InetAddress.getLocalHost();
String fqdn = localAddr.getCanonicalHostName();
if (!localAddr.getHostAddress().equals(fqdn)) {
// only check if fqdn is not same as ip
// api returns ip in case of resolution failure
Assert.assertEquals(fqdn, context.getNodeId().getHost());
}
// Just do a query for a non-existing container.
boolean throwsException = false;
try {