From 969a866d5470c84c995efda4cc142cd7a54c8bbc Mon Sep 17 00:00:00 2001 From: Luis Eduardo Bonatti Date: Wed, 24 Apr 2024 11:16:29 -0300 Subject: [PATCH] Deploy host validation blocking non RR deploy During the deploy host if the host is not locked the validations will block the action however the validation is wrong in case of a non reboot required deployment, this commit fix this validation. Test Plan: PASS: Deploy host blocked to deploy a RR with host unlocked. Story: 2010676 Task: 49967 Change-Id: I1c76ab5a02148588421a3d33805ebe716a570b81 Signed-off-by: Luis Eduardo Bonatti --- software/software/software_functions.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/software/software/software_functions.py b/software/software/software_functions.py index b3629496..1b161aa8 100644 --- a/software/software/software_functions.py +++ b/software/software/software_functions.py @@ -1367,16 +1367,21 @@ def deploy_host_validations(hostname): validate_host_state_to_deploy_host(hostname) _, system_mode = get_system_info() simplex = (system_mode == constants.SYSTEM_MODE_SIMPLEX) + db_api_instance = get_instance() + deploy = db_api_instance.get_deploy_all()[0] + to_release = deploy.get("from_release") if simplex: LOG.info("System mode is simplex. Skipping deploy order validation...") else: - validate_host_deploy_order(hostname) - if not is_host_locked_and_online(hostname): - msg = f"Host {hostname} must be {constants.ADMIN_LOCKED}." - raise SoftwareServiceError(msg) + validate_host_deploy_order(hostname, to_release) + # If the deployment is not RR the host don't need to be locked and online. + if deploy.get("reboot_required"): + if not is_host_locked_and_online(hostname): + msg = f"Host {hostname} must be {constants.ADMIN_LOCKED}." + raise SoftwareServiceError(msg) -def validate_host_deploy_order(hostname): +def validate_host_deploy_order(hostname, to_release): """ Check if the host to be deployed satisfy the major release deployment right order of controller-1 -> controller-0 -> storages -> computes @@ -1385,14 +1390,13 @@ def validate_host_deploy_order(hostname): Case one of the validations failed raise SoftwareError exception :param hostname: Hostname of the host to be deployed. + :param to_release: Software version to be deployed """ db_api_instance = get_instance() controllers_list = [constants.CONTROLLER_1_HOSTNAME, constants.CONTROLLER_0_HOSTNAME] storage_list = [] workers_list = [] is_patch_release = False - deploy = db_api_instance.get_deploy_all()[0] - to_release = deploy.get("from_release") if to_release != (constants.MAJOR_RELEASE % utils.get_major_release_version(to_release)): is_patch_release = True for host in get_ihost_list():