Mark XML as deprecated in the v2 API

Log a warning the first time a server gets encoded as XML.
I didn't see an immediately obvious place to put this warning,
but anyone actually using XML will hit this code path, so it
seems fine to me.

Implements blueprint deprecate-xml-in-v2-api

DocImpact

Change-Id: I4acc15ce5f487738bb34a95c2261a5d05d827d8d
This commit is contained in:
Russell Bryant
2014-02-21 10:45:47 -05:00
parent 9e14b57573
commit 9f678b6c90

View File

@@ -59,6 +59,8 @@ CONF.import_opt('reclaim_instance_interval', 'nova.compute.manager')
LOG = logging.getLogger(__name__)
XML_WARNING = False
def make_fault(elem):
fault = xmlutil.SubTemplateElement(elem, 'fault', selector='fault')
@@ -74,6 +76,12 @@ def make_server(elem, detailed=False):
elem.set('name')
elem.set('id')
global XML_WARNING
if not XML_WARNING:
LOG.warning(_('XML support has been deprecated and will be removed '
'in the Juno release.'))
XML_WARNING = True
if detailed:
elem.set('userId', 'user_id')
elem.set('tenantId', 'tenant_id')