diff --git a/neutron/common/rpc.py b/neutron/common/rpc.py index 98d468140..827919c00 100644 --- a/neutron/common/rpc.py +++ b/neutron/common/rpc.py @@ -54,7 +54,8 @@ def init(conf): TRANSPORT = messaging.get_transport(conf, allowed_remote_exmods=exmods, aliases=TRANSPORT_ALIASES) - NOTIFIER = messaging.Notifier(TRANSPORT) + serializer = RequestContextSerializer() + NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer) def cleanup(): @@ -79,7 +80,7 @@ def get_allowed_exmods(): def get_client(target, version_cap=None, serializer=None): assert TRANSPORT is not None - serializer = PluginRpcSerializer(serializer) + serializer = RequestContextSerializer(serializer) return messaging.RPCClient(TRANSPORT, target, version_cap=version_cap, @@ -88,7 +89,7 @@ def get_client(target, version_cap=None, serializer=None): def get_server(target, endpoints, serializer=None): assert TRANSPORT is not None - serializer = PluginRpcSerializer(serializer) + serializer = RequestContextSerializer(serializer) return messaging.get_rpc_server(TRANSPORT, target, endpoints, @@ -103,12 +104,12 @@ def get_notifier(service=None, host=None, publisher_id=None): return NOTIFIER.prepare(publisher_id=publisher_id) -class PluginRpcSerializer(om_serializer.Serializer): +class RequestContextSerializer(om_serializer.Serializer): """This serializer is used to convert RPC common context into Neutron Context. """ - def __init__(self, base): - super(PluginRpcSerializer, self).__init__() + def __init__(self, base=None): + super(RequestContextSerializer, self).__init__() self._base = base def serialize_entity(self, ctxt, entity): diff --git a/neutron/tests/fake_notifier.py b/neutron/tests/fake_notifier.py index 012f3351e..2972fd629 100644 --- a/neutron/tests/fake_notifier.py +++ b/neutron/tests/fake_notifier.py @@ -30,7 +30,9 @@ FakeMessage = collections.namedtuple('Message', class FakeNotifier(object): - def __init__(self, transport, publisher_id=None): + def __init__(self, transport, publisher_id=None, + driver=None, topic=None, + serializer=None, retry=None): self.transport = transport self.publisher_id = publisher_id for priority in ('debug', 'info', 'warn', 'error', 'critical'):