]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/orchestrator: add cancel
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 12 Sep 2019 08:25:21 +0000 (10:25 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Wed, 27 Nov 2019 12:38:20 +0000 (13:38 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/orchestrator.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/rook/module.py

index a88bf7f09fe9d28e149fb53bbba33dc7b4991158..bd9be59571768e26f22d3c24214b66f0e4252aba 100644 (file)
@@ -679,6 +679,14 @@ class Orchestrator(object):
                     }
         return features
 
+    @_hide_in_features
+    def cancel_completions(self):
+        # type: () -> None
+        """
+        Cancels ongoing completions. Unstuck the mgr.
+        """
+        raise NotImplementedError()
+
     def add_host(self, host):
         # type: (str) -> Completion
         """
index 3765b4201f79ed64c317941864802e4054f0966e..ba0eed03e7366d15e648f69b65820d21c7a95a88 100644 (file)
@@ -659,6 +659,15 @@ Usage:
 
         return HandleCommandResult(-errno.EINVAL, stderr="Module '{0}' not found".format(module_name))
 
+    @_write_cli('orchestrator cancel',
+                desc='cancels ongoing operations')
+    def _cancel(self):
+        """
+        ProgressReferences might get stuck. Let's unstuck them.
+        """
+        self.cancel_completions()
+        return HandleCommandResult()
+
     @orchestrator._cli_read_command(
         'orchestrator status',
         desc='Report configured backend and its status')
index 473e21fb534756c2641efec60060e56bcf5e968c..b2092d167ef40c0160349e39cff769c44ed01268 100644 (file)
@@ -205,6 +205,11 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
 
             self._shutdown.wait(5)
 
+    def cancel_completions(self):
+        for p in self.all_progress_references:
+            p.fail()
+        self.all_progress_references.clear()
+
     @deferred_read
     def get_inventory(self, node_filter=None, refresh=False):
         node_list = None