mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3981. ListAccounts always sets 'networkTotal' to 0.
Add vpc resource count to the response. And set the right values for network resource count.
This commit is contained in:
parent
4c5a302219
commit
f744614769
|
|
@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.user.Account;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@EntityReference(value = Account.class)
|
||||
|
|
@ -189,7 +190,7 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
|
|||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.id;
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
|
|
@ -351,7 +352,22 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
|
|||
public void setNetworkAvailable(String networkAvailable) {
|
||||
this.networkAvailable = networkAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcLimit(String vpcLimit) {
|
||||
this.vpcLimit = networkLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcTotal(Long vpcTotal) {
|
||||
this.vpcTotal = vpcTotal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcAvailable(String vpcAvailable) {
|
||||
this.vpcAvailable = vpcAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCpuLimit(String cpuLimit) {
|
||||
this.cpuLimit = cpuLimit;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value=Project.class)
|
||||
@SuppressWarnings("unused")
|
||||
|
|
@ -182,7 +183,7 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
|
|||
}
|
||||
|
||||
public void setOwner(String owner) {
|
||||
this.ownerName = owner;
|
||||
ownerName = owner;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
|
|
@ -194,7 +195,7 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
|
|||
}
|
||||
|
||||
public void addTag(ResourceTagResponse tag){
|
||||
this.tags.add(tag);
|
||||
tags.add(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -296,7 +297,22 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
|
|||
public void setNetworkAvailable(String networkAvailable) {
|
||||
this.networkAvailable = networkAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcLimit(String vpcLimit) {
|
||||
this.vpcLimit = networkLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcTotal(Long vpcTotal) {
|
||||
this.vpcTotal = vpcTotal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcAvailable(String vpcAvailable) {
|
||||
this.vpcAvailable = vpcAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCpuLimit(String cpuLimit) {
|
||||
this.cpuLimit = cpuLimit;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ public interface ResourceLimitAndCountResponse {
|
|||
|
||||
public void setNetworkAvailable(String networkAvailable);
|
||||
|
||||
public void setVpcLimit(String vpcLimit);
|
||||
|
||||
public void setVpcTotal(Long vpcTotal);
|
||||
|
||||
public void setVpcAvailable(String vpcAvailable);
|
||||
|
||||
public void setCpuLimit(String cpuLimit);
|
||||
|
||||
public void setCpuTotal(Long cpuTotal);
|
||||
|
|
|
|||
|
|
@ -173,9 +173,9 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
|
|||
String vpcLimitDisplay = (accountIsAdmin || vpcLimit == -1) ? "Unlimited" : String.valueOf(vpcLimit);
|
||||
long vpcTotal = (account.getVpcTotal() == null) ? 0 : account.getVpcTotal();
|
||||
String vpcAvail = (accountIsAdmin || vpcLimit == -1) ? "Unlimited" : String.valueOf(vpcLimit - vpcTotal);
|
||||
response.setNetworkLimit(vpcLimitDisplay);
|
||||
response.setNetworkTotal(vpcTotal);
|
||||
response.setNetworkAvailable(vpcAvail);
|
||||
response.setVpcLimit(vpcLimitDisplay);
|
||||
response.setVpcTotal(vpcTotal);
|
||||
response.setVpcAvailable(vpcAvail);
|
||||
|
||||
//get resource limits for cpu cores
|
||||
long cpuLimit = ApiDBUtils.findCorrectResourceLimit(account.getCpuLimit(), account.getType(), ResourceType.cpu);
|
||||
|
|
|
|||
Loading…
Reference in New Issue