]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/upgrade: do not crash if error races with user cancellation 40324/head
authorSage Weil <sage@newdream.net>
Mon, 22 Mar 2021 22:40:25 +0000 (18:40 -0400)
committerSage Weil <sage@newdream.net>
Mon, 22 Mar 2021 22:40:25 +0000 (18:40 -0400)
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 <sage@newdream.net>
src/pybind/mgr/cephadm/upgrade.py

index 820b05396248a497cd3037ca4d74cf334132a913..0d3066b4151eee133acfa1f8aff49232cb041922 100644 (file)
@@ -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()