Greg Padgett has uploaded a new change for review.

Change subject: agent: fixes for startup
......................................................................

agent: fixes for startup

Various changes to help track agent logic during startup and allow the
startup to succeed.

Change-Id: I6e0c0dbeb50c2181b29565f0d933ad56ec05bb7b
Bug-Url: https://bugzilla.redhat.com/1018849
Signed-off-by: Greg Padgett <[email protected]>
---
M ovirt_hosted_engine_ha/agent/hosted_engine.py
1 file changed, 16 insertions(+), 6 deletions(-)


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

diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py 
b/ovirt_hosted_engine_ha/agent/hosted_engine.py
index f547315..4f85d16 100644
--- a/ovirt_hosted_engine_ha/agent/hosted_engine.py
+++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py
@@ -472,7 +472,7 @@
         except Exception as e:
             msg = ("Failed to get VDSM domain monitor status: {0}"
                    .format(str(e)))
-            self._log.error(msg, esc_info=True)
+            self._log.error(msg, exc_info=True)
             raise Exception(msg)
 
         if sd_uuid not in repo_stats:
@@ -577,18 +577,25 @@
         score += 100 * (1 if float_or_default(lm['mem-load']['status'], 1)
                         < 0.8 else 0)
 
-        # Subtracting a small amount each time causes round-robin attempts
-        # between hosts that are otherwise equally suited to run the engine
-        score -= 50 * self._rinfo['engine-vm-retry-count']
-        score = max(0, score)
-
         # If too many retries occur, give a less-suited host a chance
         if (self._rinfo['engine-vm-retry-count']
                 > constants.ENGINE_RETRY_COUNT):
+            self._log.info('Score is 0 due to {0} engine vm retry attempts',
+                           self._rinfo['engine-vm-retry-count'])
             score = 0
+        elif self._rinfo['engine-vm-retry-count'] > 0:
+            # Subtracting a small amount each time causes round-robin attempts
+            # between hosts that are otherwise equally suited to run the engine
+            penalty = 50 * self._rinfo['engine-vm-retry-count']
+            self._log.info('Penalizing score by {0}'
+                           ' due to {1} engine vm retry attempts',
+                           penalty, self._rinfo['engine-vm-retry-count'])
+            score = max(0, score - penalty)
 
         # If engine has bad health status, let another host try
         if self._rinfo['bad-health-failure-time']:
+            self._log.info('Score is 0 due to bad engine health at {0}',
+                           time.ctime(self._rinfo['bad-health-failure-time']))
             score = 0
 
         # If the VM shut down unexpectedly (user command, died, etc.), drop the
@@ -596,10 +603,13 @@
         # shortcut for the user to start host maintenance mode, though it still
         # should be set manually lest the score recover after a timeout.
         if self._rinfo['unexpected-shutdown-time']:
+            self._log.info('Score is 0 due to unexpected vm shutdown at {0}',
+                           time.ctime(self._rinfo['unexpected-shutdown-time']))
             score = 0
 
         # Hosts in local maintenance mode should not run the vm
         if self._get_maintenance_mode() == self.MaintenanceMode.LOCAL:
+            self._log.info('Score is 0 due to local maintenance mode')
             score = 0
 
         ts = int(time.time())


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e0c0dbeb50c2181b29565f0d933ad56ec05bb7b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to