flavor extra spec api fails with XML content type if key contains a colon
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Low
|
GuoHui Liu | ||
Havana |
Fix Released
|
Low
|
Xu Han Peng | ||
tempest |
Invalid
|
Undecided
|
Unassigned |
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]
{"extra_specs": {"foo:bar": "999"}}
curl -i [endpoint]
{"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.
2013-08-19 13:08:14.377 27521 ERROR nova.api.openstack [req-afe0c3c8-
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/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return req.get_
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack application, catch_exc_
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack app_iter = application(
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
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/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return super(CsAuthPro
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
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/
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/
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/
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/
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/
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/
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/
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/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack self.default_
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack response.body = serializer.
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
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/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack return self._serialize
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack self._serialize
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elems = siblings[
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elems.append(
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "/usr/lib/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack elem = etree.Element(
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "lxml.etree.pyx", line 2568, in lxml.etree.Element (src/lxml/
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "apihelpers.pxi", line 126, in lxml.etree.
2013-08-19 13:08:14.377 27521 TRACE nova.api.openstack File "apihelpers.pxi", line 1542, in lxml.etree.
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 ComputeCapabili
Changed in nova: | |
assignee: | nobody → GuoHui LIu (guohliu) |
tags: | added: api |
tags: | added: havana-backport-potential |
Changed in nova: | |
milestone: | none → icehouse-1 |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
importance: | Undecided → Low |
tags: | removed: havana-backport-potential in-stable-havana |
Changed in nova: | |
milestone: | icehouse-1 → 2014.1 |
Hi Andrea,
I cannot reproduce this issue with your steps.
REQ: curl -i http:// 192.168. 0.106:8774/ v2/33d982fa68a4 4289af94978544e b790d/flavors/ 1/os-extra_ specs -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 14126dcd29474f6 9b6283a563f5d06 96" -d '{"extra_specs": {"foo:bar": "100"}}'
RESP: [200] CaseInsensitive Dict({' date': 'Mon, 19 Aug 2013 14:26:35 GMT', 'content-length': '35', 'content-type': 'application/json', 'x-compute- request- id': 'req-e4837622- 40a9-4330- 9720-f05618448d ed'})
RESP BODY: {"extra_specs": {"foo:bar": "100"}}
root@jake1:~# nova flavor-show 1 ------- ------- ------- -+----- ------- ------- ---+ ------- ------- ------- -+----- ------- ------- ---+ DISABLED: disabled | False | access: is_public | True | EXT-DATA: ephemeral | 0 | ------- ------- ------- -+----- ------- ------- ---+
+------
| Property | Value |
+------
| name | m1.tiny |
| ram | 512 |
| OS-FLV-
| vcpus | 1 |
| extra_specs | {u'foo:bar': u'100'} |
| swap | |
| os-flavor-
| rxtx_factor | 1.0 |
| OS-FLV-
| disk | 1 |
| id | 1 |
+------
Which version are you using? I was using devstack from latest code. Thanks.