actually, jclouds NodeMetadata.hostname is just that: the hostname of the machine (doesn't necessarily imply DNS)
in clouds like EC2, the public (and private) dns names are supplied via api call
Instance.getPublicHostName actually attempts DNS resolution, so we can safely assume it is intended to be a DNS name
Instance.getPrivateHostName is deprecated for some reason, so I presume we are to use for Instance.getPrivateIp in configuration needing LAN communication.
If I'm correct(ish) so far, than the DnsResolver class could get us out of the problem where we don't know the correct value of the DNS name. Ex. failing DNS resolution, it could just fallback to x-x-x-x.static.cloud-ips.com, as there's nothing rackspace specific about that. Failing that (ex. in private clouds), or per override, publicHostname could be alternately specified.
and again.. we'd end up setting this to the correct value on the machine via configure_hostnames.sh
If we validate a general logic to apply, I think we can get rid of provider-specific logic completely.
Summing up above:
1. configure_hostnames.sh has the responsibility of adding instance.publicHostname, such that it resolves locally.
2. the responsibility of setting instance.publicHostname to a valid value is Whirr. This logic follows the following
- if an override is specified, set instance.publicHostname to that
- if publicIp resolves via dns, return that.
- if x-x-x-x.static.cloud-ips.com resolves via dns, return that
- else return nodeMetadata.getHostname()