Ask Your Question

Nova Connection Issue through Python API.

asked 2014-06-04 02:19:34 -0500

Dhana gravatar image

Hi, I am using HP Nova Python API to make a connection. However I am not able to create one. I get a 400 error.My code is as follows. Please let me know what is wrong with the code below. Also tell me if I need to add auth_token here. I tried to get my auth_token still I am not able to get it. I tried the following command:-

$ curl -i '' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": {"tenantName": "314123431241324123", "passwordCredentials": {"username": "XXXXXXX", "password": "XXXXXXXX"}}}'

import novaclient.v1_1.client as nvclient

def get_nova_creds():
    return {'username': 'XXXXXXXXXXXXXXXXX', # Same as horizon login
               'api_key': '***********************', # Same as  horizon password
               'auth_url': '', # For US West
               'project_id': 'kony-openstack-poc-10925891839020' # project name I got from Horizon

if __name__ == '__main__':
        creds = get_nova_creds()
        nova = nvclient.Client(**creds)

        f1 = nova.flavors.find(ram=2048)
        nova.servers.create("my-server", flavor=f1)
    except BaseException as b:
        print 'exception is ', b
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-04 02:32:05 -0500

Dhana gravatar image

HI, I figured out hte problem. I changed the get_nova_creds as follows:-

def get_nova_creds():
    return {'username': os.environ['OS_USERNAME'], 'api_key': os.environ['OS_PASSWORD'],
         'auth_url': os.environ['OS_AUTH_URL'], 'project_id': os.environ['OS_TENANT_NAME']}

The correpsonding values are:-

OS_USERNAME=#username #
OS_TENANT_NAME=#same as project name# OS_AUTH_URL=

Basically the problem is that port 35357 is disabled. This resulted in a 0 response.

Thanks guys. Happy programming!

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2014-06-04 02:19:34 -0500

Seen: 241 times

Last updated: Jun 04 '14