From b770638c798be20d90e7a632c4a89d9587ad3a44 Mon Sep 17 00:00:00 2001 From: Heitor Matsui Date: Tue, 7 Jan 2025 12:25:28 -0300 Subject: [PATCH] Restrict legacy patch check to stx-8 or less During USM upgrade to stx-10, when the second controller is upgraded, the active controller legacy patch controller change from-release Applied patches to Partial-Apply state, because the sysroot ostree commit-id changes on the second controller and doesn't match the previous patches commits anymore. This commit restricts legacy patch API checks/changes to hosts running stx-8 or less, where legacy patch API is valid. On post stx-8 releases USM is the new patch API. Test Plan PASS: AIO-SX stx-8 -> stx-10 upgrade, verify patch state is consistent PASS: AIO-SX stx-10 -> stx-8 rollback, verify patch state is consistent PASS: STD, same as previous TCs Closes-bug: 2093202 Change-Id: I1e79d354cafd9d6db12c6b1d0164bd4000137c23 Signed-off-by: Heitor Matsui --- sw-patch/cgcs-patch/cgcs_patch/patch_controller.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sw-patch/cgcs-patch/cgcs_patch/patch_controller.py b/sw-patch/cgcs-patch/cgcs_patch/patch_controller.py index f9a01155..e669d5aa 100644 --- a/sw-patch/cgcs-patch/cgcs_patch/patch_controller.py +++ b/sw-patch/cgcs-patch/cgcs_patch/patch_controller.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2014-2022 Wind River Systems, Inc. +Copyright (c) 2014-2025 Wind River Systems, Inc. SPDX-License-Identifier: Apache-2.0 @@ -18,6 +18,7 @@ import tarfile import tempfile import threading import time +from packaging import version from wsgiref import simple_server from oslo_config import cfg as oslo_cfg @@ -829,6 +830,14 @@ class PatchController(PatchService): self.patch_data.metadata[patch_id]["patchstate"] = constants.UNKNOWN return + # If the active controller running release > 22.12 then it + # should not check or change legacy patch API states + try: + if version.Version(SW_VERSION) > version.Version("22.12"): + return + except Exception as e: + LOG.warning("Unable to identify running release: %s", str(e)) + # Default to allowing in-service patching self.allow_insvc_patching = True