From 3665329ef0d24c35bdffd87fb99996a6be63cb53 Mon Sep 17 00:00:00 2001 From: Joshua Kraitberg Date: Wed, 27 Nov 2024 18:51:15 -0500 Subject: [PATCH] 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 Change-Id: I751e0063ac9dff5e60d22a64fa754262e944159e --- nfv/nfv-vim/nfv_vim/strategy/_strategy.py | 5 ++++- nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nfv/nfv-vim/nfv_vim/strategy/_strategy.py b/nfv/nfv-vim/nfv_vim/strategy/_strategy.py index f0c9f34e..a70d20cd 100755 --- a/nfv/nfv-vim/nfv_vim/strategy/_strategy.py +++ b/nfv/nfv-vim/nfv_vim/strategy/_strategy.py @@ -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() diff --git a/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py b/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py index a87a69cd..26c48333 100755 --- a/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py +++ b/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py @@ -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