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>
This commit is contained in:
Heitor Matsui 2024-06-04 16:29:57 -03:00
parent d720c69cf6
commit 5e53290ed6
2 changed files with 9 additions and 3 deletions
sysinv/sysinv/sysinv/sysinv
api/controllers/v1
common

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

@ -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'