mirror of https://github.com/apache/cloudstack.git
parent
6e2aee8320
commit
b2c7986ba3
|
|
@ -115,7 +115,6 @@ public class ApiConstants {
|
|||
public static final String MODE = "mode";
|
||||
public static final String NAME = "name";
|
||||
public static final String METHOD_NAME = "methodname";
|
||||
public static final String LIST_TOP_USED = "listtopused";
|
||||
public static final String NETWORK_DOMAIN = "networkdomain";
|
||||
public static final String NETMASK = "netmask";
|
||||
public static final String NEW_NAME = "newname";
|
||||
|
|
|
|||
|
|
@ -59,10 +59,7 @@ public class ListCapacityCmd extends BaseListCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.FETCH_LATEST, type=CommandType.BOOLEAN, since="3.0.0", description="recalculate capacities and fetch the latest")
|
||||
private Boolean fetchLatest;
|
||||
|
||||
@Parameter(name=ApiConstants.LIST_TOP_USED, type=CommandType.BOOLEAN, since="3.0.0", description="if true then lists the top consumed enabled resources at Zone/Pod/Cluster level ordered by percentage.")
|
||||
private Boolean listTopUsed;
|
||||
|
||||
|
||||
@Parameter(name=ApiConstants.TYPE, type=CommandType.INTEGER, description="lists capacity by type" +
|
||||
"* CAPACITY_TYPE_MEMORY = 0" +
|
||||
"* CAPACITY_TYPE_CPU = 1" +
|
||||
|
|
@ -77,7 +74,7 @@ public class ListCapacityCmd extends BaseListCmd {
|
|||
|
||||
private Integer type;
|
||||
|
||||
@Parameter(name=ApiConstants.SORT_BY, type=CommandType.STRING, description="Sort the results. Available values: Usage")
|
||||
@Parameter(name=ApiConstants.SORT_BY, type=CommandType.STRING, since="3.0.0", description="Sort the results. Available values: Usage")
|
||||
private String sortBy;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -109,17 +106,13 @@ public class ListCapacityCmd extends BaseListCmd {
|
|||
if (sortBy.equalsIgnoreCase("usage")) {
|
||||
return sortBy;
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Only Usage value is supported for sortBy parameter in Acton release");
|
||||
throw new InvalidParameterValueException("Only value supported for sortBy parameter is : usage");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean getlistTopUsed() {
|
||||
return listTopUsed;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -2051,16 +2051,12 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
Long podId = cmd.getPodId();
|
||||
Long clusterId = cmd.getClusterId();
|
||||
Boolean fetchLatest = cmd.getFetchLatest();
|
||||
Boolean listTopUsed = cmd.getlistTopUsed();
|
||||
|
||||
zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
|
||||
if (fetchLatest != null && fetchLatest){
|
||||
_alertMgr.recalculateCapacity();
|
||||
}
|
||||
|
||||
if (listTopUsed != null && listTopUsed){
|
||||
return listTopConsumedResources(cmd);
|
||||
}
|
||||
|
||||
List<SummedCapacity> summedCapacities = _capacityDao.findCapacityBy(capacityType, zoneId, podId, clusterId);
|
||||
List<CapacityVO> capacities = new ArrayList<CapacityVO>();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue