bug 8831: no need for "isdedicatedtodomain" and "dedicateddomainid" parameters. If 1) network is private, return account/domainId 2)If network is shared for specific domain, return domainId only 3) If network is shared in zone, don't return account/domainId

status 8831: resolved fixed
This commit is contained in:
alena 2011-03-28 16:47:27 -07:00
parent b8233a9c4d
commit 65a083b1db
3 changed files with 10 additions and 28 deletions

View File

@ -97,12 +97,6 @@ public class NetworkResponse extends BaseResponse{
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is enabled, false otherwise")
private Boolean isSecurityGroupEnabled;
@SerializedName("isdedicatedtodomain") @Param(description="true if network is dedicated to specific domain")
private Boolean isDedicatedToDomain;
@SerializedName("dedicateddomainid") @Param(description="the id of domain network dedicated to")
private Long dedicatedDomainId;
public Long getId() {
return id;
@ -343,21 +337,5 @@ public class NetworkResponse extends BaseResponse{
public void setIsSecurityGroupEnabled(Boolean sgEnabled) {
this.isSecurityGroupEnabled = sgEnabled;
}
public Boolean getIsDedicatedToDomain() {
return isDedicatedToDomain;
}
public void setIsDedicatedToDomain(Boolean isDedicatedToDomain) {
this.isDedicatedToDomain = isDedicatedToDomain;
}
public Long getDedicatedDomainId() {
return dedicatedDomainId;
}
public void setDedicatedDomainId(Long dedicatedDomainId) {
this.dedicatedDomainId = dedicatedDomainId;
}
}

View File

@ -2350,7 +2350,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setServices(serviceResponses);
Account account = ApiDBUtils.findAccountById(network.getAccountId());
if (account != null) {
if (account != null && !network.getIsShared()) {
response.setAccountName(account.getAccountName());
Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
response.setDomainId(domain.getId());
@ -2359,11 +2359,10 @@ public class ApiResponseHelper implements ResponseGenerator {
Long dedicatedDomainId = ApiDBUtils.getDedicatedNetworkDomain(network.getId());
if (dedicatedDomainId != null) {
response.setIsDedicatedToDomain(true);
response.setDedicatedDomainId(dedicatedDomainId);
} else {
response.setIsDedicatedToDomain(false);
}
Domain domain = ApiDBUtils.findDomainById(dedicatedDomainId);
response.setDomainId(dedicatedDomainId);
response.setDomain(domain.getName());
}
response.setObjectName("network");
return response;

View File

@ -1608,6 +1608,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
}
//if network is shared, defult its owner to be system
if (isShared) {
owner = _accountMgr.getSystemAccount();
}
// Don't allow to create network with vlan that already exists in the system
if (vlanId != null) {
String uri = "vlan://" + vlanId;