Ask Your Question

how does nova maps the display name of vm or instance in openstack to instance name in KVM/ESX etc. [closed]

asked 2014-04-02 03:42:30 -0500

manish gravatar image

instance name in horizon or by using nova api shows the display name of vm but when same is queried on KVM host using virsh it shows different name.

ex : i have instance with "testvm" as the name but when i list same on KVM host (compute node) using virsh command it shows "instance-0000000c"

Need help in finding out where does this mapping is stored.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by manish
close date 2014-04-03 04:08:32.935739

3 answers

Sort by ยป oldest newest most voted

answered 2014-04-02 15:34:42 -0500

larsks gravatar image

Nova names virsh domains based on the id field stored in the nova.instances table. For example, on my system, I have a single instance running named imap:

$ nova list | cut -c1-80
| ID                                   | Name | Status | Task State | Power Stat
| 71d68b44-625e-4aca-81e0-fa02c80da6b3 | imap | ACTIVE | -          | Running   

I can find this in the database using the uuid:

MariaDB [nova]> select hostname,id from instances where uuid = '71d68b44-625e-4aca-81e0-fa02c80da6b3';
| hostname | id  |
| imap     | 287 |

I can see that this has id = 287. The virsh domain will be named instance-<id_as_hex>, where id_as_hex is the id expressed as a hexadecimal number. Since decimal 287 = hex 11F, I would expect to see instance-11f. Checking:

$ virsh list
 Id    Name                           State
 4     instance-0000011f              running

If you have administrative credentials for your nova environment, you can use nova show to see this relationship without mucking about in the database:

$ nova show 71d68b44-625e-4aca-81e0-fa02c80da6b3
| OS-EXT-SRV-ATTR:host                | compute0             |
| OS-EXT-SRV-ATTR:hypervisor_hostname | |
| OS-EXT-SRV-ATTR:instance_name       | instance-0000011f    |

Here you can see the OS-EXT-SRV-ATTR: attributes that include both the virsh domain name and the hypervisor hostname.

edit flag offensive delete link more

answered 2014-04-03 04:15:25 -0500

manish gravatar image

Thanks for your reply, yes i was also able to find out details using db and then API I have used /v2/servers/detail it gave me the details which is shown above with "nova show" commands, the generation of instance name can be changed based on "instance_name_template" variable in nova.conf file. Better way would be to use UUID to find out mapping.

edit flag offensive delete link more

answered 2014-04-02 07:21:46 -0500

Maybe what you are referring to is instance_name_template (that, as default, is configured to be instance-%08x) I think you could change the default behavior and let it map directly to the 'openstack' name.

Have a look to nova.conf file: (

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-04-02 03:42:30 -0500

Seen: 7,541 times

Last updated: Apr 02 '14