Author: jing9 Date: Thu Dec 19 00:31:25 2013 New Revision: 1552180 URL: http://svn.apache.org/r1552180 Log: HDFS-5661. Merge change r1552177 from trunk.
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1552180&r1=1552179&r2=1552180&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Dec 19 00:31:25 2013 @@ -415,6 +415,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 Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java?rev=1552180&r1=1552179&r2=1552180&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java Thu Dec 19 00:31:25 2013 @@ -117,6 +117,18 @@ public class JspHelper { 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 class JspHelper { */ 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); } Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java?rev=1552180&r1=1552179&r2=1552180&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java Thu Dec 19 00:31:25 2013 @@ -78,18 +78,6 @@ public class DatanodeJspHelper { } /** - * 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 * @return the number of bytes to chunk in @@ -228,7 +216,7 @@ public class DatanodeJspHelper { } } out.print("<br><a href=\"///" - + canonicalize(nnAddr) + ":" + + JspHelper.canonicalize(nnAddr) + ":" + namenodeInfoPort + "/dfshealth.jsp\">Go back to DFS home</a>"); dfs.close(); } @@ -359,7 +347,7 @@ public class DatanodeJspHelper { // generate a table and dump the info out.println("\n<table>"); - String nnCanonicalName = canonicalize(nnAddr); + String nnCanonicalName = JspHelper.canonicalize(nnAddr); for (LocatedBlock cur : blocks) { out.print("<tr>"); final String blockidstring = Long.toString(cur.getBlock().getBlockId());