From 85e9e0622c96a3d2e0237e7a7bf089a1343ef545 Mon Sep 17 00:00:00 2001 From: Eric Windisch Date: Mon, 18 Mar 2013 22:07:02 -0400 Subject: Eliminate multiple contexts in zmq call() Because we need compatibility with Grizzly (N-1 support), this should be reduced to two copies for Havana, before stripping down to a singular copy for I. The '-reply' request has its context key removed, with the msg option maintaining one extra copy of context until I. A TODO has been entered to clean this up following the Havana release. This fix eliminates an extra JSON double-deserialization routine. The double-serialization of context is still performed for Grizzly compatibility. fixes bug 1156956 Change-Id: I071e382ec9c7e0df3794fe9ca574a5722f8910a6 --- openstack/common/rpc/impl_zmq.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'openstack') diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py index 87f8d21..30958e9 100644 --- a/openstack/common/rpc/impl_zmq.py +++ b/openstack/common/rpc/impl_zmq.py @@ -295,11 +295,16 @@ class InternalContext(object): def reply(self, ctx, proxy, msg_id=None, context=None, topic=None, msg=None): """Reply to a casted call.""" - # Our real method is curried into msg['args'] + # NOTE(ewindisch): context kwarg exists for Grizzly compat. + # this may be able to be removed earlier than + # 'I' if ConsumerBase.process were refactored. + if type(msg) is list: + payload = msg[-1] + else: + payload = msg - child_ctx = RpcContext.unmarshal(msg[0]) response = ConsumerBase.normalize_reply( - self._get_response(child_ctx, proxy, topic, msg[1]), + self._get_response(ctx, proxy, topic, payload), ctx.replies) LOG.debug(_("Sending reply")) @@ -685,8 +690,8 @@ def _call(addr, context, topic, msg, timeout=None, 'method': '-reply', 'args': { 'msg_id': msg_id, - 'context': mcontext, 'topic': reply_topic, + # TODO(ewindisch): safe to remove mcontext in I. 'msg': [mcontext, msg] } } -- cgit