Bug 825318

Summary: search bar code for availability querying looks broken
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: SearchBarAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.4CC: hrupp, skondkar
Target Milestone: ---   
Target Release: JON 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 820716 Environment:
Last Closed: 2013-09-03 11:13:42 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 820716    
Bug Blocks: 782579    

Description John Mazzitelli 2012-05-25 12:23:23 EDT
+++ This bug was initially created as a clone of Bug #820716 +++

see this:

 org.rhq.enterprise.server.search.translation.GroupSearchTranslator.getSearchFragment

specifically this code:

            return new SearchFragment( //
                SearchFragment.Type.PRIMARY_KEY_SUBQUERY, "SELECT rg.id" //
                    + "  FROM ResourceGroup rg " //
                    + " WHERE ( SELECT AVG( iavail.availabilityType ) " //
                    + "           FROM rg.explicitResources ires " //
                    + "           JOIN ires.currentAvailability iavail ) " + numericAvailabilityFragment);


We can't do AVG on avail type anymore - since we have more than 0 (down) and 1 (up). We have 2 (unknown) and 3 (disabled) so averaging won't give us what we are expecting.

I think this is code that lets us use "availability" in the search bar to search for availability=UP and availabiltiy=DOWN (and whatever else we allow.. MIXED??? DISABLED??? UNKNOWN???)

We need to double check the search bar ability to query on avaialbilty and get it to work for groups.
Comment 1 John Mazzitelli 2012-05-25 12:24:46 EDT
Need to cherry pick to the release branch the following:

** git commit to master f4c13d0 - this is some new unit tests for the availability keyword in the search expression

** git commit to master: 6641616 - when viewing group lists, in the search bar, you can now specify "availability=down" for example and the only groups you will see are those groups where all members are down. Same with "up" and "disabled". This also supports != as before.
Comment 2 John Mazzitelli 2012-05-25 12:44:51 EDT
two cherry picks to release/3.1.x branch:

310e054924f52685904ab841d557c2f1b58aed24
d9f41878fbfff7659e62a82a7f7195142e11693d

the latter caused a conflict so I had to manually fix it. see https://bugzilla.redhat.com/show_bug.cgi?id=820432#c4 from bug 820432
Comment 3 John Mazzitelli 2012-05-25 14:24:55 EDT
fix a problem with conflicts during the cherry pick: release/jon3.1.x commit: b3866debd52593cce9f9bf10bd17df8e3b3da0bc
Comment 4 Sunil Kondkar 2012-05-30 07:04:52 EDT
Verified on Version: 3.1.0.CR1 Build Number: 4bc4270:1b85993

Verified below availabilty search criterias using operators ( = , == , != , !== ) on resources and groups  :
availability=up
availability=down
availability=disabled
availability=unknown 

The search results display correct results ( Ex: for "availability=down" , only groups with all members down appear in search results)

Observed one issue with groups without members having unknown status. This group appears in every availabilty search result. I filed a new bug#826493 to address this.

Marking this bug as verified.
Comment 5 Heiko W. Rupp 2013-09-03 11:13:42 EDT
Bulk closing of old issues in VERIFIED state.