Fix getting subcloud with lowest id
WIP Change-Id: I13d2607973ecc2d6350ab5b725f62fffadff5f0c Signed-off-by: aabhinav <ayyapasetti.abhinav@windriver.com>
This commit is contained in:
@@ -302,3 +302,20 @@ class DcManagerSubcloudListOutput:
|
|||||||
get_logger().log_exception(error_message)
|
get_logger().log_exception(error_message)
|
||||||
raise ValueError(error_message)
|
raise ValueError(error_message)
|
||||||
return max(subclouds_by_type, key=lambda subcloud: int(subcloud.get_id()))
|
return max(subclouds_by_type, key=lambda subcloud: int(subcloud.get_id()))
|
||||||
|
|
||||||
|
def get_subcloud_with_lowest_id(self) -> DcManagerSubcloudListObject:
|
||||||
|
"""Gets an instance of DcManagerSubcloudListObject with the lowest ID regardless of its state.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
DcManagerSubcloudListObject: the instance of DcManagerSubcloudListObject with the lowest ID.
|
||||||
|
|
||||||
|
"""
|
||||||
|
subclouds = self.get_dcmanager_subcloud_list_objects_filtered(None)
|
||||||
|
|
||||||
|
if not subclouds:
|
||||||
|
error_message = "In this DC system, there are no subclouds."
|
||||||
|
get_logger().log_exception(error_message)
|
||||||
|
raise ValueError(error_message)
|
||||||
|
|
||||||
|
lowest_subcloud = min(subclouds, key=lambda subcloud: int(subcloud.get_id()))
|
||||||
|
return lowest_subcloud
|
||||||
|
@@ -36,7 +36,7 @@ def get_undeployed_subcloud_name(ssh_connection: SSHConnection) -> str:
|
|||||||
get_logger().log_info("No Undeployed Subcloud found deleting existing one")
|
get_logger().log_info("No Undeployed Subcloud found deleting existing one")
|
||||||
# Gets the lowest subcloud (the subcloud with the lowest id).
|
# Gets the lowest subcloud (the subcloud with the lowest id).
|
||||||
get_logger().log_info("Obtaining subcloud with the lowest ID.")
|
get_logger().log_info("Obtaining subcloud with the lowest ID.")
|
||||||
lowest_subcloud = dcm_sc_list_kw.get_dcmanager_subcloud_list().get_healthy_subcloud_with_lowest_id()
|
lowest_subcloud = dcm_sc_list_kw.get_dcmanager_subcloud_list().get_subcloud_with_lowest_id()
|
||||||
get_logger().log_info(f"Subcloud with the lowest ID obtained: ID={lowest_subcloud.get_id()}, Name={lowest_subcloud.get_name()}, Management state={lowest_subcloud.get_management()}")
|
get_logger().log_info(f"Subcloud with the lowest ID obtained: ID={lowest_subcloud.get_id()}, Name={lowest_subcloud.get_name()}, Management state={lowest_subcloud.get_management()}")
|
||||||
subcloud_name = lowest_subcloud.get_name()
|
subcloud_name = lowest_subcloud.get_name()
|
||||||
dcm_sc_manager_kw = DcManagerSubcloudManagerKeywords(ssh_connection)
|
dcm_sc_manager_kw = DcManagerSubcloudManagerKeywords(ssh_connection)
|
||||||
|
Reference in New Issue
Block a user