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:
parent
1a2bb48432
commit
c513f05ce9
@ -42,10 +42,12 @@ def make_client(instance):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from novaclient.v1_1.contrib import list_extensions
|
from novaclient.v1_1.contrib import list_extensions
|
||||||
|
|
||||||
compute_client = nova_client.get_client_class(
|
if _compute_api_version is not None:
|
||||||
instance._api_version[API_NAME],
|
version = _compute_api_version
|
||||||
)
|
else:
|
||||||
LOG.debug('Instantiating compute client: %s', compute_client)
|
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
|
# Set client http_log_debug to True if verbosity level is high enough
|
||||||
http_log_debug = utils.get_effective_log_level() <= logging.DEBUG
|
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
|
# Remember interface only if it is set
|
||||||
kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
|
kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
|
||||||
|
|
||||||
if _compute_api_version is not None:
|
client = nova_client.Client(
|
||||||
kwargs.update({'api_version': _compute_api_version})
|
version,
|
||||||
|
|
||||||
client = compute_client(
|
|
||||||
session=instance.session,
|
session=instance.session,
|
||||||
extensions=extensions,
|
extensions=extensions,
|
||||||
http_log_debug=http_log_debug,
|
http_log_debug=http_log_debug,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user