servers.list, filtering on metadata doesn't work. unicode error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Christopher Yeoh |
Bug Description
I'm trying to list servers by filtering on system_metadata or metadata.
I should be able to do something like (looking into the code)
nclient.
But this dictionary gets turned into a unicode string. I get a 500 back from nova with the below stack trace in nova-api.
The offending code is in exact_filter in the db api. It is expecting a list of dicts or a single dict when using system_metadata or metadata key when searching. It looks like this used to work but now somewhere higher up is ensuring this is a string.
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack Traceback (most recent call last):
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return req.get_
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack application, catch_exc_
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack app_iter = application(
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return resp(environ, start_response)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return self.app(env, start_response)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return resp(environ, start_response)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return resp(environ, start_response)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/local/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack response = self.app(environ, start_response)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return resp(environ, start_response)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/usr/lib/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack content_type, body, accept)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return method(req=request, **action_args)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack servers = self._get_
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack want_objects=True)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack expected_
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack limit=limit, marker=marker, expected_
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack result = fn(cls, context, *args, **kwargs)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack use_slave=
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack use_slave=
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack return f(*args, **kwargs)
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack filters, exact_match_
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack File "/opt/nova/
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack for k, v in value.iteritems():
2014-09-22 11:31:28.916 20196 TRACE nova.api.openstack AttributeError: 'unicode' object has no attribute 'iteritems'
Changed in nova: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
assignee: | nobody → Christopher Yeoh (cyeoh-0) |
Changed in nova: | |
milestone: | none → juno-rc1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | juno-rc1 → 2014.2 |
The conversion to unicode occurs during the request to the Nova API as the filter needs to be converted to url parameter request. Nova however does not convert it back to a dict. Need to fix this in compute/api.py