Exemple #1
0
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)
Exemple #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)
Exemple #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)
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)
Exemple #5
0
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)
Exemple #6
0
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)