dcache-common: change NetworkUtil getCanonicalHostname to prefer DNS name

The utility method in NetworkUtils which gets the canonical host name for
the localhost currently picks the first entry from an external-to-
internal sorted array. However, this can produce an ipv6-style name
which is not as readily legible.

Since this method is primarily for metadata purposes
(and currently used only by alarms code), it has been changed to
prefer a tradition DNS name, if it exists.

Target: master
Request: 2.10
Patch: https://rb.dcache.org/r/7243/
Require-notes: no
Require-book: no
Acked-by: Tigran