Exemplo n.º 1
0
def _init_serializer():
    serializer = rpc.RequestContextSerializer(
        objects_base.ZunObjectSerializer())
    if osprofiler:
        serializer = rpc.ProfilerRequestContextSerializer(serializer)
    else:
        serializer = rpc.RequestContextSerializer(serializer)
    return serializer
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)