0a60aae852
Module novaclient.v1_1 is used as implementation of V1.1, V2 and V3. Since future development(microversioning) will be done across V2, implementation should be done in appropriate module(to prevent misleading). Despite the fact that implementation for all versions are equal, discover method for contrib path worked only for v1.1. This patch fixes this bug and modifies shell tests to check all versions. Change-Id: Ib6798f4dfe177586302141f522dc593560ce6a5b
1.6 KiB
1.6 KiB
The novaclient
Python API
novaclient
novaclient
Usage
First create a client instance with your credentials:
>>> from novaclient.client import Client
>>> nova = Client(VERSION, USERNAME, PASSWORD, PROJECT_ID, AUTH_URL)
Here VERSION
can be: 1.1
, 2
and 3
.
Alternatively, you can create a client instance using the keystoneclient session API:
>>> from keystoneclient.auth.identity import v2
>>> from keystoneclient import session
>>> from novaclient.client import Client
>>> auth = v2.Password(auth_url=AUTH_URL,
username=USERNAME,
password=PASSWORD,
tenant_name=PROJECT_ID)
>>> sess = session.Session(auth=auth)
>>> nova = client.Client(VERSION, session=sess)
For more information on this keystoneclient API, see Using Sessions.
Then call methods on its managers:
>>> nova.servers.list()
[<Server: buildslave-ubuntu-9.10>]
>>> nova.flavors.list()
[<Flavor: 256 server>,
<Flavor: 512 server>,
<Flavor: 1GB server>,
<Flavor: 2GB server>,
<Flavor: 4GB server>,
<Flavor: 8GB server>,
<Flavor: 15.5GB server>]
>>> fl = nova.flavors.find(ram=512)
>>> nova.servers.create("my-server", flavor=fl)
<Server: my-server>
Reference
For more information, see the reference:
ref/index ref/v2/index