|
84 | 84 | import com.cloud.api.commands.ListStoragePoolsCmd; |
85 | 85 | import com.cloud.api.commands.ListSystemVMsCmd; |
86 | 86 | import com.cloud.api.commands.ListTemplatesCmd; |
87 | | -import com.cloud.api.commands.ListTopConsumedResources; |
88 | 87 | import com.cloud.api.commands.ListVMGroupsCmd; |
89 | 88 | import com.cloud.api.commands.ListVlanIpRangesCmd; |
90 | 89 | import com.cloud.api.commands.ListZonesByCmd; |
@@ -1939,7 +1938,7 @@ public List<? extends Alert> searchForAlerts(ListAlertsCmd cmd) { |
1939 | 1938 | } |
1940 | 1939 |
|
1941 | 1940 | @Override |
1942 | | - public List<CapacityVO> listTopConsumedResources(ListTopConsumedResources cmd) { |
| 1941 | + public List<CapacityVO> listTopConsumedResources(ListCapacityCmd cmd) { |
1943 | 1942 |
|
1944 | 1943 | Integer capacityType = cmd.getType(); |
1945 | 1944 | Long zoneId = cmd.getZoneId(); |
@@ -2042,11 +2041,16 @@ public List<CapacityVO> listCapacities(ListCapacityCmd cmd) { |
2042 | 2041 | Long podId = cmd.getPodId(); |
2043 | 2042 | Long clusterId = cmd.getClusterId(); |
2044 | 2043 | Boolean fetchLatest = cmd.getFetchLatest(); |
| 2044 | + Boolean sortByUsage = cmd.getSortByUsage(); |
2045 | 2045 |
|
2046 | 2046 | zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId); |
2047 | 2047 | if (fetchLatest != null && fetchLatest){ |
2048 | 2048 | _alertMgr.recalculateCapacity(); |
2049 | 2049 | } |
| 2050 | + |
| 2051 | + if (sortByUsage != null && sortByUsage){ |
| 2052 | + return listTopConsumedResources(cmd); |
| 2053 | + } |
2050 | 2054 | List<SummedCapacity> summedCapacities = _capacityDao.findCapacityBy(capacityType, zoneId, podId, clusterId); |
2051 | 2055 | List<CapacityVO> capacities = new ArrayList<CapacityVO>(); |
2052 | 2056 |
|
|
0 commit comments