Martin Sivák has uploaded a new change for review.

Change subject: Fix the email flood caused by not handling the yield logic 
properly
......................................................................

Fix the email flood caused by not handling the yield logic properly

The notification logic handled the internal loop only
(in _perform_engine_actions), but forgot to handle the loop around
that method. That caused an email flood with the same information.

Change-Id: I4f35d85472f9e27bad222254a4d5c81b845d6282
Signed-off-by: Martin Sivak <[email protected]>
---
M ovirt_hosted_engine_ha/agent/hosted_engine.py
1 file changed, 10 insertions(+), 5 deletions(-)


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

diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py 
b/ovirt_hosted_engine_ha/agent/hosted_engine.py
index 17a0d72..37e8038 100644
--- a/ovirt_hosted_engine_ha/agent/hosted_engine.py
+++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py
@@ -796,20 +796,25 @@
         self._rinfo.update(rinfo)
 
         yield_ = False
-        old_state = "<initial_state>"
         # Process the states until it's time to sleep, indicated by the
         # state handler returning yield_ as True.
         while not yield_:
             self._log.debug("Processing engine state %s",
                             self._rinfo['current-state'])
-            self._broker.notify(brokerlink.NotifyEvents.STATE_TRANSITION,
-                                "%s-%s" % (old_state,
-                                           self._rinfo['current-state']),
-                                hostname=socket.gethostname())
+
+            # save the current state
             old_state = self._rinfo['current-state']
+
             self._rinfo['current-state'], yield_ \
                 = self._vm_state_actions[self._rinfo['current-state']]()
 
+            # notify on state change
+            if old_state != self._rinfo['current-state']:
+                self._broker.notify(brokerlink.NotifyEvents.STATE_TRANSITION,
+                                    "%s-%s" % (old_state,
+                                               self._rinfo['current-state']),
+                                    hostname=socket.gethostname())
+
         self._log.debug("Next engine state %s",
                         self._rinfo['current-state'])
 


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

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

Reply via email to