Deprecate the Images (Glance) v1 API

This patch deprecates the Images (Glance) v1 API and sets up a warning
message for the operators if they have enabled it. It also indicates
that we intend to remove the v1 API on or after the Pike release and
operators are encouraged to deploy only the v2 API. The message also
states that after removal of the v1 API, the only option to deploy and
use will be the Images v2 API.

The commit includes:

  * Deprecation warning of the v1 API if it's enabled
  * Deprecation warning for the following configuration options and
    release they have been deprecated since:
      * enable_v1_api
      * enable_v2_api
      * enable_v1_registry
  * Reason why the v1 API has still been kept enabled by default via
    the corresponding configuration option
  * Reason for deprecating the configuration option enable_v2_api, even
    though we are only deprecating the v1 API
  * Necessary test changes to ensure the deprecated API is checked
    accordingly
  * Release notes for this change

DocImpact
UpgradeImpact

Co-Authored-By: Mike Fedosin <mfedosin@mirantis.com>
Co-Authored-By: Nikhil Komawar <nik.komawar@gmail.com>

Implements blueprint deprecate-glance-v1-api

Change-Id: Iab0c4abaea247044fee545342ac450e3415432f7
This commit is contained in:
Mike Fedosin 2016-06-10 20:00:23 +03:00 committed by Nikhil Komawar
parent 237e97f7b5
commit 63e6dbb1eb
5 changed files with 81 additions and 17 deletions

View File

@ -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

View File

@ -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.

View File

@ -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'}],
},
]}

View File

@ -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/'}],
},

View File

@ -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.