From 5e53290ed620451f5cbffff21df4bccf27c32c74 Mon Sep 17 00:00:00 2001 From: Heitor Matsui <heitorvieira.matsui@windriver.com> Date: Tue, 4 Jun 2024 16:29:57 -0300 Subject: [PATCH] Enable swact in USM deploy abort/rollback scenario Currently the swact logic blocks the USM abort/rollback scenario after controller-0 is rolled back. This commit enables swacting between controllers in a abort/rollback scenario for USM major release deployment. Test Plan PASS: swact between controllers during USM abort (Regression) PASS: swact between controllers out of USM abort Story: 2010676 Task: 50264 Change-Id: I3cc4c5c5c080bba4c3ff60c1591a4eab7339a16c Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com> --- sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py | 9 ++++++--- sysinv/sysinv/sysinv/sysinv/common/constants.py | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py index a731cb842d..6e1b541c6d 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py @@ -6196,13 +6196,16 @@ class HostController(rest.RestController): if isinstance(upgrade, usm_service.UsmUpgrade): to_host_deploy = usm_service.get_host_deploy(pecan.request.dbapi, to_host['hostname']) - if to_host_deploy['host_state'] == constants.DEPLOY_HOST_DEPLOYED: + if to_host_deploy['host_state'] in [constants.DEPLOY_HOST_DEPLOYED, + constants.DEPLOY_HOST_ROLLBACK_DEPLOYED]: # to host has deployed pass else: from_host_deploy = usm_service.get_host_deploy(pecan.request.dbapi, from_host['hostname']) - if from_host_deploy['host_state'] == constants.DEPLOY_HOST_PENDING and \ - to_host_deploy['host_state'] == constants.DEPLOY_HOST_PENDING: + if from_host_deploy['host_state'] in [constants.DEPLOY_HOST_PENDING, + constants.DEPLOY_HOST_ROLLBACK_PENDING] and \ + to_host_deploy['host_state'] in [constants.DEPLOY_HOST_PENDING, + constants.DEPLOY_HOST_ROLLBACK_PENDING]: # no host has started deploy yet pass else: diff --git a/sysinv/sysinv/sysinv/sysinv/common/constants.py b/sysinv/sysinv/sysinv/sysinv/common/constants.py index 1458029fa6..1dc9fd2c93 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/constants.py +++ b/sysinv/sysinv/sysinv/sysinv/common/constants.py @@ -2590,9 +2590,12 @@ ISSUER = "Issuer" # USM deploy state DEPLOY_STATE_HOST = 'host' # host is being deploy DEPLOY_STATE_HOST_FAILED = 'host-failed' # host deployment failed + # USM deploy host state DEPLOY_HOST_PENDING = 'pending' # host is pending for new deployment DEPLOY_HOST_DEPLOYED = 'deployed' # new software is deployed to the host +DEPLOY_HOST_ROLLBACK_PENDING = 'rollback-pending' # host is pending for rollback +DEPLOY_HOST_ROLLBACK_DEPLOYED = 'rollback-deployed' # rollback release is deployed to the host # API operations API_POST = 'post'