[Openstack-operators] how can I make a new VM use the project name as sub-domain ?

Ahmed Ali (ahmeali) ahmeali at cisco.com
Tue Aug 19 16:12:21 UTC 2014


Hi Alex, sorry I did not catch this email earlier, sub-domain can be part of the post script or user-data file, hostname is based on the name you provide during nova boot or a prefixed uuid if more than instance are provisioned.

you can use cloud-init and user data using APIs or “Post-Creation” script from horizon, .


 Examples for cloud-init and user-data:

http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/files/head:/doc/examples/

Look for cloud-config-boot-cmds.txt example, you can run any command to modify hostname

Cheers
Ahmed


From: Alex Leonhardt <aleonhardt.py at gmail.com<mailto:aleonhardt.py at gmail.com>>
Date: Sunday, August 17, 2014 at 2:09 AM
To: Ahmed Ali <ahmeali at cisco.com<mailto:ahmeali at cisco.com>>
Cc: Abel Lopez <alopgeek at gmail.com<mailto:alopgeek at gmail.com>>, openstack-operators <openstack-operators at lists.openstack.org<mailto:openstack-operators at lists.openstack.org>>
Subject: Re: [Openstack-operators] how can I make a new VM use the project name as sub-domain ?

Hi Ahmed,

ok, thanks - so where does the hostname thats displayed in Horizon come from / is being generated then ? The same domain across all networks is fine at the moment ;) ... we just need to add a "sub-domain" to hosts based on the project name.

Thanks for your help!
Alex



On 15 August 2014 17:31, Ahmed Ali (ahmeali) <ahmeali at cisco.com<mailto:ahmeali at cisco.com>> wrote:
If you use dhcp_domain in nova it will be applied to all projects, IP ranges can be created per project or shared with other projects.

>> or do I simply change the OS's hostname config and the nova-api & horizon dashboard will pick that up ?
No, I do not think this will happen

Hostnames do not uniquely identify instances, it is the uuid.

As far as I know, If you want to custom define hostname and domain per instance it would be worth looking into cloud-init and user data using APIs, from horizon you can use “Post-Creation” tab during launch instance wizard and provide a customization script.

Good luck

Ali

From: Alex Leonhardt <aleonhardt.py at gmail.com<mailto:aleonhardt.py at gmail.com>>
Date: Friday, August 15, 2014 at 7:08 AM
To: Ahmed Ali <ahmeali at cisco.com<mailto:ahmeali at cisco.com>>
Cc: Abel Lopez <alopgeek at gmail.com<mailto:alopgeek at gmail.com>>, openstack-operators <openstack-operators at lists.openstack.org<mailto:openstack-operators at lists.openstack.org>>

Subject: Re: [Openstack-operators] how can I make a new VM use the project name as sub-domain ?

Hi,

sorry still not quite what I'm after ... so, when I use the Horizon Dashboard (or the nova api client) I can create a VM that will then get a name allocated based on what I named it, or, what I chose as a prefix if I want to provision 2 or more instances (uuidgen is used i guess).

as I will have the same domain + the same IP ranges set for all projects, there will eventually be 2 hosts would get the exact same name, if I were to put something in place that'll automatically update my DNS - how can I change nova/horizon to add a ".$project_name" to a VM's name, or do I simply change the OS's hostname config and the nova-api & horizon dashboard will pick that up ?

Alex




On 14 August 2014 23:59, Ahmed Ali (ahmeali) <ahmeali at cisco.com<mailto:ahmeali at cisco.com>> wrote:
Try to look into changing dhcp_domain in nova.conf to make it work, but will be for all instances.

dhcp_domain = <domain>
Note: <domain> is the domain name to use for building the hostnames

Or look into cloud-init to customize FQDN per instance, see http://docs.openstack.org/user-guide/content/user-data.html

Hope this is what you are looking for.

Ali


From: Alex Leonhardt <aleonhardt.py at gmail.com<mailto:aleonhardt.py at gmail.com>>
Date: Thursday, August 14, 2014 at 3:08 PM
To: Abel Lopez <alopgeek at gmail.com<mailto:alopgeek at gmail.com>>
Cc: openstack-operators <openstack-operators at lists.openstack.org<mailto:openstack-operators at lists.openstack.org>>
Subject: Re: [Openstack-operators] how can I make a new VM use the project name as sub-domain ?

Hi Abel,

Yep - I know - but question is, will the OS hostname automatically update the hostname displayed by Horizon when people are using the Dashboard ? Or, if not, how can I convince whatever is creating the VM ( nova-api ? ) to set the hostname as I require ?

Alex



On 14 August 2014 20:47, Abel Lopez <alopgeek at gmail.com<mailto:alopgeek at gmail.com>> wrote:
You can also pass user-data on Horizon, it's one of the window tabs in the launch instance dialog.


On Thursday, August 14, 2014, Alex Leonhardt <aleonhardt.py at gmail.com<mailto:aleonhardt.py at gmail.com>> wrote:
Thanks!

What about the openstack dashboard - will it update the VM's hostname based on the OS's hostname that's set ?

Alex


On 14 August 2014 20:08, Abel Lopez <alopgeek at gmail.com> wrote:
Some examples on using user-data

http://docs.openstack.org/user-guide/content/user-data.html

On Aug 14, 2014, at 11:48 AM, Alex Leonhardt <aleonhardt.py at gmail.com> wrote:

hi all,

am running openstack in a flat-network with just 1 IP range / network and would like to have the VMs' named after the project, e.g.:

project name: dev

host name: redis1
domain: acme.com<http://acme.com/>

resulting name: redis1.dev.acme.com<http://redis1.dev.acme.com/>

at the moment i'd just get a result of redis1.acme.com<http://redis1.acme.com/> - but do want/need the sub-domains as

project: dev
and
project: internal
and
project: frontend
etc.

may use the same name for things they work on ... how is this accomplished ? Or where do I have to look at (in the code) to try and make this a default ?

Thanks a lot!
Alex

_______________________________________________
OpenStack-operators mailing list
OpenStack-operators at lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20140819/9513c050/attachment.html>


More information about the OpenStack-operators mailing list