File tree Expand file tree Collapse file tree
api/src/main/java/org/apache/cloudstack/api/command/admin/resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,16 +127,16 @@ public void execute() {
127127 Collections .sort (capacityResponses , new Comparator <CapacityResponse >() {
128128 public int compare (CapacityResponse resp1 , CapacityResponse resp2 ) {
129129 int res = resp1 .getZoneName ().compareTo (resp2 .getZoneName ());
130+ // Group by zone
130131 if (res != 0 ) {
131132 return res ;
132- } else if (getSortBy () != null ) {
133- return 0 ;
134- } else {
135- return resp1 .getCapacityType ().compareTo (resp2 .getCapacityType ());
136133 }
134+ // Sort by capacity type only if not already sorted by usage
135+ return (getSortBy () != null ) ? 0 : resp1 .getCapacityType ().compareTo (resp2 .getCapacityType ());
137136 }
138137 });
139138
139+
140140 response .setResponses (capacityResponses );
141141 response .setResponseName (getCommandName ());
142142 this .setResponseObject (response );
You can’t perform that action at this time.
0 commit comments