mirror of https://github.com/apache/cloudstack.git
bug 8263: allowing a private zone to be made public
This commit is contained in:
parent
bda0b09441
commit
5d1d9ec387
|
|
@ -62,6 +62,9 @@ public class UpdateZoneCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the Zone")
|
||||
private String vlan;
|
||||
|
||||
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="updates a private zone to public if set, but not vice-versa")
|
||||
private Boolean isPublic;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -98,6 +101,9 @@ public class UpdateZoneCmd extends BaseCmd {
|
|||
return vlan;
|
||||
}
|
||||
|
||||
public Boolean isPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -944,6 +944,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
Long userId = UserContext.current().getCallerUserId();
|
||||
int startVnetRange = 0;
|
||||
int stopVnetRange = 0;
|
||||
Boolean isPublic = cmd.isPublic();
|
||||
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(User.UID_SYSTEM);
|
||||
|
|
@ -1053,6 +1054,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
zone.setVnet(vnetRange);
|
||||
}
|
||||
|
||||
//update a private zone to public; not vice versa
|
||||
if(isPublic != null && isPublic) {
|
||||
zone.setDomainId(null);
|
||||
zone.setDomain(null);
|
||||
}
|
||||
|
||||
if (!_zoneDao.update(zoneId, zone)) {
|
||||
throw new CloudRuntimeException("Failed to edit zone. Please contact Cloud Support.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue