From 6f5766c386aefcd79db8a7d5f370eab9e57fa024 Mon Sep 17 00:00:00 2001 From: Joshua Kraitberg Date: Wed, 26 Apr 2023 19:12:28 -0400 Subject: [PATCH] Block restore-complete while apps are restore-requested The apps in restore-requested state can only be transitioned out of during restore in progress. However, restore completed can still be sent while apps are in this state. This adds a check to ensure restore can not be completed while apps are in this state and also during applying, which can transition back on error. TEST PLAN PASS: AIO-SX legacy restore PASS: AIO-SX optimized restore TEST PLAN PASS: AIO-SX restore PASS: AIO-SX optimized restore Closes-Bug: 2017899 Signed-off-by: Joshua Kraitberg Change-Id: I1e49262516cad3e48871c0ba778cbf3c8c8bc91a --- sysinv/sysinv/sysinv/sysinv/conductor/manager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index 5516c6c52c..aab75e469d 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -15523,6 +15523,17 @@ class ConductorManager(service.PeriodicService): LOG.error(e) return message + # Do not allow restore to complete if some apps are still in restore-requested state + waiting_apps = [ + v.name for v in self.dbapi.kube_app_get_all() + if v.status in [constants.APP_APPLY_IN_PROGRESS, constants.APP_RESTORE_REQUESTED]] + + if waiting_apps: + message = "Some apps are still restoring, " \ + "try restore-complete later: {}".format(waiting_apps) + LOG.info(message) + return message + try: restore = self.dbapi.restore_get_one( filters={'state': constants.RESTORE_STATE_IN_PROGRESS})