How to connect to OpenStack Keystone API using novaclient

>>> USER = 'admin'
>>> PASS = '*****'
>>> TENANT = 'admin'
>>> AUTH_URL = "http://192.168.56.101:5000/v2.0"
>>>
>>> from novaclient.v1_1 import client
>>>
>>> nt = client.Client(username=USER, api_key=PASS, project_id=TENANT, auth_url=AUTH_URL, service_type='compute')
>>>
>>>
>>>
>>>
>>> print nt.flavors.list()
[<Flavor: m1.tiny>, <Flavor: new>, <Flavor: m1.small>, <Flavor: m1.medium>, <Flavor: m1.large>, <Flavor: m1.nano>, <Flavor: m1.heat>, <Flavor: m1.xlarge>, <Flavor: m1.micro>]
>>>
>>> 
>>>
>>> 
>>> obj=nt.flavors.list()
>>> obj[0]
<Flavor: m1.tiny>

Comments

Popular posts from this blog

AttributeError: Got AttributeError when attempting to get a value for field `abc` on serializer `PfleSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'abc'.

ImportError: No module named regex