示例#1
0
文件: main.py 项目: leelavg/kadalu
def main():
    """
    Register Controller Server, Node server and Identity Server and start
    the GRPC server in required endpoint
    """
    logging_setup()

    # If Provisioner pod reboots, mount volumes if they exist before reboot
    mount_storage()

    signal.signal(signal.SIGHUP, reconfigure_mounts)

    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    csi_pb2_grpc.add_ControllerServicer_to_server(ControllerServer(), server)
    csi_pb2_grpc.add_NodeServicer_to_server(NodeServer(), server)
    csi_pb2_grpc.add_IdentityServicer_to_server(IdentityServer(), server)

    server.add_insecure_port(os.environ.get("CSI_ENDPOINT", "unix://plugin/csi.sock"))
    logging.info("Server started")
    server.start()
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)
示例#2
0
 def __init__(self, server, persistence_config, backend_config,
              cinderlib_config=None, default_size=DEFAULT_SIZE, **kwargs):
     self.default_size = default_size
     cinderlib.setup(persistence_config=persistence_config,
                     **cinderlib_config)
     self.backend = cinderlib.Backend(**backend_config)
     Identity.__init__(self, server, cinderlib_config)
     csi.add_ControllerServicer_to_server(self, server)
示例#3
0
 def __init__(self, server, persistence_config, backend_config,
              ember_config=None, default_size=DEFAULT_SIZE, **kwargs):
     self.default_size = default_size
     plugin_name = ember_config.pop('plugin_name', None)
     cinderlib.setup(persistence_config=persistence_config,
                     **ember_config)
     self.backend = cinderlib.Backend(**backend_config)
     Identity.__init__(self, server, ember_config, plugin_name)
     csi.add_ControllerServicer_to_server(self, server)
示例#4
0
def serve():
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    csi_pb2_grpc.add_ControllerServicer_to_server(CinderServicer(), server)
    server.add_insecure_port('[::]:50051')
    server.start()
    print("now serving...")
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)
示例#5
0
文件: main.py 项目: humblec/kadalu
def main():
    logging.basicConfig()
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    csi_pb2_grpc.add_ControllerServicer_to_server(ControllerServer(), server)
    csi_pb2_grpc.add_NodeServicer_to_server(NodeServer(), server)
    csi_pb2_grpc.add_IdentityServicer_to_server(IdentityServer(), server)

    server.add_insecure_port(get_csi_endpoint())
    server.start()
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)
示例#6
0
文件: main.py 项目: usrbinkat/kadalu
def main():
    """
    Register Controller Server, Node server and Identity Server and start
    the GRPC server in required endpoint
    """
    logging_setup()

    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    csi_pb2_grpc.add_ControllerServicer_to_server(ControllerServer(), server)
    csi_pb2_grpc.add_NodeServicer_to_server(NodeServer(), server)
    csi_pb2_grpc.add_IdentityServicer_to_server(IdentityServer(), server)

    server.add_insecure_port(
        os.environ.get("CSI_ENDPOINT", "unix://plugin/csi.sock"))
    logging.info("Server started")
    server.start()
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)