Revision history [back]

click to hide/show revision 1
initial version

Nova Connection Issue through Python API.

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