update upgrade orch to not remove applied patches

In this commit, the DC upgrade orchestrator was updated to not remove
applied patches from the subcloud when the patch is not applied
on system controller.

Test Plan:
PASS: Upgrade system controller to 22.12, then apply a patch
on the subcloud and run the upgrade orchestration and verify
that the orchestration finished successfully.
PASS: Apply 21.12 patch on system controller, then commit the patch
and run patch orchestration. Then upgrade the system controller and
the subcloud and verify that the orchestration finished successfully.
PASS: Apply 21.12 patch on the system controller, then run patch
orchestration and upgrade the system controller and the subcloud
and verify that the orchestration finished successfully.
PASS: Upgrade system controller to 22.12, then apply a patch on
system controller and upgrade the subcloud and verify that
the orchestration reached the starting upgrade stage.

Closes-Bug: 2016701

Signed-off-by: Christopher Souza <Christopher.DeOliveiraSouza@windriver.com>
Change-Id: Id914413c99a46782170300715b78d3129bd46720
This commit is contained in:
Christopher Souza 2023-04-17 13:31:15 -03:00
parent 46c0c59a9c
commit 5237ab5858
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2022 Wind River Systems, Inc.
# Copyright (c) 2020-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -95,7 +95,8 @@ class UpdatingPatchesState(BaseState):
for patch_id in subcloud_patch_ids:
if subcloud_patches[patch_id]['repostate'] == \
patching_v1.PATCH_STATE_APPLIED:
if patch_id not in applied_patch_ids:
if subcloud_patches[patch_id]['patchstate'] != \
patching_v1.PATCH_STATE_APPLIED:
self.info_log(strategy_step,
"Patch %s will be removed from subcloud" %
(patch_id))

View File

@ -132,7 +132,7 @@ class TestSwUpgradeUpdatingPatchesStage(TestSwUpgradeState):
[consts.PATCH_VAULT_DIR + '/20.12/DC.8.patch'])
call_args, _ = self.patching_client.remove.call_args_list[0]
self.assertItemsEqual(['DC.5', 'DC.6'], call_args[0])
self.assertItemsEqual(['DC.6'], call_args[0])
call_args, _ = self.patching_client.apply.call_args_list[0]
self.assertItemsEqual(['DC.2', 'DC.3', 'DC.8'], call_args[0])