Jiří Moskovčák has uploaded a new change for review.

Change subject: respect the timeout when checking the engine health
......................................................................

respect the timeout when checking the engine health

Change-Id: I3c1d7ac61e65280fa788e99a40796b59abe5da4f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1150600
Signed-off-by: Jiri Moskovcak <jmosk...@redhat.com>
---
M ovirt_hosted_engine_ha/agent/states.py
1 file changed, 19 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha 
refs/changes/52/34152/1

diff --git a/ovirt_hosted_engine_ha/agent/states.py 
b/ovirt_hosted_engine_ha/agent/states.py
index 97d81f9..7f860e2 100644
--- a/ovirt_hosted_engine_ha/agent/states.py
+++ b/ovirt_hosted_engine_ha/agent/states.py
@@ -350,7 +350,7 @@
     :transition EngineUnexpectedlyDown:
     :transition EngineMigratingAway:
     :transition EngineStop:
-    :transition EngineUpBadHealth:
+    :transition EngineUpDeterminingHealth:
     :transition:
     """
     def _penalize_memory(self, vm_mem, lm, logger, score, score_cfg):
@@ -387,7 +387,7 @@
             return EngineStop(new_data)
         elif (new_data.best_engine_status["vm"] == "up" and
               new_data.best_engine_status["health"] == "bad"):
-            return EngineUpBadHealth(new_data)
+            return EngineUpDeterminingHealth(new_data)
         else:
             logger.info("Engine vm running on localhost",
                         extra=log_filter.lf_args(self.LF_ENGINE_HEALTH,
@@ -395,6 +395,23 @@
             return EngineUp(new_data)
 
 
+class EngineUpDeterminingHealth(EngineState):
+    """
+    :transition EngineDown:
+    :transition EngineUp:
+    :transition EngineUpBadHealth:
+    """
+    @check_timeout(EngineUpBadHealth, constants.ENGINE_BAD_HEALTH_TIMEOUT_SECS)
+    def consume(self, fsm, new_data, logger):
+        if new_data.best_engine_status["vm"] == "up":
+            if new_data.best_engine_status["health"] == "bad":
+                return EngineUpDeterminingHealth(new_data)
+            elif new_data.best_engine_status["health"] == "good":
+                return EngineUp(new_data)
+
+        return EngineDown(new_data)
+
+
 class EngineDown(EngineState):
     """
     This state is used when the engine is running elsewhere and the local


-- 
To view, visit http://gerrit.ovirt.org/34152
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c1d7ac61e65280fa788e99a40796b59abe5da4f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Jiří Moskovčák <jmosk...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to