diff --git a/nova/conf/glance.py b/nova/conf/glance.py index 9d70be52d09b..fb0e7d97ebf5 100644 --- a/nova/conf/glance.py +++ b/nova/conf/glance.py @@ -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 ' diff --git a/nova/image/glance.py b/nova/image/glance.py index 5ab838b2c671..1ab4972a922f 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -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,