]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/upgrade: do not crash if error races with user cancellation
authorSage Weil <sage@newdream.net>
Mon, 22 Mar 2021 22:40:25 +0000 (18:40 -0400)
committerSage Weil <sage@newdream.net>
Wed, 24 Mar 2021 03:01:30 +0000 (22:01 -0500)
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>
(cherry picked from commit 2580de1a5db476b01093a269056d2f5bd0cc3d75)

src/pybind/mgr/cephadm/upgrade.py

index d3781ac38f3eac1eb37671dd7c0fd41995be841e..45e2810c88325acd80fc4ea464e91196a165a6b3 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()