← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1205983] Re: capabilities filter uses ':' as a delimiter, which is unsupported by REST XML

 

** Changed in: cinder
       Status: In Progress => 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/1205983

Title:
  capabilities filter uses ':' as a delimiter, which is unsupported by
  REST XML

Status in Cinder:
  Fix Released
Status in OpenStack Compute (Nova):
  In Progress

Bug description:
  In  cinder.capabilities_filter, we uses a ":" as a delimiter.  It
  would causes a problem when attempting to convert the capability in an
  extra-spec to a REST  XML object.

  When we create one volume-type with extra_specs via REST or list all
  of volume-type as below:

  POST /types
  request body :{"volume_type": {"extra_specs": {"vendor_name": "Open Source", "capabilities:volume_backend_name":"iSCSI"}, "name": "volume-type-001"}}

  it will throw the following error:

  07-10 17:19 cinder.api.middleware.fault ERROR    Caught error: Invalid tag name u'capabilities:volume_backend_name'
  Traceback (most recent call last):
    File "/usr/lib/python2.6/site-packages/cinder/api/middleware/fault.py", line 76, in __call__
      return req.get_response(self.application)
    File "/usr/lib/python2.6/site-packages/webob/request.py", line 1296, in send
      application, catch_exc_info=False)
    File "/usr/lib/python2.6/site-packages/webob/request.py", line 1260, in call_application
      app_iter = application(self.environ, start_response)
    File "/usr/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.6/site-packages/keystoneclient/middleware/auth_token.py", line 451, in __call__
      return self.app(env, start_response)
    File "/usr/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.6/site-packages/routes/middleware.py", line 131, in __call__
      response = self.app(environ, start_response)
    File "/usr/lib/python2.6/site-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.6/site-packages/webob/dec.py", line 130, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/lib/python2.6/site-packages/webob/dec.py", line 195, in call_func
      return self.func(req, *args, **kwargs)
    File "/usr/lib/python2.6/site-packages/cinder/api/openstack/wsgi.py", line 831, in __call__
      content_type, body, accept)
    File "/usr/lib/python2.6/site-packages/cinder/api/openstack/wsgi.py", line 916, in _process_stack
      self.default_serializers)
    File "/usr/lib/python2.6/site-packages/cinder/api/openstack/wsgi.py", line 525, in serialize
      response.body = serializer.serialize(self.obj)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 591, in serialize
      elem = self.make_tree(obj)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 619, in make_tree
      return self._serialize(None, obj, siblings, nsmap)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 574, in _serialize
      self._serialize(elem, datum, nieces)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 574, in _serialize
      self._serialize(elem, datum, nieces)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 574, in _serialize
      self._serialize(elem, datum, nieces)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 555, in _serialize
      elems = siblings[0].render(parent, obj, siblings[1:], nsmap)
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 427, in render
      elems.append((self._render(parent, datum, patches, nsmap), datum))
    File "/usr/lib/python2.6/site-packages/cinder/api/xmlutil.py", line 370, in _render
      elem = etree.Element(tagname, nsmap=nsmap)
    File "lxml.etree.pyx", line 2346, in lxml.etree.Element (src/lxml/lxml.etree.c:46617)
    File "apihelpers.pxi", line 113, in lxml.etree._makeElement (src/lxml/lxml.etree.c:10475)
    File "apihelpers.pxi", line 1405, in lxml.etree._tagValidOrRaise (src/lxml/lxml.etree.c:21541)
  ValueError: Invalid tag name u'capabilities:volume_backend_name'

  The root cause is: etree.Element can not parse "xx:xx" strings, such
  as "capabilities:volume_backend_name".

  From capabilities_filter.py, if we change the filter ":" to ".", as
  follow:

  scope = key.split(':') --> scope = key.split('.'), we can avoid  this
  issue, also not impact the filter.

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