]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Mark XML API as deprecated in Mitaka.
authorIvan Kolodyazhny <e0ne@e0ne.info>
Wed, 14 Oct 2015 17:33:08 +0000 (20:33 +0300)
committerIvan Kolodyazhny <e0ne@e0ne.info>
Wed, 14 Oct 2015 18:57:36 +0000 (18:57 +0000)
Cinder XML API is untested and will be removed in the N release.

Implements: blueprint deprecate-xml-api
Change-Id: I753dedadf99bbb8e49d0076aa0da4ffa4ff97a4b

cinder/api/openstack/wsgi.py

index f2b3215bb43b5670290aa64ef5e36963d31f335b..f490471737b6eb839e5a782e0262add50c3cd130 100644 (file)
@@ -22,6 +22,7 @@ from xml.parsers import expat
 
 from lxml import etree
 from oslo_log import log as logging
+from oslo_log import versionutils
 from oslo_serialization import jsonutils
 from oslo_utils import excutils
 import six
@@ -37,6 +38,7 @@ from cinder.wsgi import common as wsgi
 XML_NS_V1 = 'http://docs.openstack.org/api/openstack-block-storage/1.0/content'
 XML_NS_V2 = 'http://docs.openstack.org/api/openstack-block-storage/2.0/content'
 XML_NS_ATOM = 'http://www.w3.org/2005/Atom'
+XML_WARNING = False
 
 LOG = logging.getLogger(__name__)
 
@@ -1339,6 +1341,14 @@ class Fault(webob.exc.HTTPException):
             'application/json': JSONDictSerializer(),
         }[content_type]
 
+        if content_type == 'application/xml':
+            global XML_WARNING
+            if not XML_WARNING:
+                msg = _('XML support has been deprecated and will be removed '
+                        'in the N release.')
+                versionutils.report_deprecated_feature(LOG, msg)
+            XML_WARNING = True
+
         body = serializer.serialize(fault_data)
         if isinstance(body, six.text_type):
             body = body.encode('utf-8')