yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #06967
[Bug 1213927] Re: flavor extra spec api fails with XML content type if key contains a colon
** Also affects: nova/havana
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1213927
Title:
flavor extra spec api fails with XML content type if key contains a
colon
Status in OpenStack Compute (Nova):
Fix Released
Status in OpenStack Compute (nova) havana series:
Fix Committed
Status in Tempest:
Invalid
Bug description:
The flavor extra spec API extension (os-extra_specs) fails with "HTTP
500" when content-type application/xml is requested if the extra spec
key contains a colon.
For example:
curl [endpoint]/flavors/[ID]/os-extra_specs -H "Accept: application/json" -H "X-Auth-Token: $TOKEN"
{"extra_specs": {"foo:bar": "999"}}
curl -i [endpoint]/flavors/[ID]/os-extra_specs -H "Accept: application/xml" -H "X-Auth-Token: $TOKEN"
{"extra_specs": {"foo:bar": "999"}}
HTTP/1.1 500 Internal Server Error
The stack trace shows that the XML parser tries to interpret the ":"
in key as if it would be a XML namespace, which fails, as the
namespace is not valid:
2013-08-19 13:08:14.374 27521 DEBUG nova.api.openstack.wsgi [req-afe0c3c8-e7d6-48c5-84f1-782260850e6b redacted redacted] Calling method <bound method FlavorExtraSpecsController.index of <nova.api.openstack.compute.contrib.flavorextraspecs.FlavorExtraSpecsController object at 0x2c01b90>> _process_stack /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:927
2013-08-19 13:08:14.377 27521 ERROR nova.api.openstack [req-afe0c3c8-e7d6-48c5-84f1-782260850e6b redacted redacted] Caught error: Invalid tag name u'foo:bar'
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack Traceback (most recent call last):
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py", line 110, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return req.get_response(self.application)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack application, catch_exc_info=False)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return resp(environ, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/hp/middleware/cs_auth_token.py", line 160, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return super(CsAuthProtocol, self).__call__(env, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 461, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return self.app(env, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return resp(environ, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return resp(environ, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return resp(environ, start_response)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 903, in __call__
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack content_type, body, accept)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 992, in _process_stack
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack self.default_serializers)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 603, in serialize
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack response.body = serializer.serialize(self.obj)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/xmlutil.py", line 590, in serialize
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elem = self.make_tree(obj)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/xmlutil.py", line 618, in make_tree
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return self._serialize(None, obj, siblings, nsmap)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/xmlutil.py", line 573, in _serialize
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack self._serialize(elem, datum, nieces)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/xmlutil.py", line 554, in _serialize
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elems = siblings[0].render(parent, obj, siblings[1:], nsmap)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/xmlutil.py", line 426, in render
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elems.append((self._render(parent, datum, patches, nsmap), datum))
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/xmlutil.py", line 369, in _render
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elem = etree.Element(tagname, nsmap=nsmap)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "lxml.etree.pyx", line 2568, in lxml.etree.Element (src/lxml/lxml.etree.c:52878)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "apihelpers.pxi", line 126, in lxml.etree._makeElement (src/lxml/lxml.etree.c:11497)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "apihelpers.pxi", line 1542, in lxml.etree._tagValidOrRaise (src/lxml/lxml.etree.c:23956)
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack ValueError: Invalid tag name u'foo:bar'
The issue affects tempest as well, as the test for this does not setup
the extra spec using a colon in it, which is what the
ComputeCapabilitiesFilter in the scheduler expects.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1213927/+subscriptions