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: v17.1.0~2499^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40324%2Fhead;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 --- diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 820b05396248..0d3066b4151e 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()