From: Adam King Date: Wed, 14 Apr 2021 15:39:10 +0000 (-0400) Subject: mgr/cephadm: report exception during upgrade in upgrade status X-Git-Tag: v16.2.2~1^2~20 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7d12581981102a15d9550962006a5016691f99f2;p=ceph.git mgr/cephadm: report exception during upgrade in upgrade status Fixes: https://tracker.ceph.com/issues/50361 Signed-off-by: Adam King (cherry picked from commit 6119294b2871977e0a70b138d48dc5afc8abd45d) --- diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 43609c2ea9831..732e1fae9c494 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -80,6 +80,7 @@ class CephadmUpgrade: 'UPGRADE_FAILED_PULL', 'UPGRADE_REDEPLOY_DAEMON', 'UPGRADE_BAD_TARGET_VERSION', + 'UPGRADE_EXCEPTION' ] def __init__(self, mgr: "CephadmOrchestrator"): @@ -250,7 +251,16 @@ class CephadmUpgrade: :return: """ if self.upgrade_state and not self.upgrade_state.paused: - self._do_upgrade() + try: + self._do_upgrade() + except Exception as e: + self._fail_upgrade('UPGRADE_EXCEPTION', { + 'severity': 'error', + 'summary': 'Upgrade: failed due to an unexpected exception', + 'count': 1, + 'detail': [f'Unexpected exception occurred during upgrade process: {str(e)}'], + }) + return False return True return False