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
This commit is contained in:
Xing Yang 2017-12-10 09:23:18 -08:00 committed by xing-yang
parent 7bbc95344d
commit 556ae86d38
5 changed files with 28 additions and 4 deletions

View File

@ -1,7 +1,7 @@
.. -*- rst -*- .. -*- rst -*-
Consistency groups Consistency groups (DEPRECATED)
================== ===============================
Consistency groups enable you to create snapshots at the exact same Consistency groups enable you to create snapshots at the exact same
point in time from multiple volumes. For example, a database might point in time from multiple volumes. For example, a database might

View File

@ -1,7 +1,7 @@
.. -*- rst -*- .. -*- rst -*-
Consistency group snapshots Consistency group snapshots (DEPRECATED)
=========================== ========================================
Lists all, lists all with details, shows details for, creates, and Lists all, lists all with details, shows details for, creates, and
deletes consistency group snapshots. deletes consistency group snapshots.

View File

@ -16,6 +16,7 @@
"""The cgsnapshots api.""" """The cgsnapshots api."""
from oslo_log import log as logging from oslo_log import log as logging
from oslo_log import versionutils
import six import six
from six.moves import http_client from six.moves import http_client
import webob import webob
@ -30,6 +31,8 @@ from cinder import group as group_api
from cinder.i18n import _ from cinder.i18n import _
LOG = logging.getLogger(__name__) 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): class CgsnapshotsController(wsgi.Controller):
@ -43,6 +46,7 @@ class CgsnapshotsController(wsgi.Controller):
def show(self, req, id): def show(self, req, id):
"""Return data about the given cgsnapshot.""" """Return data about the given cgsnapshot."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG)
LOG.debug('show called for member %s', id) LOG.debug('show called for member %s', id)
context = req.environ['cinder.context'] context = req.environ['cinder.context']
@ -53,6 +57,7 @@ class CgsnapshotsController(wsgi.Controller):
def delete(self, req, id): def delete(self, req, id):
"""Delete a cgsnapshot.""" """Delete a cgsnapshot."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG)
LOG.debug('delete called for member %s', id) LOG.debug('delete called for member %s', id)
context = req.environ['cinder.context'] context = req.environ['cinder.context']
@ -74,10 +79,12 @@ class CgsnapshotsController(wsgi.Controller):
def index(self, req): def index(self, req):
"""Returns a summary list of cgsnapshots.""" """Returns a summary list of cgsnapshots."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG)
return self._get_cgsnapshots(req, is_detail=False) return self._get_cgsnapshots(req, is_detail=False)
def detail(self, req): def detail(self, req):
"""Returns a detailed list of cgsnapshots.""" """Returns a detailed list of cgsnapshots."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG)
return self._get_cgsnapshots(req, is_detail=True) return self._get_cgsnapshots(req, is_detail=True)
def _get_cg(self, context, id): def _get_cg(self, context, id):
@ -112,6 +119,7 @@ class CgsnapshotsController(wsgi.Controller):
@wsgi.response(http_client.ACCEPTED) @wsgi.response(http_client.ACCEPTED)
def create(self, req, body): def create(self, req, body):
"""Create a new cgsnapshot.""" """Create a new cgsnapshot."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CGSNAP_API_MSG)
LOG.debug('Creating new cgsnapshot %s', body) LOG.debug('Creating new cgsnapshot %s', body)
self.assert_valid_body(body, 'cgsnapshot') self.assert_valid_body(body, 'cgsnapshot')

View File

@ -16,6 +16,7 @@
"""The consistencygroups api.""" """The consistencygroups api."""
from oslo_log import log as logging from oslo_log import log as logging
from oslo_log import versionutils
from oslo_utils import strutils from oslo_utils import strutils
from six.moves import http_client from six.moves import http_client
import webob import webob
@ -33,6 +34,8 @@ from cinder.policies import groups as group_policy
from cinder.volume import group_types from cinder.volume import group_types
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
DEPRECATE_CG_API_MSG = ("Consistency Group APIs are deprecated. "
"Use Generic Volume Group APIs instead.")
class ConsistencyGroupsController(wsgi.Controller): class ConsistencyGroupsController(wsgi.Controller):
@ -46,6 +49,7 @@ class ConsistencyGroupsController(wsgi.Controller):
def show(self, req, id): def show(self, req, id):
"""Return data about the given consistency group.""" """Return data about the given consistency group."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
LOG.debug('show called for member %s', id) LOG.debug('show called for member %s', id)
context = req.environ['cinder.context'] context = req.environ['cinder.context']
@ -56,6 +60,7 @@ class ConsistencyGroupsController(wsgi.Controller):
def delete(self, req, id, body): def delete(self, req, id, body):
"""Delete a consistency group.""" """Delete a consistency group."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
LOG.debug('delete called for member %s', id) LOG.debug('delete called for member %s', id)
context = req.environ['cinder.context'] context = req.environ['cinder.context']
force = False force = False
@ -84,10 +89,12 @@ class ConsistencyGroupsController(wsgi.Controller):
def index(self, req): def index(self, req):
"""Returns a summary list of consistency groups.""" """Returns a summary list of consistency groups."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
return self._get_consistencygroups(req, is_detail=False) return self._get_consistencygroups(req, is_detail=False)
def detail(self, req): def detail(self, req):
"""Returns a detailed list of consistency groups.""" """Returns a detailed list of consistency groups."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
return self._get_consistencygroups(req, is_detail=True) return self._get_consistencygroups(req, is_detail=True)
def _get(self, context, id): def _get(self, context, id):
@ -129,6 +136,7 @@ class ConsistencyGroupsController(wsgi.Controller):
@wsgi.response(http_client.ACCEPTED) @wsgi.response(http_client.ACCEPTED)
def create(self, req, body): def create(self, req, body):
"""Create a new consistency group.""" """Create a new consistency group."""
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
LOG.debug('Creating new consistency group %s', body) LOG.debug('Creating new consistency group %s', body)
self.assert_valid_body(body, 'consistencygroup') self.assert_valid_body(body, 'consistencygroup')
@ -179,6 +187,7 @@ class ConsistencyGroupsController(wsgi.Controller):
this does not require volume_types as the "create" this does not require volume_types as the "create"
API above. API above.
""" """
versionutils.report_deprecated_feature(LOG, DEPRECATE_CG_API_MSG)
LOG.debug('Creating new consistency group %s.', body) LOG.debug('Creating new consistency group %s.', body)
self.assert_valid_body(body, 'consistencygroup-from-src') 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) LOG.debug('Update called for consistency group %s.', id)
if not body: if not body:
msg = _("Missing request body.") msg = _("Missing request body.")

View File

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