[Rdo-list] the hostname returned by metadata service ?

Rhys Oxenham roxenham at redhat.com
Tue Mar 10 15:29:14 UTC 2015


Hi Xin,

The hostname inside of the guest is typically set via the metadata service, which is native to Nova, and not the Neutron service. Inside of your Nova configuration file you’ll see this configuration option-

[root at stack-node1 ~(keystone_demo)]# grep dhcp_domain /etc/nova/nova.conf
#dhcp_domain=novalocal

Which is why when you launch an instance, the cloud-init (or similar) service configures the local hostname based on this, and not what the DHCP service is giving out. You can test this inside of your instance:

$ curl http://169.254.169.254/latest/meta-data/local-hostname
test1.novalocal

However, the DHCP agent will report a different hostname associated to that host; you can confirm this inside of the namespace (or as you have done it inside of your instance):

[root at stack-node1 ~(keystone_demo)]# ip netns exec qdhcp-0dc9eedc-1077-41cb-a615-f63fb2538aaf host 172.16.0.12 172.16.0.1
Using domain server:
Name: 172.16.0.1
Address: 172.16.0.1#53
Aliases: 

12.0.16.172.in-addr.arpa domain name pointer host-172-16-0-12.openstacklocal.

So, you’ve got two choices here-

1) You update the nova configuration to the DHCP domain that you require, and leave the instances to set their hostname via metadata

2) You re-configure your cloud-init configuration to NOT use the metadata service for the hostname and use normal DHCP setting


Cheers
Rhys


> On 10 Mar 2015, at 15:25, Zhao, Xin <xzhao at bnl.gov> wrote:
> 
> Hello,
> 
> I have a question about metadata service.
> 
> We set up a multi-hosts testbed on RHEL6 from RDO icehouse.
> 
> Inside the instance, hostname shows as expected by the dhcp server, as shown below:
> 
> [root at host-172-10-0-8 ~]# hostname -f
> host-172-10-0-8.openstack.bnl.gov
> 
> [root at host-172-10-0-8 ~]# nslookup host-172-10-0-8.openstack.bnl.gov
> Server:        172.10.0.3
> Address:    172.10.0.3#53
> 
> Name:    host-172-10-0-8.openstack.bnl.gov
> Address: 172.10.0.8
> 
> But the hostname returned by metadata is different and not reachable:
> 
> [root at host-172-10-0-8 ~]# curl http://169.254.169.254/latest/meta-data/hostname
> server-626663d6-cf90-4f2a-b888-7c3b6bdd1841.novalocal[root at host-172-10-0-8 ~]#
> 
> [root at host-172-10-0-8 ~]# nslookup server-626663d6-cf90-4f2a-b888-7c3b6bdd1841.novalocal
> Server:        172.10.0.3
> Address:    172.10.0.3#53
> 
> *** Can't find server-626663d6-cf90-4f2a-b888-7c3b6bdd1841.novalocal: No answer
> 
> 
> Note that, the hostname returned by metadata is the same as shown in the "Name" column from the "nova list" command.
> 
> How can we get the metadata service return the real hostname?
> 
> Thanks,
> Xin
> 
> 
> _______________________________________________
> Rdo-list mailing list
> Rdo-list at redhat.com
> https://www.redhat.com/mailman/listinfo/rdo-list
> 
> To unsubscribe: rdo-list-unsubscribe at redhat.com





More information about the dev mailing list