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

Change subject: respect the timeout in EngineUpBadHealth state (better fix)
......................................................................

respect the timeout in EngineUpBadHealth state (better fix)

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


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

diff --git a/ovirt_hosted_engine_ha/agent/states.py 
b/ovirt_hosted_engine_ha/agent/states.py
index e881294..71c0540 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 EngineUpDeterminingHealth:
+    :transition EngineUpBadHealth:
     :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 EngineUpDeterminingHealth(new_data)
+            return EngineUpBadHealth(new_data)
         else:
             logger.info("Engine vm running on localhost",
                         extra=log_filter.lf_args(self.LF_ENGINE_HEALTH,
@@ -563,20 +563,6 @@
                      (now - fail_time))
         return super(EngineUpBadHealth, self).consume(fsm, new_data, logger)
 
-    def score(self, logger):
-        # the timeout_start_time is None if the state just changed
-        if self.data.timeout_start_time:
-            time_str = time.ctime(self.data.timeout_start_time
-                                  + self.data.stats.time_epoch)
-        else:
-            time_str = time.ctime()
-        # If engine has bad health status, let another host try
-        logger.info('Score is 0 due to bad engine health at %s',
-                    time_str,
-                    extra=log_filter.lf_args('score-health',
-                                             self.LF_PENALTY_INT))
-        return 0
-
     def metadata(self):
         data = super(EngineUpBadHealth, self).metadata()
         if self.data.timeout_start_time:
@@ -584,23 +570,6 @@
                        + constants.ENGINE_BAD_HEALTH_TIMEOUT_SECS)
             data["timeout"] = time.ctime(timeout)
         return 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 EngineUnexpectedlyDown(EngineState):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id86274fabe5f66ee42fc0235a4091205afedd79c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Jiří Moskovčák <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to