From: Gary Kotton Date: Tue, 24 Jul 2012 06:28:56 +0000 (-0400) Subject: Update openstack-common files. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f43b1cede93bca9acfa493c7f3c83ff5ab961587;p=openstack-build%2Fneutron-build.git Update openstack-common files. The RPC support requires that the fanout_cast messages enable the application to set the topic. This was fixed in https://review.openstack.org/#/c/10125/. In addition to this the jsonutils.py was updated. Change-Id: I85b5a3a74f129746528910d12acdd00db39d8626 --- diff --git a/quantum/openstack/common/jsonutils.py b/quantum/openstack/common/jsonutils.py index c78d5f0ae..9324a61fa 100644 --- a/quantum/openstack/common/jsonutils.py +++ b/quantum/openstack/common/jsonutils.py @@ -107,9 +107,11 @@ def to_primitive(value, convert_instances=False, level=0): elif hasattr(value, 'iteritems'): return to_primitive(dict(value.iteritems()), convert_instances=convert_instances, - level=level) + level=level + 1) elif hasattr(value, '__iter__'): - return to_primitive(list(value), level) + return to_primitive(list(value), + convert_instances=convert_instances, + level=level) elif convert_instances and hasattr(value, '__dict__'): # Likely an instance of something. Watch for cycles. # Ignore class member vars. diff --git a/quantum/openstack/common/rpc/proxy.py b/quantum/openstack/common/rpc/proxy.py index abcf800bf..f1cf6354e 100644 --- a/quantum/openstack/common/rpc/proxy.py +++ b/quantum/openstack/common/rpc/proxy.py @@ -112,11 +112,12 @@ class RpcProxy(object): self._set_version(msg, version) rpc.cast(context, self._get_topic(topic), msg) - def fanout_cast(self, context, msg, version=None): + def fanout_cast(self, context, msg, topic=None, version=None): """rpc.fanout_cast() a remote method. :param context: The request context :param msg: The message to send, including the method and args. + :param topic: Override the topic for this message. :param version: (Optional) Override the requested API version in this message. @@ -124,7 +125,7 @@ class RpcProxy(object): from the remote method. """ self._set_version(msg, version) - rpc.fanout_cast(context, self.topic, msg) + rpc.fanout_cast(context, self._get_topic(topic), msg) def cast_to_server(self, context, server_params, msg, topic=None, version=None): @@ -144,13 +145,15 @@ class RpcProxy(object): self._set_version(msg, version) rpc.cast_to_server(context, server_params, self._get_topic(topic), msg) - def fanout_cast_to_server(self, context, server_params, msg, version=None): + def fanout_cast_to_server(self, context, server_params, msg, topic=None, + version=None): """rpc.fanout_cast_to_server() a remote method. :param context: The request context :param server_params: Server parameters. See rpc.cast_to_server() for details. :param msg: The message to send, including the method and args. + :param topic: Override the topic for this message. :param version: (Optional) Override the requested API version in this message. @@ -158,4 +161,5 @@ class RpcProxy(object): return values. """ self._set_version(msg, version) - rpc.fanout_cast_to_server(context, server_params, self.topic, msg) + rpc.fanout_cast_to_server(context, server_params, + self._get_topic(topic), msg)