Fix: Rentrancy during sw-deploy downgrades

Reentrancy is not working for downgrades because it is checking
information on the from-release instead of the to-release.

The fix is to check for a deployment in progress rather than check for
specific states.

TEST PLAN
PASS: AIO-DX sw-deploy-strategy upgrade
PASS: AIO-DX sw-deploy-strategy upgrade
* Reenter on start-done
PASS: AIO-DX sw-deploy-strategy downgrade
PASS: AIO-DX sw-deploy-strategy downgrade
* Reenter on start-done

Closes-Bug: 2089804
Signed-off-by: Joshua Kraitberg <joshua.kraitberg@windriver.com>
Change-Id: I751e0063ac9dff5e60d22a64fa754262e944159e
This commit is contained in:
Joshua Kraitberg 2024-11-27 18:51:15 -05:00
parent 900d1ca7c6
commit 3665329ef0
2 changed files with 5 additions and 2 deletions

View File

@ -2071,7 +2071,10 @@ class SwUpgradeStrategy(
elif self._nfvi_alarms:
reason = "Active alarms found, can't apply software deployment"
elif self.nfvi_upgrade.is_deployed or self.nfvi_upgrade.is_available:
elif not self.nfvi_upgrade.deploy_info and (
self.nfvi_upgrade.is_deployed or
self.nfvi_upgrade.is_available
):
from nfv_vim import tables
bad_hosts = []
host_table = tables.tables_get_host_table()

View File

@ -967,7 +967,7 @@ class SwDeployPrecheckStep(strategy.StrategyStep):
from nfv_vim import nfvi
DLOG.info("Step (%s) apply." % self._name)
if self.strategy.nfvi_upgrade.is_deploying or self.strategy.nfvi_upgrade.is_removing:
if self.strategy.nfvi_upgrade.deploy_info:
reason = "Deployment already in progress, skipping precheck"
DLOG.info(reason)
return strategy.STRATEGY_STEP_RESULT.SUCCESS, reason