Ask Your Question
0

python nova api uuid

asked 2013-11-09 10:57:43 -0500

jcpowermac gravatar image

updated 2013-11-09 10:58:23 -0500

I am new to python and openstack. I looked in the API documentation and I can't seem to find it. How do I get the uuid of an instance? Thanks Joe

 import libvirt
    import sys
    import prettytable
    import novaclient
    import ovs
    from novaclient.v1_1 import client
    from novaclient import exceptions as novaexceptions

    username = "admin"
    password = ""
    tenant = "admin"
    authurl = "http://10.53.253.70:5000/v2.0"

    osconn = client.Client(username, password, tenant, authurl, service_type="compute")
    if osconn is None:
        print 'failed to open connection to open stack'
        sys.exit(1)

    servers = osconn.servers.list(detailed=True)

    for srv in servers:
            print srv
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-11-09 12:06:45 -0500

serverascode gravatar image

updated 2013-11-09 12:07:04 -0500

Should be srv.id in your example.

edit flag offensive delete link more

Comments

Thanks. I just looked into the https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/views/servers.py again. I assume that the line 83, show function/method is the place I should be looking.

jcpowermac gravatar imagejcpowermac ( 2013-11-11 07:11:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-11-09 10:57:43 -0500

Seen: 421 times

Last updated: Nov 09 '13