Use novaclient.client.Client for initialization Nova client

`novaclient.client.Client` is a recommended entry point for novaclient.
It supports backward-compatibility and allows Nova-folks to change
interfaces of inner versioned clients classes.

Change-Id: Iaf20714f63c307f88a451759f041ca509fbcf6f8
This commit is contained in:
Andrey Kurilin 2015-09-09 18:00:50 +03:00
parent 1a2bb48432
commit c513f05ce9

View File

@ -42,10 +42,12 @@ def make_client(instance):
except ImportError:
from novaclient.v1_1.contrib import list_extensions
compute_client = nova_client.get_client_class(
instance._api_version[API_NAME],
)
LOG.debug('Instantiating compute client: %s', compute_client)
if _compute_api_version is not None:
version = _compute_api_version
else:
version = instance._api_version[API_NAME]
LOG.debug('Instantiating compute client for V%s' % version)
# Set client http_log_debug to True if verbosity level is high enough
http_log_debug = utils.get_effective_log_level() <= logging.DEBUG
@ -55,10 +57,8 @@ def make_client(instance):
# Remember interface only if it is set
kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
if _compute_api_version is not None:
kwargs.update({'api_version': _compute_api_version})
client = compute_client(
client = nova_client.Client(
version,
session=instance.session,
extensions=extensions,
http_log_debug=http_log_debug,