diff --git a/simulation-system/libs/csle-cli/src/csle_cli/cli.py b/simulation-system/libs/csle-cli/src/csle_cli/cli.py index 37525d122..2491861ea 100755 --- a/simulation-system/libs/csle-cli/src/csle_cli/cli.py +++ b/simulation-system/libs/csle-cli/src/csle_cli/cli.py @@ -1389,10 +1389,9 @@ def start_host_managers(ip: str, emulation: str, ip_first_octet: int): config = MetastoreFacade.get_config(id=1) for node in config.cluster_config.cluster_nodes: if node.ip == ip or ip == "": - started = ClusterController.start_host_managers(ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, + operation_outcome = ClusterController.start_host_managers(ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, emulation=emulation, ip_first_octet=ip_first_octet) - - if started: + if operation_outcome.outcome: click.secho(f"Starting host managers on port:{constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT}") else: click.secho(f"Host managers are not started:{constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT}", @@ -1413,14 +1412,14 @@ def start_host_manager(ip: str, container_ip:str, emulation: str, ip_first_octet config = MetastoreFacade.get_config(id=1) for node in config.cluster_config.cluster_nodes: if node.ip == ip or ip == "": - started = ClusterController.start_host_manager(ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, + operation_outcome = ClusterController.start_host_manager(ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, emulation=emulation, ip_first_octet=ip_first_octet, container_ip=container_ip) - if started: - click.secho(f"Starting host with ip {container_ip} on " + if operation_outcome.outcome: + click.secho(f"Started host manager with ip {container_ip} on " f"port:{constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT}") else: - click.secho(f"Host with ip {container_ip} is not " + click.secho(f"Host manager with ip {container_ip} is not " f"started:{constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT}", bold=False) diff --git a/simulation-system/libs/csle-cluster/src/csle_cluster/cluster_manager/cluster_manager.py b/simulation-system/libs/csle-cluster/src/csle_cluster/cluster_manager/cluster_manager.py index 927a991a9..46c770bdf 100644 --- a/simulation-system/libs/csle-cluster/src/csle_cluster/cluster_manager/cluster_manager.py +++ b/simulation-system/libs/csle-cluster/src/csle_cluster/cluster_manager/cluster_manager.py @@ -2425,6 +2425,8 @@ def startHostManager( ip=container_config.docker_gw_bridge_ip, logger=logging.getLogger()) return csle_cluster.cluster_manager.cluster_manager_pb2.OperationOutcomeDTO(outcome=True) else: + logging.info(f"Container with ip: {request.containerIp} not found in execution " + f"with id: {request.ipFirstOctet} of emulation {request.emulation}") return csle_cluster.cluster_manager.cluster_manager_pb2.OperationOutcomeDTO(outcome=False) def stopHostManagers( diff --git a/simulation-system/libs/csle-common/src/csle_common/controllers/host_controller.py b/simulation-system/libs/csle-common/src/csle_common/controllers/host_controller.py index b220c40d6..8623f5f28 100644 --- a/simulation-system/libs/csle-common/src/csle_common/controllers/host_controller.py +++ b/simulation-system/libs/csle-common/src/csle_common/controllers/host_controller.py @@ -89,6 +89,9 @@ def start_host_manager(emulation_env_config: EmulationEnvConfig, ip: str, logger o, e, _ = EmulationUtil.execute_ssh_cmd(cmd=cmd, conn=emulation_env_config.get_connection(ip=ip)) time.sleep(5) + else: + logger.info(f"Host manager is already running on: {ip}. Output of {cmd} was: {str(o)}, " + f"err output was: {str(e)}") @staticmethod def stop_host_managers(emulation_env_config: EmulationEnvConfig, physical_host_ip: str) -> None: