Bug 1296248

Summary: Cannot create an Alert that sends a Management Event not defined in MiqEventDefinition
Product: Red Hat CloudForms Management Engine Reporter: Peter McGowan <pmcgowan>
Component: AutomateAssignee: Lucy Fu <lufu>
Status: CLOSED ERRATA QA Contact: Dmitry Misharov <dmisharo>
Severity: high Docs Contact:
Priority: high    
Version: 5.5.0CC: akarol, cpelland, dlamotta, jhardy, jprause, kpichard, mfeifer, mkanoor, obarenbo, tfitzger
Target Milestone: GAKeywords: ZStream
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.6.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1296576 (view as bug list) Environment:
Last Closed: 2016-06-29 15:25:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1296576    

Description Peter McGowan 2016-01-06 17:24:04 UTC
Description of problem:
Prior to CFME 5.5 we could define an Alert to send a Management Event, give the Event a name, and then create the correspondingly named Instance under /System/Event and all would run happily.

Now with CFME 5.5 we have the Event Switchboard Namespaces under /System/Event, i.e. EmsEvent, MiqEvent and RequestEvent. I tried creating a test alert called 'test' that sends a Management Event called 'test', to see in the log where it was searching in the event switchboard. The error I saw was unexpected though:

Event test for class [ManageIQ::Providers::Redhat::InfraManager::Vm] id [1000000000024] was not raised: test is not defined in MiqEventDefinition

It seems we can no longer create user-defined Management Events. I would consider this a regression on CFME 5.4.

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

How reproducible:
Every time

Steps to Reproduce:
1. Create a Control Alert that sends a user-defined Management Event called 'test'
2. Assign the Alert to an Alert profile, and trigger the action that would generate the alert.

Actual results:
Observe the error: Event test for class [ManageIQ::Providers::Redhat::InfraManager::Vm] id [1000000000024] was not raised: test is not defined in MiqEventDefinition

Expected results:
The Management Event should be run


Additional info:

Comment 3 CFME Bot 2016-02-01 18:25:59 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/6dfab2e00364d92356c3e0da2aa8e6653f786948

commit 6dfab2e00364d92356c3e0da2aa8e6653f786948
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jan 11 09:50:43 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Jan 12 14:19:46 2016 -0500

    Add new EventStream subclass CustomEvent for Management Event from Alert.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 app/models/custom_event.rb                                            | 2 ++
 .../service_models/miq_ae_service_custom_event.rb                     | 4 ++++
 2 files changed, 6 insertions(+)
 create mode 100644 app/models/custom_event.rb
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_custom_event.rb

Comment 4 CFME Bot 2016-02-01 18:26:03 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/d96a7bc350ee350fbee3be8ce25e3d14a9081996

commit d96a7bc350ee350fbee3be8ce25e3d14a9081996
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jan 11 10:00:27 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Jan 12 14:19:46 2016 -0500

    Create a CustomEvent and pass it to automate.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 app/models/miq_alert.rb | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

Comment 5 CFME Bot 2016-02-01 18:26:08 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/3b213cd6509e8346d38dd7d496b0ff5e569c1702

commit 3b213cd6509e8346d38dd7d496b0ff5e569c1702
Author:     Lucy Fu <lufu>
AuthorDate: Tue Jan 12 09:24:00 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Jan 12 14:19:46 2016 -0500

    Add test cases for alert that sends a Management Event.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 spec/models/miq_alert_spec.rb | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comment 6 CFME Bot 2016-02-01 18:26:12 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/02c7f521b47a4a59d03377acc29945ef5e135f67

commit 02c7f521b47a4a59d03377acc29945ef5e135f67
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jan 11 11:13:34 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Jan 12 14:19:46 2016 -0500

    Alert for events if possible.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 app/models/miq_event.rb | 2 ++
 1 file changed, 2 insertions(+)

Comment 7 CFME Bot 2016-02-01 18:26:17 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/f6c840b64d8f51e3442221928e0e664c54e4757d

commit f6c840b64d8f51e3442221928e0e664c54e4757d
Author:     Lucy Fu <lufu>
AuthorDate: Tue Jan 12 13:11:48 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Jan 12 14:19:46 2016 -0500

    Add /System/Event/CustomEvent/Alert in automate.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 .../Event/CustomEvent/Alert.class/__class__.yaml   | 433 +++++++++++++++++++++
 .../System/Event/CustomEvent/__namespace__.yaml    |  11 +
 2 files changed, 444 insertions(+)
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/Event/CustomEvent/Alert.class/__class__.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/Event/CustomEvent/__namespace__.yaml

Comment 8 CFME Bot 2016-02-10 19:53:42 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=4658374e37a4a04d622e5e554acfb79e840d1bd5

commit 4658374e37a4a04d622e5e554acfb79e840d1bd5
Author:     Lucy Fu <lufu>
AuthorDate: Tue Jan 12 09:24:00 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Feb 9 14:01:05 2016 -0500

    Add test cases for alert that sends a Management Event.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 spec/models/miq_alert_spec.rb | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comment 9 CFME Bot 2016-02-10 19:53:54 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=d6884519c12e945a724334d68d7f3d6976adbc4a

commit d6884519c12e945a724334d68d7f3d6976adbc4a
Author:     Lucy Fu <lufu>
AuthorDate: Tue Jan 12 13:11:48 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Feb 9 14:01:05 2016 -0500

    Add /System/Event/CustomEvent/Alert in automate.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 .../Event/CustomEvent/Alert.class/__class__.yaml   | 433 +++++++++++++++++++++
 .../System/Event/CustomEvent/__namespace__.yaml    |  11 +
 2 files changed, 444 insertions(+)
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/Event/CustomEvent/Alert.class/__class__.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/Event/CustomEvent/__namespace__.yaml

Comment 10 CFME Bot 2016-02-10 19:54:00 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=c82f5a1b06e7acdfaa9bcc89651729cf4579b668

commit c82f5a1b06e7acdfaa9bcc89651729cf4579b668
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jan 11 11:13:34 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Feb 9 14:01:04 2016 -0500

    Alert for events if possible.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 app/models/miq_event.rb | 2 ++
 1 file changed, 2 insertions(+)

Comment 11 CFME Bot 2016-02-10 19:54:12 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=452a1114c4b6507d7450677a72b3142becf32870

commit 452a1114c4b6507d7450677a72b3142becf32870
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jan 11 10:00:27 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Feb 9 14:01:04 2016 -0500

    Create a CustomEvent and pass it to automate.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 app/models/miq_alert.rb | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

Comment 12 CFME Bot 2016-02-10 19:54:19 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=6dd2e90b9d55fb2356dd5157a6113798b097ccf4

commit 6dd2e90b9d55fb2356dd5157a6113798b097ccf4
Author:     Lucy Fu <lufu>
AuthorDate: Mon Jan 11 09:50:43 2016 -0500
Commit:     Lucy Fu <lufu>
CommitDate: Tue Feb 9 14:01:04 2016 -0500

    Add new EventStream subclass CustomEvent for Management Event from Alert.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1296248

 app/models/custom_event.rb                                            | 2 ++
 .../service_models/miq_ae_service_custom_event.rb                     | 4 ++++
 2 files changed, 6 insertions(+)
 create mode 100644 app/models/custom_event.rb
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_custom_event.rb

Comment 14 CFME Bot 2016-02-15 15:36:08 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 15 CFME Bot 2016-02-15 15:36:18 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 16 CFME Bot 2016-02-15 15:36:23 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 17 CFME Bot 2016-02-15 15:36:29 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 18 CFME Bot 2016-02-15 15:36:34 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 19 Lucy Fu 2016-03-16 19:36:29 UTC
*** Bug 1315411 has been marked as a duplicate of this bug. ***

Comment 20 Dmitry Misharov 2016-05-02 10:24:21 UTC
Verified fixed in 5.6.0.4-beta2.3.20160421172650_719e256. My steps to reproduce:

1. Go to Control->Explorer->Alerts
2. Make an alert called "test":
Based On: VM and Instance
What to Evaluate: Nothing
Driving Event: VM Operation: VM Reset
Notification Frequency: 1 Minute
Send Management Event
Event Name: test_alert_management_event
3. Go to Automate->Explorer
4. Make a custom domain with a tree:
Test - Domain
    System - Namespace
        Event - Namespace
            CustomEvent - Namespace
                Management Event (Alert) - Class
                    test_alert_management_event - Instance
5. Create "VM and Instance" alert profile called "test_alert_profile".
6. Assign the "test" alert to "test_alert_profile".
7. Assign "test_alert_profile" to "Selected Infrastructure Providers".
8. Reset any virtual machine which is located in the selected provider.

In automation log you can observe "test_alert_management_event" event invocation. There is no more error "Event "test_alert_management_event" for class was not raised".

Comment 22 errata-xmlrpc 2016-06-29 15:25:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348