Sandro Bonazzola has uploaded a new change for review.

Change subject: don't expect the engine to be up right after starting it's guest
......................................................................

don't expect the engine to be up right after starting it's guest

- there were states which went directly from Down to Up not giving
the engine enough time to start which lead agent to go to BadHealth
state, this is wrong and we should give the guest and engine
some time to settle

Change-Id: Ie68360fe883d5d05db4974f73381da5386453845
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1130173
Signed-off-by: Jiri Moskovcak <jmosk...@redhat.com>
(cherry picked from commit 9f3f7e41fbb45b1d661564401de3ab1d5f09aa6e)
---
M ovirt_hosted_engine_ha/agent/states.py
1 file changed, 9 insertions(+), 4 deletions(-)


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

diff --git a/ovirt_hosted_engine_ha/agent/states.py 
b/ovirt_hosted_engine_ha/agent/states.py
index c1c1a31..97d81f9 100644
--- a/ovirt_hosted_engine_ha/agent/states.py
+++ b/ovirt_hosted_engine_ha/agent/states.py
@@ -273,7 +273,7 @@
     :transition GlobalMaintenance:
     :transition LocalMaintenance:
     :transition UnknownLocalVmState:
-    :transition EngineUp:
+    :transition EngineStarting:
     :transition EngineDown:
     """
     def score(self, logger):
@@ -295,8 +295,12 @@
             engine_vm_shutdown_time=None,
             migration_host_id=None)
 
+        # the engine might be just starting so if we go directly to EngineUp
+        # we might end up in EngineUpBadHealth and killing the VM
+        # if the engine is already up'n'running then EngineStarting will
+        # switch to EngineUp (hopefully) without any side effects
         if engine_state and engine_state["vm"] == "up":
-            return EngineUp(data)
+            return EngineStarting(data)
         else:
             return EngineDown(data)
 
@@ -400,7 +404,7 @@
     :transition GlobalMaintenance:
     :transition UnknownLocalVmState:
     :transition LocalMaintenance:
-    :transition EngineUp:
+    :transition EngineStarting:
     :transition:
     :transition EngineStart:
     """
@@ -419,7 +423,8 @@
                 # The engine is unexpectedly running here, start monitoring it
                 logger.info("Engine vm unexpectedly running locally,"
                             " monitoring vm")
-                return EngineUp(new_data),
+                # can't go directly up, engine needs a while to settle
+                return EngineStarting(new_data),
             else:
                 # The engine is running somewhere else
                 hostname = new_data.stats.hosts[


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie68360fe883d5d05db4974f73381da5386453845
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: ovirt-hosted-engine-ha-1.2
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: 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