mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix listCapacity sort by usage (#11316)
This commit is contained in:
parent
7506a547af
commit
294aef5ecf
@ -127,14 +127,16 @@ public class ListCapacityCmd extends BaseListCmd {
|
||||
Collections.sort(capacityResponses, new Comparator<CapacityResponse>() {
|
||||
public int compare(CapacityResponse resp1, CapacityResponse resp2) {
|
||||
int res = resp1.getZoneName().compareTo(resp2.getZoneName());
|
||||
// Group by zone
|
||||
if (res != 0) {
|
||||
return res;
|
||||
} else {
|
||||
return resp1.getCapacityType().compareTo(resp2.getCapacityType());
|
||||
}
|
||||
// Sort by capacity type only if not already sorted by usage
|
||||
return (getSortBy() != null) ? 0 : resp1.getCapacityType().compareTo(resp2.getCapacityType());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
response.setResponses(capacityResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user