def _init_serializer(): serializer = rpc.RequestContextSerializer( objects_base.ZunObjectSerializer()) if osprofiler: serializer = rpc.ProfilerRequestContextSerializer(serializer) else: serializer = rpc.RequestContextSerializer(serializer) return serializer
def __init__(self, topic, server, handlers, binary): super(Service, self).__init__() serializer = rpc.RequestContextSerializer( objects_base.ZunObjectSerializer()) transport = messaging.get_transport(CONF) # TODO(asalkeld) add support for version='x.y' target = messaging.Target(topic=topic, server=server) self._server = messaging.get_rpc_server(transport, target, handlers, serializer=serializer) self.binary = binary
def __init__(self, transport=None, context=None, topic=None, server=None, timeout=None): serializer = rpc.RequestContextSerializer( objects_base.ZunObjectSerializer()) if transport is None: exmods = rpc.get_allowed_exmods() transport = messaging.get_transport(CONF, allowed_remote_exmods=exmods) self._context = context if topic is None: topic = '' target = messaging.Target(topic=topic, server=server) self._client = messaging.RPCClient(transport, target, serializer=serializer, timeout=timeout)
def setUp(self): super(TestRequestContextSerializer, self).setUp() self.mock_base = mock.Mock() self.ser = rpc.RequestContextSerializer(self.mock_base) self.ser_null = rpc.RequestContextSerializer(None)