← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1223358] Re: XML serialization fails when it's trying to serialize an empty selector

 

** Changed in: nova
       Status: Fix Committed => Fix Released

-- 
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/1223358

Title:
  XML serialization fails when it's trying to serialize an empty
  selector

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  The XML serilaziation is failing when it's trying to create a datum selector with no values.
  It's possible to use devstack to reproduce this issue following these steps:
  - boot an instance from volume without specifying an image id:
   nova boot --flavor 1 --block-device-mapping vda=<VOL_ID> inst1
  - perform a GET servers for the instance created in the previous step requiring the results in XML:
  curl -i http://10.0.0.5:8774/v2/<Tenant_id>/servers/<inst1_uuid> -X GET
  -H "X-Auth-Project-Id: admin" -H "Accept: application/xml" -H "X-Auth-Token: <TOKEN>"
  The response is a 500 error:
  HTTP/1.1 500 Internal Server Error
  Content-Length: 192
  Content-Type: application/xml; charset=UTF-8
  X-Compute-Request-Id: req-5f69cdc2-7b10-4832-89e6-9500601d3ec7
  Date: Tue, 10 Sep 2013 13:43:30 GMT

  <computeFault code="500"
  xmlns="http://docs.openstack.org/compute/api/v1.1";><message>The server
  has either erred or is incapable of performing the requested
  operation.</message></computeFault>

  And in the compute log you can find details of the exception:

  2013-09-10 13:43:30.729 ERROR nova.api.openstack [req-5f69cdc2-7b10-4832-89e6-9500601d3ec7 admin admin] Caught error: string indices must be integers, not str
  2013-09-10 13:43:30.729 TRACE nova.api.openstack Traceback (most recent call last):
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/__init__.py", line 111, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return req.get_response(self.application)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     application, catch_exc_info=False)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     app_iter = application(self.environ, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return resp(environ, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 534, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return self.app(env, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return resp(environ, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return resp(environ, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     response = self.app(environ, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return resp(environ, start_response)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     resp = self.call_func(req, *args, **self.kwargs)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return self.func(req, *args, **kwargs)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 904, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     content_type, body, accept)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 993, in _process_stack
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     self.default_serializers)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 604, in serialize
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     response.body = serializer.serialize(self.obj)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 591, in serialize
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     elem = self.make_tree(obj)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 619, in make_tree
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     return self._serialize(None, obj, siblings, nsmap)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 574, in _serialize
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     self._serialize(elem, datum, nieces)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 555, in _serialize
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     elems = siblings[0].render(parent, obj, siblings[1:], nsmap)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 427, in render
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     elems.append((self._render(parent, datum, patches, nsmap), datum))
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 381, in _render
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     self.apply(elem, datum)
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 346, in apply
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     elem.set(key, unicode(value(obj, True)))
  2013-09-10 13:43:30.729 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/xmlutil.py", line 85, in __call__
  2013-09-10 13:43:30.729 TRACE nova.api.openstack     obj = obj[elem]
  2013-09-10 13:43:30.729 TRACE nova.api.openstack TypeError: string indices must be integers, not str

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1223358/+subscriptions