[Openstack] how to let the instance name (instance-xxx) equal to the hostname of the instance (chosen by the user)??

John Garbutt John.Garbutt at citrix.com
Wed Nov 28 18:31:34 UTC 2012


I think this is the flag you want to change and its default:
instance_name_template="instance-%08x"

You should try:
instance_name_template="%(hostname)s"

This is the code that deals with it:
https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/models.py#L203

This is where the name gets set inside XenAPI:
https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vmops.py#L260
Which eventually gets here (i.e. you could just hack this file, if the above fails):
https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L193

Hope that helps,
John

From: Afef MDHAFFAR [mailto:afef.mdhaffar at gmail.com]
Sent: 28 November 2012 18:18
To: John Garbutt
Cc: openstack at lists.launchpad.net
Subject: Re: [Openstack] how to let the instance name (instance-xxx) equal to the hostname of the instance (chosen by the user)??

Hi,

Yes - when you list your vms via xe vm-list, you get the name-label of the instance.
The question is how to modify openstack to let the hostname of the created instance equal to this name-label?

Thank you,
Afef

2012/11/28 John Garbutt <John.Garbutt at citrix.com<mailto:John.Garbutt at citrix.com>>
Hi,

Not quick sure which "name" of the instance you are refereeing to.

Do you mean when you open XenCenter it shows you a different name?

Thanks,
John

From: openstack-bounces+john.garbutt=citrix.com at lists.launchpad.net<mailto:citrix.com at lists.launchpad.net> [mailto:openstack-bounces+john.garbutt<mailto:openstack-bounces%2Bjohn.garbutt>=citrix.com at lists.launchpad.net<mailto:citrix.com at lists.launchpad.net>] On Behalf Of Afef MDHAFFAR
Sent: 23 November 2012 17:22
To: openstack at lists.launchpad.net<mailto:openstack at lists.launchpad.net>
Subject: [Openstack] how to let the instance name (instance-xxx) equal to the hostname of the instance (chosen by the user)??

Hi all,

Due to some requirements, I have to modify openstack source code in order to let the name of the instance (in Xen Server) equal to the hostname of the instance (chosen by the user).
Is it possible to do that by only configuring openstack? If yes, could you please guide me to the suitable flag?
If not, could you please guide me to the right python files that need to be changed.
I use the folsom release, with XCP as a virtualization technology.

Thank you,
Afef



--
Afef MDHAFFAR
http://www.redcad.org/members/mdhaffar/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20121128/4c77e361/attachment.html>


More information about the Openstack mailing list