HDFS-5661. Merge change r1552177 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1552180 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ebc126b9e
commit
8dbe8d2165
|
@ -415,6 +415,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
|
|
||||||
HDFS-5657. race condition causes writeback state error in NFS gateway (brandonli)
|
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
|
Release 2.2.0 - 2013-10-13
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -118,16 +118,29 @@ public class JspHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* A helper class that generates the correct URL for different schema.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static final class Url {
|
public static final class Url {
|
||||||
public static String authority(String scheme, DatanodeID d) {
|
public static String authority(String scheme, DatanodeID d) {
|
||||||
|
String fqdn = canonicalize(d.getIpAddr());
|
||||||
if (scheme.equals("http")) {
|
if (scheme.equals("http")) {
|
||||||
return d.getInfoAddr();
|
return fqdn + ":" + d.getInfoPort();
|
||||||
} else if (scheme.equals("https")) {
|
} else if (scheme.equals("https")) {
|
||||||
return d.getInfoSecureAddr();
|
return fqdn + ":" + d.getInfoSecurePort();
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unknown scheme:" + scheme);
|
throw new IllegalArgumentException("Unknown scheme:" + scheme);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,18 +77,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.
|
* Get the default chunk size.
|
||||||
* @param conf the configuration
|
* @param conf the configuration
|
||||||
|
@ -228,7 +216,7 @@ public class DatanodeJspHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out.print("<br><a href=\"///"
|
out.print("<br><a href=\"///"
|
||||||
+ canonicalize(nnAddr) + ":"
|
+ JspHelper.canonicalize(nnAddr) + ":"
|
||||||
+ namenodeInfoPort + "/dfshealth.jsp\">Go back to DFS home</a>");
|
+ namenodeInfoPort + "/dfshealth.jsp\">Go back to DFS home</a>");
|
||||||
dfs.close();
|
dfs.close();
|
||||||
}
|
}
|
||||||
|
@ -359,7 +347,7 @@ public class DatanodeJspHelper {
|
||||||
// generate a table and dump the info
|
// generate a table and dump the info
|
||||||
out.println("\n<table>");
|
out.println("\n<table>");
|
||||||
|
|
||||||
String nnCanonicalName = canonicalize(nnAddr);
|
String nnCanonicalName = JspHelper.canonicalize(nnAddr);
|
||||||
for (LocatedBlock cur : blocks) {
|
for (LocatedBlock cur : blocks) {
|
||||||
out.print("<tr>");
|
out.print("<tr>");
|
||||||
final String blockidstring = Long.toString(cur.getBlock().getBlockId());
|
final String blockidstring = Long.toString(cur.getBlock().getBlockId());
|
||||||
|
|
Loading…
Reference in New Issue