Cells service_get_by_compute_host fails on object conversion

Bug #1408122 reported by Andrew Laski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Andrew Laski

Bug Description

When pulling service information on a compute node with cells there is a failure to convert the compute node db dict into an object. This is due to the id field being of the form 'region!child@1' while the compute_node object id field is expected to be an int.

2015-01-06 17:17:07.365 ERROR nova.api.openstack [req-b8e62f38-a1b1-4d41-9502-484c706cba5c HostsAdminTestJSON-320709791 HostsAdminTestJSON-164089223] Caught error: invalid literal for int() with base 10: 'region!child@1'
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack Traceback (most recent call last):
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 125, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return req.get_response(self.application)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack application, catch_exc_info=False)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return resp(environ, start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token.py", line 823, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return self._call_app(env, start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token.py", line 758, in _call_app
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return self._app(env, _fake_start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return resp(environ, start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return resp(environ, start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack response = self.app(environ, start_response)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return resp(environ, start_response)2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 752, in __call__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack content_type, body, accept)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 817, in _process_stack
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 907, in dispatch
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return method(req=request, **action_args)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/hosts.py", line 272, in show
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack service = self.api.service_get_by_compute_host(context, host_name)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/cells_api.py", line 570, in service_get_by_compute_host
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack db_service)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/service.py", line 77, in _from_db_object
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack service._do_compute_node(context, service, db_service)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/service.py", line 68, in _do_compute_node
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack context, objects.ComputeNode(), db_compute)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/compute_node.py", line 130, in _from_db_object
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack compute[key] = db_compute[key]
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/base.py", line 598, in __setitem__
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack setattr(self, name, value)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/base.py", line 76, in setter
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack field_value = field.coerce(self, name, value)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/fields.py", line 189, in coerce
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return self._type.coerce(obj, attr, value)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack File "/opt/stack/nova/nova/objects/fields.py", line 264, in coerce
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack return int(value)
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack ValueError: invalid literal for int() with base 10: 'region!child@1'
2015-01-06 17:17:07.365 21844 TRACE nova.api.openstack

Andrew Laski (alaski)
Changed in nova:
assignee: nobody → Andrew Laski (alaski)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/145362

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/145362
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=19c2b3e966f32b9351e86dc34eac6e8fdc88b29a
Submitter: Jenkins
Branch: master

commit 19c2b3e966f32b9351e86dc34eac6e8fdc88b29a
Author: Andrew Laski <email address hidden>
Date: Tue Jan 6 17:12:45 2015 -0500

    Cells: Fix service_get_by_compute_host

    Compute_node objects require that the 'id' field be an int, but with
    cells the 'id' is a string with routing information. So conversion of
    the dict returned via RPC from a child cell fails.

    This patch adds a proxy object to keep the routing information visible
    via the API without changing the underlying object model.

    Change-Id: I71ab82841983798105237804d20bd41c04acfc7b
    Closes-bug: #1408122

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-2 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.