diff --git a/glance/api/versions.py b/glance/api/versions.py index 75a10d3d2e..081ba24bc5 100644 --- a/glance/api/versions.py +++ b/glance/api/versions.py @@ -14,12 +14,13 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from oslo_serialization import jsonutils from six.moves import http_client import webob.dec from glance.common import wsgi -from glance.i18n import _ +from glance.i18n import _, _LW versions_opts = [ @@ -58,6 +59,8 @@ Related options: CONF = cfg.CONF CONF.register_opts(versions_opts) +LOG = logging.getLogger(__name__) + class Controller(object): @@ -87,9 +90,18 @@ class Controller(object): build_version_object(2.0, 'v2', 'SUPPORTED'), ]) if CONF.enable_v1_api: + LOG.warn(_LW('The Images (Glance) v1 API is deprecated and will ' + 'be removed on or after the Pike release, following ' + 'the standard OpenStack deprecation policy. ' + 'Currently, the solution is to set ' + 'enable_v1_api=False and enable_v2_api=True in your ' + 'glance-api.conf file. Once those options are ' + 'removed from the code, Images (Glance) v2 API will ' + 'be switched on by default and will be the only ' + 'option to deploy and use.')) version_objs.extend([ - build_version_object(1.1, 'v1', 'SUPPORTED'), - build_version_object(1.0, 'v1', 'SUPPORTED'), + build_version_object(1.1, 'v1', 'DEPRECATED'), + build_version_object(1.0, 'v1', 'DEPRECATED'), ]) status = explicit and http_client.OK or http_client.MULTIPLE_CHOICES diff --git a/glance/common/config.py b/glance/common/config.py index a65dcfeb0c..607875850a 100644 --- a/glance/common/config.py +++ b/glance/common/config.py @@ -86,6 +86,17 @@ task_opts = [ 'based on the worst case scenario and be prepared to ' 'act in case they were wrong.')), ] + +_DEPRECATE_GLANCE_V1_MSG = _('The Images (Glance) version 1 API has been ' + 'DEPRECATED in the Newton release and will be ' + 'removed on or after Pike release, following ' + 'the standard OpenStack deprecation policy. ' + 'Hence, the configuration options specific to ' + 'the Images (Glance) v1 API are hereby ' + 'deprecated and subject to removal. Operators ' + 'are advised to deploy the Images (Glance) v2 ' + 'API.') + common_opts = [ cfg.BoolOpt('allow_additional_image_properties', default=True, help=_('Whether to allow users to specify image properties ' @@ -189,8 +200,18 @@ Related options: * None """)), + # NOTE(nikhil): Even though deprecated, the configuration option + # ``enable_v1_api`` is set to True by default on purpose. Having it enabled + # helps the projects that haven't been able to fully move to v2 yet by + # keeping the devstack setup to use glance v1 as well. We need to switch it + # to False by default soon after Newton is cut so that we can identify the + # projects that haven't moved to v2 yet and start having some interesting + # conversations with them. Switching to False in Newton may result into + # destabilizing the gate and affect the release. cfg.BoolOpt('enable_v1_api', default=True, + deprecated_reason=_DEPRECATE_GLANCE_V1_MSG, + deprecated_since='Newton', help=_(""" Deploy the v1 OpenStack Images API. @@ -225,6 +246,16 @@ Related options: """)), cfg.BoolOpt('enable_v2_api', default=True, + deprecated_reason=_('The Images (Glance) version 1 API has ' + 'been DEPRECATED in the Newton release. ' + 'It will be removed on or after Pike ' + 'release, following the standard ' + 'OpenStack deprecation policy. Once we ' + 'remove the Images (Glance) v1 API, only ' + 'the Images (Glance) v2 API can be ' + 'deployed and will be enabled by default ' + 'making this option redundant.'), + deprecated_since='Newton', help=_(""" Deploy the v2 OpenStack Images API. @@ -255,6 +286,8 @@ Related options: """)), cfg.BoolOpt('enable_v1_registry', default=True, + deprecated_reason=_DEPRECATE_GLANCE_V1_MSG, + deprecated_since='Newton', help=_(""" Deploy the v1 API Registry service. diff --git a/glance/tests/functional/test_api.py b/glance/tests/functional/test_api.py index 178accdbaa..22f533e36f 100644 --- a/glance/tests/functional/test_api.py +++ b/glance/tests/functional/test_api.py @@ -53,12 +53,12 @@ class TestApiVersions(functional.FunctionalTest): }, { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': url % '1'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': url % '1'}], }, ]} @@ -117,12 +117,12 @@ class TestApiVersions(functional.FunctionalTest): versions = {'versions': [ { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': url % '1'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': url % '1'}], }, ]} @@ -165,12 +165,12 @@ class TestApiPaths(functional.FunctionalTest): }, { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': url % '1'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': url % '1'}], }, ]} diff --git a/glance/tests/unit/test_versions.py b/glance/tests/unit/test_versions.py index c00af62632..f66519ea24 100644 --- a/glance/tests/unit/test_versions.py +++ b/glance/tests/unit/test_versions.py @@ -61,13 +61,13 @@ class VersionsTest(base.IsolatedUnitTest): }, { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'http://127.0.0.1:9292/v1/'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'http://127.0.0.1:9292/v1/'}], }, @@ -110,13 +110,13 @@ class VersionsTest(base.IsolatedUnitTest): }, { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'https://example.com:9292/v1/'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'https://example.com:9292/v1/'}], }, @@ -158,13 +158,13 @@ class VersionsTest(base.IsolatedUnitTest): }, { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'http://localhost:9292/v1/'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'http://localhost:9292/v1/'}], }, @@ -207,13 +207,13 @@ class VersionsTest(base.IsolatedUnitTest): }, { 'id': 'v1.1', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'https://localhost:9292/v1/'}], }, { 'id': 'v1.0', - 'status': 'SUPPORTED', + 'status': 'DEPRECATED', 'links': [{'rel': 'self', 'href': 'https://localhost:9292/v1/'}], }, diff --git a/releasenotes/notes/deprecate-v1-api-6c7dbefb90fd8772.yaml b/releasenotes/notes/deprecate-v1-api-6c7dbefb90fd8772.yaml new file mode 100644 index 0000000000..79b70983a8 --- /dev/null +++ b/releasenotes/notes/deprecate-v1-api-6c7dbefb90fd8772.yaml @@ -0,0 +1,19 @@ +--- +prelude: > + - The Images (Glance) version 1 API has been DEPRECATED. + Please see deprecations section for more information. + +deprecations: + - With the deprecation of the Images (Glance) version 1 + API in the Newton release, it is subject to removal on + or after the Pike release. The configuration options + specific to the Images (Glance) v1 API have also been + deprecated and are subject to removal. An indirectly related + configuration option enable_v2_api has been deprecated too + as it becomes redundant once the Images (Glance) v1 API is + removed. Appropriate warning messages have been setup for + the deprecated configuration options and when the Images + (Glance) v1 API is enabled (being used). Operators are + advised to deploy the Images (Glance) v2 API. The standard + OpenStack deprecation policy will be followed for the + removals.