Introduce a CONF flag to determine glance client version

This patch introduces a CONF flag to determine the glance client
version in use. This flag is set to True currently to ensure
that the glance v1 path is honored as default. However, once the
nova glance proxy is updated to use glance v2 APIs and we are ready
to discard the glance v1 APIs, this flag shall be removed
completely.

Related to blueprint use-glance-v2-api

Change-Id: I90396d71aeac710a13746a10d0218d06dd7503c0
This commit is contained in:
Sudipta Biswas
2016-05-13 14:14:36 +05:30
parent 355fa5307f
commit 16dd86f992
2 changed files with 32 additions and 1 deletions

View File

@@ -41,6 +41,33 @@ should be fully qualified urls of the form
help='A list of url scheme that can be downloaded directly '
'via the direct_url. Currently supported schemes: '
'[file].'),
cfg.BoolOpt('use_glance_v1',
default=True,
help="""
This flag is a temporary conf value to segregate paths between glance v1
and glance v2 API usage inside the nova image proxy. This is set to True
by default to use Glance V1 APIs as default. However, it would be flipped
to False, once the nova image proxy is ready to adopt V2 APIs. Eventually
this flag would be deprecated once the proxy gets rid of all the glance
V1 API code.
* Possible values:
True or False
* Services that use this:
``nova-api``
``nova-compute``
``nova-conductor``
* Related options:
None
""",
deprecated_for_removal=True,
deprecated_reason='This is a temporary flag to be removed '
'as soon as the V2 path works'),
cfg.BoolOpt('verify_glance_signatures',
default=False,
help='Require Nova to perform signature verification on '

View File

@@ -147,7 +147,11 @@ def get_api_servers():
class GlanceClientWrapper(object):
"""Glance client wrapper class that implements retries."""
def __init__(self, context=None, endpoint=None, version=1):
def __init__(self, context=None, endpoint=None):
if CONF.glance.use_glance_v1:
version = 1
else:
version = 2
if endpoint is not None:
self.client = self._create_static_client(context,
endpoint,