File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
api/src/main/java/org/apache/cloudstack/api/command/admin/resource Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -132,14 +132,16 @@ public void execute() {
132132 Collections .sort (capacityResponses , new Comparator <CapacityResponse >() {
133133 public int compare (CapacityResponse resp1 , CapacityResponse resp2 ) {
134134 int res = resp1 .getZoneName ().compareTo (resp2 .getZoneName ());
135+ // Group by zone
135136 if (res != 0 ) {
136137 return res ;
137- } else {
138- return resp1 .getCapacityType ().compareTo (resp2 .getCapacityType ());
139138 }
139+ // Sort by capacity type only if not already sorted by usage
140+ return (getSortBy () != null ) ? 0 : resp1 .getCapacityType ().compareTo (resp2 .getCapacityType ());
140141 }
141142 });
142143
144+
143145 response .setResponses (capacityResponses );
144146 response .setResponseName (getCommandName ());
145147 this .setResponseObject (response );
You can’t perform that action at this time.
0 commit comments