diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java index 6a6b3da0b5..c32394271c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java @@ -484,7 +484,7 @@ private String getNodesImpl(final DatanodeReportType type) { innerinfo.put("blockPoolUsed", node.getBlockPoolUsed()); innerinfo.put("blockPoolUsedPercent", node.getBlockPoolUsedPercent()); innerinfo.put("volfails", -1); // node.getVolumeFailures() - info.put(node.getHostName() + ":" + node.getXferPort(), + info.put(node.getXferAddrWithHostname(), Collections.unmodifiableMap(innerinfo)); } } catch (StandbyException e) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 73dc5846a9..e8ba99a142 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -1815,10 +1815,9 @@ public SaslDataTransferServer getSaslServer() { } /** - * @return name useful for logging + * @return name useful for logging or display */ public String getDisplayName() { - // NB: our DatanodeID may not be set yet return hostName + ":" + getXferPort(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 7ccaae9773..c4051b2262 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -6537,7 +6537,7 @@ public String getLiveNodes() { if (node.getUpgradeDomain() != null) { innerinfo.put("upgradeDomain", node.getUpgradeDomain()); } - info.put(node.getHostName() + ":" + node.getXferPort(), innerinfo.build()); + info.put(node.getXferAddrWithHostname(), innerinfo.build()); } return JSON.toString(info); } @@ -6560,7 +6560,7 @@ public String getDeadNodes() { .put("xferaddr", node.getXferAddr()) .put("location", node.getNetworkLocation()) .build(); - info.put(node.getHostName() + ":" + node.getXferPort(), innerinfo); + info.put(node.getXferAddrWithHostname(), innerinfo); } return JSON.toString(info); } @@ -6588,7 +6588,7 @@ public String getDecomNodes() { .put("underReplicateInOpenFiles", node.getLeavingServiceStatus().getUnderReplicatedInOpenFiles()) .build(); - info.put(node.getHostName() + ":" + node.getXferPort(), innerinfo); + info.put(node.getXferAddrWithHostname(), innerinfo); } return JSON.toString(info); } @@ -6616,7 +6616,7 @@ public String getEnteringMaintenanceNodes() { .put("underReplicateInOpenFiles", node.getLeavingServiceStatus().getUnderReplicatedInOpenFiles()) .build(); - nodesMap.put(node.getHostName() + ":" + node.getXferPort(), attrMap); + nodesMap.put(node.getXferAddrWithHostname(), attrMap); } return JSON.toString(nodesMap); }