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 @@ -127,14 +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 {
133- return resp1 .getCapacityType ().compareTo (resp2 .getCapacityType ());
134133 }
134+ // Sort by capacity type only if not already sorted by usage
135+ return (getSortBy () != null ) ? 0 : resp1 .getCapacityType ().compareTo (resp2 .getCapacityType ());
135136 }
136137 });
137138
139+
138140 response .setResponses (capacityResponses );
139141 response .setResponseName (getCommandName ());
140142 this .setResponseObject (response );
You can’t perform that action at this time.
0 commit comments