<div dir="ltr"><div><div><div>Hi Lars,<br><br></div>Thank you very much for your early and informative reply.<br><br>> <span style="color:rgb(0,0,255)">If cloud-init is installed and is able to connect to the metadata<br>
service, cloud-init will set your hostname based on the value provided<br>
in the metadata.<br></span></div><span style="color:rgb(0,0,255)"><font color="#000000">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 </font></span><br>" curl <a href="http://169.254.169.254/openstak/latest/meta_data.json" target="_blank">http://169.254.169.254/openstak/latest/meta_data.json</a> " from inside the VM (once it is launched), I am getting hostname, name, availability zone, etc etc. as output.<br></div><span style="color:rgb(0,0,255)"><font color="#000000">----> 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 <b>hostname</b>. How in meta_data.json file 'hostname' field is getting updated/added.<br><br>> </font>If cloud-init is *not* installed or is *not* able to connect to the<br>
metadata service, the hostname you end up with is going to depend on<br>
whatever distribution you happen to be booting.</span><div><span style="color:rgb(0,0,255)"><font color="#000000">Here, as you have mentioned, my question becomes : </font></span>How does<br>redhat/ubuntu/centos/etc set the hostname if has not been explicitly<br>
configured by the administrator?<br></div><div><br>Also, In addition to above query, how does redhat/ubuntu/centos/etc set the hostname<br>if has not been explicitly
configured by the administrator and the VM launched didn't get the IP?<br></div><div>(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 ' ?)<br><br></div><div>Thank you once again.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 9:16 PM, Lars Kellogg-Stedman <span dir="ltr"><<a href="mailto:lars@redhat.com" target="_blank">lars@redhat.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> *2).* Please do point me to any helpful links from where I can get<br>
<span class="">> understanding of VM's hostname mechanism.<br>
<br>
</span>I'm not sure what you're asking here.<br>
<br>
If cloud-init is installed and is able to connect to the metadata<br>
service, cloud-init will set your hostname based on the value provided<br>
in the metadata.<br>
<br>
If cloud-init is *not* installed or is *not* able to connect to the<br>
metadata service, the hostname you end up with is going to depend on<br>
whatever distribution you happen to be booting (that is, at this point<br>
you no long have an openstack question, you have "how does<br>
redhat/ubuntu/etc set the hostname if has not been explicitly<br>
configured by the administrator?").<br>
<br>
On RHEL-ish systems (centos, fedora, etc), if the hostname is set to<br>
the default "localhost.localdomain", the system will use reverse dns<br>
to determine the name.  This behavior may be different on other<br>
distributions.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Lars Kellogg-Stedman <<a href="mailto:lars@redhat.com">lars@redhat.com</a>> | larsks @ {freenode,twitter,github}<br>
Cloud Engineering / OpenStack          | <a href="http://blog.oddbit.com/" target="_blank">http://blog.oddbit.com/</a><br>
<br>
</font></span></blockquote></div></div>