crmsh icon indicating copy to clipboard operation
crmsh copied to clipboard

Only wait for stop if stopping resources

Open krig opened this issue 10 years ago • 3 comments

(Description copied from mailing list email by Vladislav Bogdanov)

when performing a delete operation, crmsh (2.2.0) having -F tries to stop passed op arguments and then waits for DC to become idle.

That is not needed if only constraints are passed to delete. Could that be changed? Or, could it wait only if there is something to stop?

Something like this:

diff --git a/modules/ui_configure.py b/modules/ui_configure.py
index cf98702..96ab77e 100644
--- a/modules/ui_configure.py
+++ b/modules/ui_configure.py
@@ -552,6 +552,9 @@ class CibConfig(command.UI):
             if not ok or not cib_factory.commit():
                 raise ValueError("Failed to stop one or more running resources: %s"
%
                                  (', '.join(to_stop)))
+            return True
+        else:
+            return False

     @command.skill_level('administrator')
     @command.completers_repeating(_id_list)
@@ -562,8 +565,8 @@ class CibConfig(command.UI):
         arg_force = any((x in ('-f', '--force')) for x in argl)
         argl = [x for x in argl if (x not in ('-f', '--force'))]
         if arg_force or config.core.force:
-            self._stop_if_running(argl)
-            utils.wait4dc(what="Stopping %s" % (", ".join(argl)))
+            if (self._stop_if_running(argl)):
+                utils.wait4dc(what="Stopping %s" % (", ".join(argl)))
         return cib_factory.delete(*argl)

     @command.name('default-timeouts')

More, it may be worth checking stop-orphan-resources property and pass stop work to pacemaker if it is set to true.

krig avatar Feb 08 '16 14:02 krig

Regarding the second suggestion, to check stop-orphan-resources, I think that needs more consideration. For example if removing a group, relying on the orphan process to clean that up correctly is probably not going to work well.

Another aspect is that when trying to remove failed resources, stopping them may not work and we could get stuck.. In that case you would want --force to mean "just remove it, ignore that it is running".

krig avatar Feb 09 '16 12:02 krig

Another aspect is that when trying to remove failed resources crmsh should be able to figure out if a resource is running/not failed. Otherwise, isn't this already fixed by the referenced commit?

dmuhamedagic avatar Nov 02 '16 14:11 dmuhamedagic

Yes, that part should be fixed now. :)

krig avatar Nov 02 '16 16:11 krig