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:
PENDING: Ran deploy host for a non RR deployment with host unlocked.

Story: 2010676
Task: tbd

Change-Id: I1c76ab5a02148588421a3d33805ebe716a570b81
Signed-off-by: Luis Eduardo Bonatti <LuizEduardo.Bonatti@windriver.com>
This commit is contained in:
Luis Eduardo Bonatti 2024-04-24 11:16:29 -03:00
parent c5a7d1d336
commit 66adc83196
1 changed files with 11 additions and 7 deletions

View File

@ -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():