Bug 1020793

Summary: [notifier] If Alert and Issue Solved Notifications are both discovered during next iteration, the order is messed
Product: Red Hat Enterprise Virtualization Manager Reporter: Jiri Belka <jbelka>
Component: ovirt-engine-notification-serviceAssignee: Mooli Tayer <mtayer>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: aberezin, acathrow, bazulay, emesika, iheim, Rhev-m-bugs, yeylon
Target Milestone: ---   
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: ovirt-3.4.0-alpha1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-12 14:03:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
notifier.log none

Description Jiri Belka 2013-10-18 09:39:50 UTC
Created attachment 813685 [details]
notifier.log

Description of problem:
If Alert and Issue Solved Notifications are both check during next iteration, the order is messed. It means, when "opening" event such as 'Migration started', which in notifier language called 'Alert Notification' and its "closing" event, here 'Migration completed', in notifier language called 'Issue Solved Notification', are both discovered during next iteration (after INTERNAL_IN_SECONDS, defaults to 120 secs), the order how the events are sent via mail is messed. First is sent closing event then opening.

-%-
2013-10-18 10:54:43,530 DEBUG [org.ovirt.engine.core.notifier.NotificationService] Finish event notification service iteration
2013-10-18 10:55:32,976 DEBUG [org.ovirt.engine.core.notifier.EngineMonitorService] checkServerStatus return: true
2013-10-18 10:56:43,531 DEBUG [org.ovirt.engine.core.notifier.NotificationService] Start event notification service iteration
2013-10-18 10:56:43,545 DEBUG [org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl] Send email to [jbelka]
 subject:
 [Issue Solved Notification. (jb-rh33.rhev.lab.eng.brq.redhat.com), [Migration completed (VM: jb-w8-x86, Source: dell-r210ii-13, Destination: dell-r210ii-03, Duration: 41 sec).]]
 body:
 [Time:2013-10-18 10:55:45.237
Message:Migration completed (VM: jb-w8-x86, Source: dell-r210ii-13, Destination: dell-r210ii-03, Duration: 41 sec).
Severity:0
User Name: admin@internal
VM Name: jb-w8-x86
Host Name: dell-r210ii-13
Template Name: Blank
Data Center Name: Default
]
2013-10-18 10:56:45,027 DEBUG [org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl] Send email to [jbelka]
 subject:
 [Alert Notification. (jb-rh33.rhev.lab.eng.brq.redhat.com), [Migration started (VM: jb-w8-x86, Source: dell-r210ii-13, Destination: dell-r210ii-03, User: admin@internal).]]
 body:
 [Time:2013-10-18 10:55:03.305
Message:Migration started (VM: jb-w8-x86, Source: dell-r210ii-13, Destination: dell-r210ii-03, User: admin@internal).
Severity:0
User Name: admin@internal
VM Name: jb-w8-x86
Host Name: dell-r210ii-13
Template Name: Blank
Data Center Name: Default
]
-%-

This is obviously an error. Notifier should know correlation between events. First Alert, then Issue Solved (if any).

Version-Release number of selected component (if applicable):
is19

How reproducible:
100%

Steps to Reproduce:
1. put notifier into debug level
2. wait for 'Finish event notification service iteration' in the log
3. start a migration of simple VM (no big disk! so it can be migrated inside INTERVAL_IN_SECONDS value)
4. double-check if your migration finished before next 'Start event notification service iteration'
5. If so, see next lines for 'Send mail' and their subject

Actual results:
first is sent "closing" notification, then "opening"

Expected results:
smarter notifier

Additional info:

Comment 1 Mooli Tayer 2013-11-04 15:02:23 UTC
Patch proposed upstream -
Notification will now be sent according to creation time.
Note It is still possible that I send Message a and then Message b and b is received first, but I don't see any solution for that.

Comment 2 Sandro Bonazzola 2014-01-14 08:42:47 UTC
ovirt 3.4.0 alpha has been released

Comment 3 Jiri Belka 2014-01-27 10:24:14 UTC
ok, ovirt-engine-tools-3.4.0-0.2.master.20140112020439.git9ad8529.el6.noarch

2014-01-27 10:23:04,952 INFO  [org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl] Send email to [jbelka]
 subject:
 [Alert Notification. (jb-rh34.rhev.lab.eng.brq.redhat.com), [Host dell-r210ii-13 was switched to Maintenance mode by admin@internal.]]
2014-01-27 10:23:04,952 DEBUG [org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl] body:
 [Time:2014-01-27 10:21:07.957
Message:Host dell-r210ii-13 was switched to Maintenance mode by admin@internal.
Severity:0
User Name: admin@internal
Host Name: dell-r210ii-13
]
2014-01-27 10:23:06,790 INFO  [org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl] Send email to [jbelka]
 subject:
 [Issue Solved Notification. (jb-rh34.rhev.lab.eng.brq.redhat.com), [Host dell-r210ii-13 was activated by admin@internal.]]
2014-01-27 10:23:06,790 DEBUG [org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl] body:
 [Time:2014-01-27 10:21:12.901
Message:Host dell-r210ii-13 was activated by admin@internal.
Severity:0
User Name: admin@internal
Host Name: dell-r210ii-13
]

Comment 4 Itamar Heim 2014-06-12 14:03:49 UTC
Closing as part of 3.4.0