Add a function to utils to get the conical hostname from something that might be an alias/cname.

Signed-off-by: Jeremy Orlow <jorlow@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2213 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 9ef4b58..4436667 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -103,6 +103,12 @@
     write_one_line('/proc/sys/net/ipv4/ip_local_port_range',
                    '%d %d\n' % (lower, upper))
 
+
+def normalize_hostname(alias):
+    ip = socket.gethostbyname(alias)
+    return socket.gethostbyaddr(ip)[0]
+
+
 def read_one_line(filename):
     return open(filename, 'r').readline().rstrip('\n')