Hi,<div><br></div><div>Just tried this, it works but I'd also like to rename /var/lib/nova/instances/ according to the hostname. At the moment this only rename (output from nova show):</div><div><br></div><div>| OS-EXT-SRV-ATTR:instance_name | mon-nom <br>
</div><div><br></div><div>Is it possible?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers!<br><br><div class="gmail_quote">On Wed, Nov 28, 2012 at 7:31 PM, John Garbutt <span dir="ltr"><<a href="mailto:John.Garbutt@citrix.com" target="_blank">John.Garbutt@citrix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple"><div><p class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">I think this is the flag you want to change and its default:<u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">instance_name_template="instance-%08x"<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">You should try:<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">instance_name_template="%(hostname)s"<u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">This is the code that deals with it:<u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/models.py#L203" target="_blank">https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/models.py#L203</a><u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">This is where the name gets set inside XenAPI:<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vmops.py#L260" target="_blank">https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vmops.py#L260</a><u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Which eventually gets here (i.e. you could just hack this file, if the above fails):<u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L193" target="_blank">https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L193</a><u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hope that helps,<u></u><u></u></span></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">John<u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<div style="border-style:none none none solid;border-left-color:blue;border-left-width:1.5pt;padding:0cm 0cm 0cm 4pt"><div><div style="border-style:solid none none;border-top-color:rgb(225,225,225);border-top-width:1pt;padding:3pt 0cm 0cm">
<p class=""><b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> Afef MDHAFFAR [mailto:<a href="mailto:afef.mdhaffar@gmail.com" target="_blank">afef.mdhaffar@gmail.com</a>] <br>
<b>Sent:</b> 28 November 2012 18:18<br><b>To:</b> John Garbutt<br><b>Cc:</b> <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack@lists.launchpad.net</a><br><b>Subject:</b> Re: [Openstack] how to let the instance name (instance-xxx) equal to the hostname of the instance (chosen by the user)??<u></u><u></u></span></p>
</div></div><div><div class="h5"><p class=""><u></u> <u></u></p><div><p class="">Hi,<u></u><u></u></p></div><div><p class=""><u></u> <u></u></p></div><p class="">Yes - when you list your vms via xe vm-list, you get the name-label of the instance. <u></u><u></u></p>
<div><p class="">The question is how to modify openstack to let the hostname of the created instance equal to this name-label?<u></u><u></u></p></div><div><p class=""><u></u> <u></u></p></div><div><p class="">Thank you,<u></u><u></u></p>
</div><div><p class="">Afef<u></u><u></u></p></div><div><p class=""><u></u> <u></u></p><div><p class="">2012/11/28 John Garbutt <<a href="mailto:John.Garbutt@citrix.com" target="_blank">John.Garbutt@citrix.com</a>><u></u><u></u></p>
<blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hi,</span><u></u><u></u></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Not quick sure which “name” of the instance you are refereeing to.</span><u></u><u></u></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Do you mean when you open XenCenter it shows you a different name?</span><u></u><u></u></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks,</span><u></u><u></u></p>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">John</span><u></u><u></u></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<div style="border-style:none none none solid;border-left-color:blue;border-left-width:1.5pt;padding:0cm 0cm 0cm 4pt"><div><div style="border-style:solid none none;border-top-color:rgb(225,225,225);border-top-width:1pt;padding:3pt 0cm 0cm">
<p class=""><b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> openstack-bounces+john.garbutt=<a href="mailto:citrix.com@lists.launchpad.net" target="_blank">citrix.com@lists.launchpad.net</a> [mailto:<a href="mailto:openstack-bounces%2Bjohn.garbutt" target="_blank">openstack-bounces+john.garbutt</a>=<a href="mailto:citrix.com@lists.launchpad.net" target="_blank">citrix.com@lists.launchpad.net</a>] <b>On Behalf Of </b>Afef MDHAFFAR<br>
<b>Sent:</b> 23 November 2012 17:22<br><b>To:</b> <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack@lists.launchpad.net</a><br><b>Subject:</b> [Openstack] how to let the instance name (instance-xxx) equal to the hostname of the instance (chosen by the user)??</span><u></u><u></u></p>
</div></div><div><div><p class=""> <u></u><u></u></p><p class="">Hi all,<u></u><u></u></p><div><p class=""> <u></u><u></u></p></div><div><p class="">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).<u></u><u></u></p>
</div><div><p class="">Is it possible to do that by only configuring openstack? If yes, could you please guide me to the suitable flag?<u></u><u></u></p></div><div><p class="">If not, could you please guide me to the right python files that need to be changed.<u></u><u></u></p>
</div><div><p class="">I use the folsom release, with XCP as a virtualization technology. <u></u><u></u></p></div><div><p class=""> <u></u><u></u></p></div><div><p class="">Thank you,<u></u><u></u></p></div><div><p class="" style="margin-bottom:12pt">
Afef<u></u><u></u></p></div></div></div></div></div></div></blockquote></div><p class=""><br><br clear="all"><u></u><u></u></p><div><p class=""><u></u> <u></u></p></div><p class="" style="margin-bottom:12pt">-- <br>Afef MDHAFFAR<br>
<a href="http://www.redcad.org/members/mdhaffar/" target="_blank">http://www.redcad.org/members/mdhaffar/</a><br><br><br><u></u><u></u></p></div></div></div></div></div></div><br>_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
<br></blockquote></div><br></div>