diff --git a/api/src/com/cloud/api/commands/UpdateZoneCmd.java b/api/src/com/cloud/api/commands/UpdateZoneCmd.java index 2f2064ddc7d..75ef5246617 100644 --- a/api/src/com/cloud/api/commands/UpdateZoneCmd.java +++ b/api/src/com/cloud/api/commands/UpdateZoneCmd.java @@ -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/////////////////// ///////////////////////////////////////////////////// diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 56c7121d044..d983c6ee6b8 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -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."); }