← Back to team overview

openstack team mailing list archive

Re: how to let the instance name (instance-xxx) equal to the hostname of the instance (chosen by the user)??

 

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@xxxxxxxxx]
Sent: 28 November 2012 18:18
To: John Garbutt
Cc: openstack@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxx<mailto:John.Garbutt@xxxxxxxxxx>>
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@xxxxxxxxxxxxxxxxxxx<mailto:citrix.com@xxxxxxxxxxxxxxxxxxx> [mailto:openstack-bounces+john.garbutt<mailto:openstack-bounces%2Bjohn.garbutt>=citrix.com@xxxxxxxxxxxxxxxxxxx<mailto:citrix.com@xxxxxxxxxxxxxxxxxxx>] On Behalf Of Afef MDHAFFAR
Sent: 23 November 2012 17:22
To: openstack@xxxxxxxxxxxxxxxxxxx<mailto:openstack@xxxxxxxxxxxxxxxxxxx>
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/



Follow ups

References