Bug 1016855

Summary: Alert notification sender, resource operation, relative resource type filter missing many resource types
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: Monitoring - AlertsAssignee: Simeon Pinder <spinder>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: JON 3.1.2CC: skondkar
Target Milestone: ER03   
Target Release: JON 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1016859 (view as bug list) Environment:
Last Closed: 2014-01-02 20:33:51 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:
Bug Depends On:    
Bug Blocks: 1016859    

Description Larry O'Leary 2013-10-08 20:04:21 UTC
Description of problem:
When defining an alert notification sender of type resource operation using a relative resource type, the type filter drop-down can contain multiple resource types with the same name but from different plug-ins and parent types without any way to distinguish the differences.

Version-Release number of selected component (if applicable):
4.4.0.JON312GA

How reproducible:
Always

Steps to Reproduce:

1.  Start JBoss ON 3.1.2 system.
2.  Import platform into inventory.
3.  Remove and purge agent plug-in 'Script'.
    1.  Navigate to Administration > Configuration / Agent Plugins.
    2.  Select the row for the plug-in with the name _Script_.
    3.  Click _Delete_ button.
    4.  Click _Yes_ to confirm.
    5.  Click _Show Deleted_ button.
    6.  Select the row for the plug-in with the name _Script_.
    7.  Click _Purge_ button.
4.  Refresh the plug-in page until the _Script_ plug-in is no longer visible.
    This may take a few minutes.
5.  Re-install the script plug-in by locating rhq-script-plugin-4.4.0.JON312GA.jar from the original server installation archive and uploading it using the _Upload Plugin_ and _Scan for Updates_ functions from the agent plug-ins page.
6.  Attempt to create a new alert definition for the platform resource:

    _General Properties_
        *Name*: `Test Alert`
        
    _Notifications_
        *Notification Sender*:  _Resource Operations_
        *Resource Selection Mode*:  _Relative Resource_ 
        *Start Search From*:    <platform>
        *Then Filter By*:   _Script Server_


Actual results:
*Then Filter By* does not contain the _Script Server_ resource type.

Expected results:
*Then Filter By* should contain the _Script Server_ resource type.

Additional Info:
This is a result of the default paging limit being used when executing the queries to retrieve the resource type list. By default, the paging limit is 200. With a default install using all plug-ins, there are well over 200 resource types so only the first 200 are returned/available to the drop-down. The 200 is further reduced by removing any resource type that does not have an operation. Therefore, even though 200 results are returned, it is not surprising to see only 50 or 70 or 88 resource types in the drop-down list.

A general clean-up commit was performed in https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=122db27657ac9b66573c2695cd38de76b42045c6 which removes the paging limit from methods that were intended to return a complete list. For example, in this case, ResourceTypeManagerBean.getAllResourceTypeDescendants:

diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
index f93a935..d4f9bb9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
@@ -525,6 +525,8 @@ public class ResourceTypeManagerBean implements ResourceTypeManagerLocal, Resour
if (sawTopLevelServer) {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterCategory(ResourceCategory.PLATFORM);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceType> platforms = findResourceTypesByCriteria(subject, criteria);
results.addAll(platforms);
}
@@ -539,6 +541,8 @@ public class ResourceTypeManagerBean implements ResourceTypeManagerLocal, Resour
if (first.getCategory() == ResourceCategory.PLATFORM) {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceType> allResourceTypes = findResourceTypesByCriteria(subject, criteria);
List<ResourceType> results = new ArrayList<ResourceType>();

Comment 1 Larry O'Leary 2013-10-08 20:11:10 UTC
Putting this ON_QA and targeting to ER03 as this was already done in a previous build and just needs to be confirmed/tested.

Comment 3 Sunil Kondkar 2013-10-18 10:45:30 UTC
Verified on Version: 3.2.0.ER3 Build Number: c0742ed:90dd474

Followed the steps and verified that 'Then Filter By field contains the 'Script Server' resource type after re-install of the script plug-in.