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 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens' -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': 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3/auth/tokens', # For US West
'project_id': 'kony-openstack-poc-10925891839020' # project name I got from Horizon
}
if __name__ == '__main__':
try:
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