Exemple #1
0
def csi_driver(endpoint, nodeid, enable_metrics):
    migrate_all_volume_schemas()
    if enable_metrics:
        expose_metrics()
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    csi_pb2_grpc.add_IdentityServicer_to_server(
        rawfile_servicer.RawFileIdentityServicer(), server)
    csi_pb2_grpc.add_NodeServicer_to_server(
        rawfile_servicer.RawFileNodeServicer(node_name=nodeid), server)
    csi_pb2_grpc.add_ControllerServicer_to_server(
        rawfile_servicer.RawFileControllerServicer(), server)
    server.add_insecure_port(endpoint)
    server.start()
    server.wait_for_termination()
Exemple #2
0
    def serve(self):
        logging_interceptor = ServerLoggingInterceptor(self.logger)
        self.server = grpc.server(futures.ThreadPoolExecutor(max_workers=10),
                                  interceptors=(logging_interceptor, ))
        csi_pb2_grpc.add_IdentityServicer_to_server(self.identity_service,
                                                    self.server)

        if self.driver_type == Consts.DriverType.Controller:
            csi_pb2_grpc.add_ControllerServicer_to_server(
                self.controller_service, self.server)
        else:
            csi_pb2_grpc.add_NodeServicer_to_server(self.node_service,
                                                    self.server)

        self.server.add_insecure_port(Config.SOCKET_PATH)

        self.server.start()
        self.logger.info("Server is listening on {}".format(
            Config.SOCKET_PATH))
        self.wait_forever()