[openstack-dev] Question on hostname generation?

Joshua Harlow harlowja at yahoo-inc.com
Mon Aug 13 17:03:08 UTC 2012


Thx vish,

Ok, maybe something to work on.

I have a need/want… to make the hostname based off the IP (or one of the IPs if many) so it almost needs to hook-in to those places (and/or plugin extension like) to change that, might be something that others want also.

What say everyone :-P

From: Vishvananda Ishaya <vishvananda at gmail.com<mailto:vishvananda at gmail.com>>
Reply-To: OpenStack Development Mailing List <openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>>
Date: Fri, 10 Aug 2012 21:14:02 -0700
To: OpenStack Development Mailing List <openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>>
Subject: Re: [openstack-dev] Question on hostname generation?


On Aug 10, 2012, at 6:37 PM, Joshua Harlow <harlowja at yahoo-inc.com<mailto:harlowja at yahoo-inc.com>> wrote:


I was wondering about the following case (and am not sure if its been addressed in folsom).

At yahoo, instead of the default hostname that seems to be automatically established (ie 'server-XYZ.novalocal' was in essex) we were wondering if there is anything in folsom that say lets us override that generation with either a module (or a subclass) or a new function without having to patch nova code. Sometimes we want a default hostname of a different format (as probably do others) and I just am not sure if quantum is directing this default hostname, or if nova still is, or if its some mix of both (the metadata + cloud-init can affect the hostname as well, so perhaps the configdrive work should be the only one establish a 'real' hostname?).

I have found the following pieces of hostname related code but am not sure if this is all the places that make hostnames :-)

 *   https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L109

Is this the only place nowadays?? Is there something in quantum also?

Hostname in metadata (it moved a little):

https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L122

Hostname from dhcp:

https://github.com/openstack/nova/blob/master/nova/network/linux_net.py#L811

instance_hostname comes from instance['hostname'] in the db, which is generated here:

https://github.com/openstack/nova/blob/master/nova/compute/api.py#L636

Seems like there is no plugin mechanism, but one we could easily add a flag that could be a format string applied to the instance record so it is easy to customize.

Vish

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20120813/50ebf769/attachment.html>


More information about the OpenStack-dev mailing list