Greg Padgett has uploaded a new change for review.

Change subject: agent: Migrate engine VM only for local maintenance
......................................................................

agent: Migrate engine VM only for local maintenance

Migrate the engine VM only when local maintenance is enabled and not
for the host score differentials.  This makes migration occur only when
it is likely to succeed.

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


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

diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py 
b/ovirt_hosted_engine_ha/agent/hosted_engine.py
index 1d55503..d01ab44 100644
--- a/ovirt_hosted_engine_ha/agent/hosted_engine.py
+++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py
@@ -1170,30 +1170,34 @@
             self._log.info("Engine VM found migrating away")
             return self.States.MIGRATE_MONITOR, True
 
+        best_host_id = self._rinfo['best-score-host-id']
+
         if self._rinfo['maintenance'] == self.MaintenanceMode.GLOBAL:
             self._log.info("Global HA maintenance enabled")
             return self.States.MAINTENANCE, True
         elif self._rinfo['maintenance'] == self.MaintenanceMode.LOCAL:
             # TODO local maintenance should have its own state
-            self._log.info("Local HA maintenance enabled")
-            return self.States.STOP, False
+            self._log.info("Local HA maintenance enabled,"
+                           " migrating VM to host %s (id %d)",
+                           self._all_host_stats[best_host_id]['hostname'],
+                           best_host_id)
+            self._rinfo['migration-host-id'] = best_host_id
+            return self.States.MIGRATE_START, False
         elif self._rinfo['superseded-agent']:
             # TODO superseded agent should have its own state
             self._log.error("Local agent has been superseded by newer"
                             " agents running in this cluster")
             return self.States.STOP, False
 
-        best_host_id = self._rinfo['best-score-host-id']
         if (best_host_id != local_host_id
                 and self._rinfo['best-score']
                 >= self._all_host_stats[local_host_id]['score']
                 + self.MIGRATION_THRESHOLD_SCORE):
             self._log.error("Host %s (id %d) score is significantly better"
-                            " than local score, migrating vm",
+                            " than local score, shutting down VM on this host",
                             self._all_host_stats[best_host_id]['hostname'],
                             best_host_id)
-            self._rinfo['migration-host-id'] = best_host_id
-            return self.States.MIGRATE_START, False
+            return self.States.STOP, False
 
         if self._rinfo['best-engine-status']['vm'] == 'up' \
                 and self._rinfo['best-engine-status']['health'] == 'bad':


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fbf2e9c7eec0ca7787e71c6c328f95b243840c9
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