[Openstack] Mystery of VM's Hostname
Girija Sharan
girijasharansingh at gmail.com
Thu Dec 18 17:27:52 UTC 2014
Hi Lars,
Thank you very much for your early and informative reply.
> If cloud-init is installed and is able to connect to the metadata
service, cloud-init will set your hostname based on the value provided
in the metadata.
Here, in my case cloud-init is installed and is able to connect to
meta-data service. But while launching the VM I am not specifying any
meta-data. But if I am doing the command
" curl http://169.254.169.254/openstak/latest/meta_data.json " from inside
the VM (once it is launched), I am getting hostname, name, availability
zone, etc etc. as output.
----> So here my question becomes : How this meta_data.json file is getting
created and updated with these details. Details like Name, Availabitily
zone, flavor, etc I am specifying while launching VM. But no where I am
mentioning *hostname*. How in meta_data.json file 'hostname' field is
getting updated/added.
> If cloud-init is *not* installed or is *not* able to connect to the
metadata service, the hostname you end up with is going to depend on
whatever distribution you happen to be booting.
Here, as you have mentioned, my question becomes : How does
redhat/ubuntu/centos/etc set the hostname if has not been explicitly
configured by the administrator?
Also, In addition to above query, how does redhat/ubuntu/centos/etc set the
hostname
if has not been explicitly configured by the administrator and the VM
launched didn't get the IP?
(I mean, If VM didn't get the IP and hostname was not been configured by
admin, even then would the hostname be like host-<ip address> ex :- '
host-21-0-0-5 ' ?)
Thank you once again.
On Thu, Dec 18, 2014 at 9:16 PM, Lars Kellogg-Stedman <lars at redhat.com>
wrote:
>
> > *2).* Please do point me to any helpful links from where I can get
> > understanding of VM's hostname mechanism.
>
> I'm not sure what you're asking here.
>
> If cloud-init is installed and is able to connect to the metadata
> service, cloud-init will set your hostname based on the value provided
> in the metadata.
>
> If cloud-init is *not* installed or is *not* able to connect to the
> metadata service, the hostname you end up with is going to depend on
> whatever distribution you happen to be booting (that is, at this point
> you no long have an openstack question, you have "how does
> redhat/ubuntu/etc set the hostname if has not been explicitly
> configured by the administrator?").
>
> On RHEL-ish systems (centos, fedora, etc), if the hostname is set to
> the default "localhost.localdomain", the system will use reverse dns
> to determine the name. This behavior may be different on other
> distributions.
>
> --
> Lars Kellogg-Stedman <lars at redhat.com> | larsks @
> {freenode,twitter,github}
> Cloud Engineering / OpenStack | http://blog.oddbit.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20141218/e435df66/attachment.html>
More information about the Openstack
mailing list