SX host-lock failed by "Timeout while waiting on R"

When sysinv is restarted and there is an application stuck,
the _abort_operation function was called with a parameter
different from the expected one. The parameter needs to be
an instance of AppOperation.Application.

Function call was changed with correct parameter and added
documentation in the _abort_operation function.

Test Plan:
PASS: Restart sysinv successfully
PASS: Restart sysinv with stuck kubervirt app performed
successfully
PASS: Successfully lock and unlock the controller
PASS: Shows the name of the chart that caused the app to abort
PASS: Individually show the image that failed when trying to
apply the app
PASS: Command "system application-abort" executed and output
message "operation aborted by user" displayed in
application-list as expected

Closes-bug: 2022007

Signed-off-by: David Bastos <david.barbosabastos@windriver.com>
Change-Id: I948ec8f9700d188a5f8e099a4992853822735b95
This commit is contained in:
David Barbosa Bastos 2023-05-31 21:22:29 +00:00
parent c291ad805a
commit e2af795583
1 changed files with 17 additions and 5 deletions

View File

@ -168,13 +168,14 @@ class AppOperator(object):
return app.system_app
def _clear_stuck_applications(self):
apps = self._dbapi.kube_app_get_all()
for app in apps:
if app.status in [constants.APP_UPLOAD_IN_PROGRESS,
db_apps = self._dbapi.kube_app_get_all()
for db_app in db_apps:
if db_app.status in [constants.APP_UPLOAD_IN_PROGRESS,
constants.APP_APPLY_IN_PROGRESS,
constants.APP_UPDATE_IN_PROGRESS,
constants.APP_RECOVER_IN_PROGRESS,
constants.APP_REMOVE_IN_PROGRESS]:
app = AppOperator.Application(db_app)
self._abort_operation(app, app.status, reset_status=True)
else:
continue
@ -297,9 +298,19 @@ class AppOperator(object):
progress=constants.APP_PROGRESS_ABORTED,
user_initiated=False, reset_status=False,
forced_operation=False):
"""Abort application operations
This function is responsible for canceling operations
like upload, apply, remove
:param app: Instance of the AppOperation.Application
:operation: String with application status
"""
# Adds the app object error message if it exists
progress = "{}: {}".format(app.error_message, progress)
app.clear_error_message()
if (app.error_message):
progress = "{}: {}".format(app.error_message, progress)
app.clear_error_message()
if user_initiated:
progress = constants.APP_PROGRESS_ABORTED_BY_USER
@ -3043,6 +3054,7 @@ class AppOperator(object):
def __init__(self, rpc_app):
self._kube_app = rpc_app
self.id = self._kube_app.get('id')
self.tarfile = None
self.downloaded_tarfile = False