diff options
author | Eric Windisch <eric@cloudscaling.com> | 2013-03-18 22:07:02 -0400 |
---|---|---|
committer | Eric Windisch <eric@cloudscaling.com> | 2013-03-20 02:09:15 -0400 |
commit | 85e9e0622c96a3d2e0237e7a7bf089a1343ef545 (patch) | |
tree | a578c55cc18a84c44c8778f6de2dcdf405f99b87 /openstack/common/rpc | |
parent | 65e3d8c9773880094c0a4c164e046fae9cb7a5d9 (diff) | |
download | oslo-85e9e0622c96a3d2e0237e7a7bf089a1343ef545.tar.gz oslo-85e9e0622c96a3d2e0237e7a7bf089a1343ef545.tar.xz oslo-85e9e0622c96a3d2e0237e7a7bf089a1343ef545.zip |
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
Diffstat (limited to 'openstack/common/rpc')
-rw-r--r-- | openstack/common/rpc/impl_zmq.py | 13 |
1 files changed, 9 insertions, 4 deletions
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] } } |