From: Sage Weil Date: Mon, 22 Mar 2021 22:40:25 +0000 (-0400) Subject: mgr/cephadm/upgrade: do not crash if error races with user cancellation X-Git-Tag: v16.2.0~24^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c1aa5f370073407eff867adc3beab10901ad6f8e;p=ceph.git mgr/cephadm/upgrade: do not crash if error races with user cancellation If the user cancels the upgrade just before the upgrade thread runs into a problem (and these things may be correlated!), ignore the failure instead of crashing the module. Signed-off-by: Sage Weil (cherry picked from commit 2580de1a5db476b01093a269056d2f5bd0cc3d75) --- diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index d3781ac38f3ea..45e2810c88325 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -274,11 +274,13 @@ class CephadmUpgrade: def _fail_upgrade(self, alert_id: str, alert: dict) -> None: assert alert_id in self.UPGRADE_ERRORS - logger.error('Upgrade: Paused due to %s: %s' % (alert_id, - alert['summary'])) if not self.upgrade_state: - assert False, 'No upgrade in progress' + # this could happen if the user canceled the upgrade while we + # were doing something + return + logger.error('Upgrade: Paused due to %s: %s' % (alert_id, + alert['summary'])) self.upgrade_state.error = alert_id + ': ' + alert['summary'] self.upgrade_state.paused = True self._save_upgrade_state()