OpenStack Common Client Library

Registered by Alexej Ababilov

Unfortunately, nova, keystone, cinder, and glance clients are very inconsistent. A lot of code was copied between all these clients instead of moving it to a common library. The code was edited without synchronization between clients, so, they have different behaviour:

* keystoneclient reissues authorization request if the token is expired but glanceclient doesn't;
* novaclient supports authorization plugins while the others don't;
* all client constructors use different parameters (api_key in nova or password in keystone and so on);
* keystoneclient authenticates immediately in __init__, while novaclient does it lazily during first method call;
* keystone- and novaclient can manage service catalogs and accept keystone's auth URI while glanceclient allows endpoints only;
* keystoneclient can support authorization with an unscoped token but novaclient doesn't;
* novaclient uses class composition while keystoneclient uses inheritance: composition allows sharing common token and service catalog between several clients.

That is worth to note that glanceclient still uses httplib instead of more convenient python-requests.

There is python-openstackclient, and it is an awesome tool. But it is a console client, not an API client library.

The basic library can be used by python-{nova,keystone,glance}client that are used, in their order, by python-openstackclient, horizon, etc.

An sample implementation of the basic library was written in Jun, 2012 and is accessible at

Here is an example how to use the library from oslo-incubator:

from openstack.common.apiclient.client import HttpClient
http_client = HttpClient(username="...", password="...", tenant_name="...", auth_uri="...")

from novaclient.v1_1.client import Client
print Client(http_client).servers.list()

from keystoneclient.v2_0.client import Client
print Client(http_client).tenants.list()

This blueprint is a reorganization of older blueprints and

Blueprint information

Mark McLoughlin
Alexej Ababilov
Alexej Ababilov
Series goal:
Accepted for havana
Milestone target:
milestone icon 2013.2
Started by
Alexej Ababilov
Completed by
Mark McLoughlin

Related branches



First part:

Second part:

Alessio - since the second patch got merged, what remains to be done before we can mark his as implemented?

Second part doesn't look merged to me --ttx

I'm pretty sure the second part relates to the common-cli-utils blueprint

Also, Adam Young appears to have some sort of issue with this:

-- markmc

The second part: ( just waits for approval. Also, I am working on moving apiclient to keystoneclient (,n,z) - when this work will be finished, we can discuss with the keystoneclient team what part of apiclient must remain in oslo. -- alessio


Work Items

Dependency tree

* Blueprints in grey have been implemented.