The Nova V3 API no longer exists. Although a version of the framework exists in Nova as part of the new V2.1 API which is equivalent to the V2 API there is no need to make mention of V3 in the novaclient documentation. In future we will be distinguish between legacy Nova API support (one implementation of V2) and microversions Nova API support (the new one) to reduce confusion around version numbers which will change quite a bit without the framework changing. Co-Authored-By: Andrey Kurilin <akurilin@mirantis.com> Change-Id: Id0ff51e1165cb267045d7a63aff13c0e41336738
64 lines
1.6 KiB
ReStructuredText
64 lines
1.6 KiB
ReStructuredText
The :mod:`novaclient` Python API
|
|
==================================
|
|
|
|
.. module:: novaclient
|
|
:synopsis: A client for the OpenStack Nova API.
|
|
|
|
.. currentmodule:: novaclient
|
|
|
|
Usage
|
|
-----
|
|
|
|
First create a client instance with your credentials::
|
|
|
|
>>> from novaclient import client
|
|
>>> nova = client.Client(VERSION, USERNAME, PASSWORD, PROJECT_ID, AUTH_URL)
|
|
|
|
Here ``VERSION`` can be: ``1.1``, ``2``.
|
|
|
|
Alternatively, you can create a client instance using the keystoneclient
|
|
session API::
|
|
|
|
>>> from keystoneclient.auth.identity import v2
|
|
>>> from keystoneclient import session
|
|
>>> from novaclient 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`_.
|
|
|
|
.. _Using Sessions: http://docs.openstack.org/developer/python-keystoneclient/using-sessions.html
|
|
|
|
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:
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
|
|
ref/index
|
|
ref/v2/index
|