[ https://issues.apache.org/jira/browse/CLOUDSTACK-974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13552808#comment-13552808 ] Joe Brockmeier commented on CLOUDSTACK-974: ------------------------------------------- Unless there's a patch forthcoming in the next day or so, I'm moving this to 4.0.2 since it's a minor issue. > listServiceOfferings doesn't sort by sortKey for non-root users > --------------------------------------------------------------- > > Key: CLOUDSTACK-974 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-974 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Components: API > Affects Versions: 4.0.0, 4.0.1 > Reporter: Wido den Hollander > Priority: Minor > Fix For: 4.0.2 > > > I was just notified by a colleague that there is different behaviour between the Admin UI and User UI. > When you list all Service Offerings in the Admin interface they get sorted by sortKey descending. > If you go and create an Instance as a user through the wizard the Service Offerings aren't sorted, they are in the order like they are in the database. > I logged the MySQL queries and they are: > ** ADMIN ** > SELECT disk_offering.id, disk_offering.domain_id, disk_offering.unique_name, disk_offering.name, disk_offering.display_text, disk_offering.disk_size, disk_offering.tags, disk_offering.type, disk_offering.removed, disk_offering.created, disk_offering.recreatable, disk_offering.use_local_storage, disk_offering.system_use, disk_offering.customized, disk_offering.uuid, disk_offering.sort_key, service_offering.cpu, service_offering.speed, service_offering.ram_size, service_offering.nw_rate, service_offering.mc_rate, service_offering.ha_enabled, service_offering.limit_cpu_use, service_offering.host_tag, service_offering.default_use, service_offering.vm_type, service_offering.sort_key > FROM service_offering INNER JOIN disk_offering ON service_offering.id=disk_offering.id > WHERE disk_offering.type='Service' > AND disk_offering.system_use = 0 > AND disk_offering.system_use = 0 > AND disk_offering.removed IS NULL > ORDER BY service_offering.sort_key DESC > ** USER ** > SELECT disk_offering.id, disk_offering.domain_id, disk_offering.unique_name, disk_offering.name, disk_offering.display_text, disk_offering.disk_size, disk_offering.tags, disk_offering.type, disk_offering.removed, disk_offering.created, disk_offering.recreatable, disk_offering.use_local_storage, disk_offering.system_use, disk_offering.customized, disk_offering.uuid, disk_offering.sort_key, service_offering.cpu, service_offering.speed, service_offering.ram_size, service_offering.nw_rate, service_offering.mc_rate, service_offering.ha_enabled, service_offering.limit_cpu_use, service_offering.host_tag, service_offering.default_use, service_offering.vm_type, service_offering.sort_key > FROM service_offering INNER JOIN disk_offering ON service_offering.id=disk_offering.id > WHERE disk_offering.type='Service' > AND disk_offering.domain_id IS NULL > AND disk_offering.system_use = 0 > AND disk_offering.removed IS NULL > To me it seems this goes wrong in ManagementServerImpl.searchForServiceOfferings: > Filter searchFilter = new Filter(ServiceOfferingVO.class, "sortKey", isAscending, cmd.getStartIndex(), cmd.getPageSizeVal()); > getStartIndex and getPageSizeVal are both NULL since the user UI doesn't add page nor pagesize to the API request. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira