From 556ae86d382bc4bf9a4272884dd1f8ed5f694b4e Mon Sep 17 00:00:00 2001 From: Xing Yang Date: Sun, 10 Dec 2017 09:23:18 -0800 Subject: [PATCH] Deprecate CG APIs This patch prints a deprecation message when CG APIs are used and prompts users to swich to Generic Volume Group APIs instead. CG APIs are also marked as deprecated in API reference docs. CG APIs will be removed in a future release when it is appropriate and will be decided by the Cinder team. This was communicated in Pike. Change-Id: Ib6751fae6b5fb78de98a2ea62f507f9102f71b76 --- api-ref/source/v3/consistencygroups-v3.inc | 4 ++-- api-ref/source/v3/os-cgsnapshots-v3.inc | 4 ++-- cinder/api/contrib/cgsnapshots.py | 8 ++++++++ cinder/api/contrib/consistencygroups.py | 10 ++++++++++ ...recate-consistency-group-apis-0d9120d16f090781.yaml | 6 ++++++ 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/deprecate-consistency-group-apis-0d9120d16f090781.yaml diff --git a/api-ref/source/v3/consistencygroups-v3.inc b/api-ref/source/v3/consistencygroups-v3.inc index e05b1253de1..ca1ca892079 100644 --- a/api-ref/source/v3/consistencygroups-v3.inc +++ b/api-ref/source/v3/consistencygroups-v3.inc @@ -1,7 +1,7 @@ .. -*- rst -*- -Consistency groups -================== +Consistency groups (DEPRECATED) +=============================== Consistency groups enable you to create snapshots at the exact same point in time from multiple volumes. For example, a database might diff --git a/api-ref/source/v3/os-cgsnapshots-v3.inc b/api-ref/source/v3/os-cgsnapshots-v3.inc index 36fa77512c7..c1fe6c6727c 100644 --- a/api-ref/source/v3/os-cgsnapshots-v3.inc +++ b/api-ref/source/v3/os-cgsnapshots-v3.inc @@ -1,7 +1,7 @@ .. -*- rst -*- -Consistency group snapshots -=========================== +Consistency group snapshots (DEPRECATED) +======================================== Lists all, lists all with details, shows details for, creates, and deletes consistency group snapshots. diff --git a/cinder/api/contrib/cgsnapshots.py b/cinder/api/contrib/cgsnapshots.py index 02b37a07de4..5eba06de689 100644 --- a/cinder/api/contrib/cgsnapshots.py +++ b/cinder/api/contrib/cgsnapshots.py @@ -16,6 +16,7 @@ """The cgsnapshots api.""" from oslo_log import log as logging +from oslo_log import versionutils import six from six.moves import http_client import webob @@ -30,6 +31,8 @@ from cinder import group as group_api from cinder.i18n import _ LOG = logging.getLogger(__name__) +DEPRECATE_CGSNAP_API_MSG = ("Consistency Group Snapshot APIs are deprecated. " + "Use Generic Volume Group Snapshot APIs instead.") class CgsnapshotsController(wsgi.Controller): @@ -43,6 +46,7 @@ class CgsnapshotsController(wsgi.Controller): def show(self, req, id): """Return data about the given cgsnapshot.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG) LOG.debug('show called for member %s', id) context = req.environ['cinder.context'] @@ -53,6 +57,7 @@ class CgsnapshotsController(wsgi.Controller): def delete(self, req, id): """Delete a cgsnapshot.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG) LOG.debug('delete called for member %s', id) context = req.environ['cinder.context'] @@ -74,10 +79,12 @@ class CgsnapshotsController(wsgi.Controller): def index(self, req): """Returns a summary list of cgsnapshots.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG) return self._get_cgsnapshots(req, is_detail=False) def detail(self, req): """Returns a detailed list of cgsnapshots.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG) return self._get_cgsnapshots(req, is_detail=True) def _get_cg(self, context, id): @@ -112,6 +119,7 @@ class CgsnapshotsController(wsgi.Controller): @wsgi.response(http_client.ACCEPTED) def create(self, req, body): """Create a new cgsnapshot.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG) LOG.debug('Creating new cgsnapshot %s', body) self.assert_valid_body(body, 'cgsnapshot') diff --git a/cinder/api/contrib/consistencygroups.py b/cinder/api/contrib/consistencygroups.py index 02be5fac3c9..6f313c67400 100644 --- a/cinder/api/contrib/consistencygroups.py +++ b/cinder/api/contrib/consistencygroups.py @@ -16,6 +16,7 @@ """The consistencygroups api.""" from oslo_log import log as logging +from oslo_log import versionutils from oslo_utils import strutils from six.moves import http_client import webob @@ -33,6 +34,8 @@ from cinder.policies import groups as group_policy from cinder.volume import group_types LOG = logging.getLogger(__name__) +DEPRECATE_CG_API_MSG = ("Consistency Group APIs are deprecated. " + "Use Generic Volume Group APIs instead.") class ConsistencyGroupsController(wsgi.Controller): @@ -46,6 +49,7 @@ class ConsistencyGroupsController(wsgi.Controller): def show(self, req, id): """Return data about the given consistency group.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) LOG.debug('show called for member %s', id) context = req.environ['cinder.context'] @@ -56,6 +60,7 @@ class ConsistencyGroupsController(wsgi.Controller): def delete(self, req, id, body): """Delete a consistency group.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) LOG.debug('delete called for member %s', id) context = req.environ['cinder.context'] force = False @@ -84,10 +89,12 @@ class ConsistencyGroupsController(wsgi.Controller): def index(self, req): """Returns a summary list of consistency groups.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) return self._get_consistencygroups(req, is_detail=False) def detail(self, req): """Returns a detailed list of consistency groups.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) return self._get_consistencygroups(req, is_detail=True) def _get(self, context, id): @@ -129,6 +136,7 @@ class ConsistencyGroupsController(wsgi.Controller): @wsgi.response(http_client.ACCEPTED) def create(self, req, body): """Create a new consistency group.""" + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) LOG.debug('Creating new consistency group %s', body) self.assert_valid_body(body, 'consistencygroup') @@ -179,6 +187,7 @@ class ConsistencyGroupsController(wsgi.Controller): this does not require volume_types as the "create" API above. """ + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) LOG.debug('Creating new consistency group %s.', body) self.assert_valid_body(body, 'consistencygroup-from-src') @@ -267,6 +276,7 @@ class ConsistencyGroupsController(wsgi.Controller): } """ + versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG) LOG.debug('Update called for consistency group %s.', id) if not body: msg = _("Missing request body.") diff --git a/releasenotes/notes/deprecate-consistency-group-apis-0d9120d16f090781.yaml b/releasenotes/notes/deprecate-consistency-group-apis-0d9120d16f090781.yaml new file mode 100644 index 00000000000..fe0c6c0216a --- /dev/null +++ b/releasenotes/notes/deprecate-consistency-group-apis-0d9120d16f090781.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The Consistency Group APIs have now been marked as deprecated and + will be removed in a future release. Generic Volume Group APIs should + be used instead.