Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1114990

Summary: Search: Clusters main tab is not sorted by name by default
Product: [Retired] oVirt Reporter: Allon Mureinik <amureini>
Component: ovirt-engine-webadminAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.5CC: amureini, bazulay, bugs, ecohen, gklein, iheim, mgoldboi, rbalakri, sbonazzo, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: ovirt-3.5.0-beta2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 12:34:23 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
Snapshot of wrongly sorted clusters
none
screen-shots: Clusters are not sorted even if sorted explicitly
none
rest-api Clusters are not sorted as well none

Description Allon Mureinik 2014-07-01 11:52:25 UTC
Description of problem:
The Clusters main tab is not sorted (at least, not in any obvious way).

Version-Release number of selected component (if applicable):
oVirt 3.5 Beta:
[root@vm-18-62 ~]# rpm -qa | grep ovirt
ovirt-engine-setup-base-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-host-deploy-1.3.0-0.0.master.20140629072144.gitdc1f589.el6.noarch
ovirt-engine-jboss-as-7.1.1-1.el6.x86_64
ovirt-engine-webadmin-portal-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-lib-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-setup-plugin-websocket-proxy-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-iso-uploader-3.5.0-0.0.master.20140626.gite89dcdf.el6.noarch
ovirt-engine-userportal-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-sdk-python-3.5.0.0-1.20140605.git1267422.el6.noarch
ovirt-engine-setup-plugin-ovirt-engine-common-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-cli-3.5.0.0-1.20140605.gita11d080.el6.noarch
ovirt-engine-setup-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-tools-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-image-uploader-3.5.0-0.0.master.20140627.gitf19446b.el6.noarch
ovirt-engine-websocket-proxy-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-setup-plugin-ovirt-engine-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-dbscripts-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-log-collector-3.5.0-0.0.master.20140626.git4cb8c7c.el6.noarch
ovirt-engine-extensions-api-impl-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-engine-restapi-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch
ovirt-release35-001-0.0.alpha1.noarch
ovirt-host-deploy-java-1.3.0-0.0.master.20140629072144.gitdc1f589.el6.noarch
ovirt-engine-backend-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. Add clusters and observe the clusters' main tab. In my tests I added clusters with the following names: c3, f3, r5 and derez. Default was prexisting.

Actual results:
Clusters are not sorted. The order displayed is derez, f3, Default, c3 and r5.

Expected results:
Clusters should be sorted.
In this usecase, the order should be c3, Default, derez, f3, r5.

Additional info:

Comment 1 Allon Mureinik 2014-07-01 11:55:01 UTC
Created attachment 913731 [details]
Snapshot of wrongly sorted clusters

Comment 2 Allon Mureinik 2014-07-01 11:57:40 UTC
Additional info: this happens both in the System context and under a DC context.

Comment 3 Einav Cohen 2014-07-07 20:19:45 UTC
Created attachment 916187 [details]
screen-shots: Clusters are not sorted even if sorted explicitly

Comment 4 Einav Cohen 2014-07-07 20:20:12 UTC
Created attachment 916188 [details]
rest-api Clusters are not sorted as well

Comment 5 Einav Cohen 2014-07-07 20:29:27 UTC
the Clusters main tab should be sorted by name by default, based on the default sorting mentioned in SearchObjectAutoCompleter.java line ~329 [1]. however, it seems that something is wrong there and items don't get sorted. 
even when I try to explicitly sort by name (either asc or desc), I still get the non-sorted results (see attachment 916187 [details]). Note that the non-sorted results that I get for 'asc' are different than the unsorted results that I get for 'desc'. 
[specifically in my setup, the default page-size (i.e. the config's "SearchResultsLimit") is 5, not the default 100. shouldn't affect anything]

in the rest-api, I am getting unsorted results as well (see attachment 916188 [details]), however I am not sure if the list of clusters is retrieved there via Search or not, so not sure if relevant here or not. the (unsorted) order of the items in the rest-api doesn't match the (unsorted) order of items in the GUI. 

[1] SearchObjectAutoCompleter.java, line ~329

...
put(SearchObjects.VDC_CLUSTER_OBJ_NAME, new EntitySearchInfo(new ClusterCrossRefAutoCompleter(),
   new ClusterConditionFieldAutoCompleter(),
   "vds_groups_view",
   "vds_groups_storage_domain",
   "vds_group_id",
   "name ASC "));  /* this is the default sorting for the Clusters search in case an explicit "sortby" is not mentioned in the Search string */
....

Comment 6 Eli Mesika 2014-07-22 11:30:09 UTC
I was unable to reproduce on latest and I got the correct results from both UI and REST API.

Will test also on the 3.5 branch

Comment 7 Eli Mesika 2014-07-22 11:44:25 UTC
Can not reproduce on 3.5 branch either (UI & API).
Alon, can you recheck please if you can reproduce that

Comment 8 Allon Mureinik 2014-07-22 15:32:48 UTC
(In reply to Eli Mesika from comment #7)
> Can not reproduce on 3.5 branch either (UI & API).
> Alon, can you recheck please if you can reproduce that

Confirmed, I cannot reproduce with an engine built from source either from the latest master (commit 759ab746647acdf20256642d65dba10d95e1850d) or the latest ovirt-engine-3.5 branch (commit d8c81fe85e504bac006046e3c2fb6d21f3b96648).

I believe that the following commit fixed this issue:

commit 2c16f9ee91bea30ceb3c263e730ffb3b96cb3a4a
Author: Alexander Wels <awels>
Date:   Wed Jun 4 09:25:33 2014 -0400

    webadmin: cluster sorting
    
    - Implemented sorting in cluster main tab
    - Implemented sorting in cluster sub tabs.
    - Fixed bug that would cause invalid SQL to be generated
      when sorting.
    - Fixed bug that caused sorting to be ignored when
      updating hosts and VMs for clusters.
    
    Change-Id: Ib7b2d9938a7e9b7e32238a284c0ddca6568b3bdc
    Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1119873
    Signed-off-by: Alexander Wels <awels>


This was merged to the ovirt-engine-3.5 on July 15th, after beta1 was released and this bug filed against it.

Moving to MODIFIED based on the above info.

Comment 9 Allon Mureinik 2014-07-29 12:22:03 UTC
Verified on ovirt-engine-3.5.0-0.0.master.20140722232058.git8e1babc.el6.noarch.

Comment 10 Sandro Bonazzola 2014-10-17 12:34:23 UTC
oVirt 3.5 has been released and should include the fix for this issue.