public static String getFullyQualifiedDomainName(String unqualifiedHostname) {
    if (unqualifiedHostname == null) {
      throw new IllegalArgumentException("Hostname cannot be null.");
    } else if (unqualifiedHostname.length() == 0) {
      throw new IllegalArgumentException("Hostname cannot be zero length.");
    }

    try {
      return InetAddress.getByName(unqualifiedHostname).getCanonicalHostName().toLowerCase();
    } catch (UnknownHostException e) {
      throw new IllegalArgumentException(
          "Host (" + unqualifiedHostname + ") is unknown so cannot determine fully qualified domain name.");
    }
  }
Converts a hostname into a canonical hostname.

@param unqualifiedHostname hostname to be fully qualified
@return canonical hostname that can be compared with DataNode.getHostname()
ambry-clustermap/src/main/java/com/github/ambry/clustermap/ClusterMapUtils.java