diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index deb1a55114..36c50dc498 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -991,6 +991,9 @@ Release 2.3.0 - UNRELEASED
HDFS-5657. race condition causes writeback state error in NFS gateway (brandonli)
+ HDFS-5661. Browsing FileSystem via web ui, should use datanode's fqdn instead of ip
+ address. (Benoy Antony via jing9)
+
Release 2.2.0 - 2013-10-13
INCOMPATIBLE CHANGES
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java
index a34f2cf217..a147c0fb18 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java
@@ -117,6 +117,18 @@ public int compare(NodeRecord o1, NodeRecord o2) {
return 0;
}
}
+
+ /**
+ * convenience method for canonicalizing host name.
+ * @param addr name:port or name
+ * @return canonicalized host name
+ */
+ public static String canonicalize(String addr) {
+ // default port 1 is supplied to allow addr without port.
+ // the port will be ignored.
+ return NetUtils.createSocketAddr(addr, 1).getAddress()
+ .getCanonicalHostName();
+ }
/**
* A helper class that generates the correct URL for different schema.
@@ -124,10 +136,11 @@ public int compare(NodeRecord o1, NodeRecord o2) {
*/
public static final class Url {
public static String authority(String scheme, DatanodeID d) {
+ String fqdn = canonicalize(d.getIpAddr());
if (scheme.equals("http")) {
- return d.getInfoAddr();
+ return fqdn + ":" + d.getInfoPort();
} else if (scheme.equals("https")) {
- return d.getInfoSecureAddr();
+ return fqdn + ":" + d.getInfoSecurePort();
} else {
throw new IllegalArgumentException("Unknown scheme:" + scheme);
}
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
index c931698a32..c9e548b4d0 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
@@ -77,18 +77,6 @@ public DFSClient run() throws IOException {
});
}
- /**
- * Internal convenience method for canonicalizing host name.
- * @param addr name:port or name
- * @return canonicalized host name
- */
- private static String canonicalize(String addr) {
- // default port 1 is supplied to allow addr without port.
- // the port will be ignored.
- return NetUtils.createSocketAddr(addr, 1).getAddress()
- .getCanonicalHostName();
- }
-
/**
* Get the default chunk size.
* @param conf the configuration
@@ -228,7 +216,7 @@ static void generateDirectoryStructure(JspWriter out,
}
}
out.print("
Go back to DFS home");
dfs.close();
}
@@ -359,7 +347,7 @@ static void generateFileDetails(JspWriter out,
// generate a table and dump the info
out.println("\n