diff --git a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java index 8188bc096ac..873b71c115e 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java @@ -34,7 +34,6 @@ import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.NetworkOfferingResponse; import com.cloud.offering.NetworkOffering; -import com.cloud.offering.NetworkOffering.Availability; import com.cloud.user.Account; @Implementation(description="Updates a network offering.", responseObject=NetworkOfferingResponse.class) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index f48e8a50a87..b560bab75c8 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -3282,6 +3282,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } if (networkOfferingId != oldNetworkOfferingId) { + //don't allow to update shared network + if (offering.getGuestType() != GuestType.Isolated) { + throw new InvalidParameterValueException("NetworkOfferingId can be upgraded only for the network of type " + GuestType.Isolated); + } + //check if the network is upgradable if (!canUpgrade(oldNetworkOfferingId, networkOfferingId)) { throw new InvalidParameterValueException("Can't upgrade from network offering " + oldNetworkOfferingId + " to " + networkOfferingId + "; check logs for more information"); @@ -3299,6 +3304,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag + "and the hyphen ('-'); can't start or end with \"-\""); } + //don't allow to update shared network + if (offering.getGuestType() == GuestType.Shared) { + throw new InvalidParameterValueException("Can't upgrade the networkDomain for the network of type " + GuestType.Isolated); + } + long offeringId = oldNetworkOfferingId; if (networkOfferingId != null) { offeringId = networkOfferingId; @@ -3532,6 +3542,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId); NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId); + //can upgrade only Isolated networks + //security group service should be the same if (areServicesSupportedByNetworkOffering(oldNetworkOfferingId, Service.SecurityGroup) != areServicesSupportedByNetworkOffering(newNetworkOfferingId, Service.SecurityGroup)) { s_logger.debug("Offerings " + newNetworkOfferingId + " and " + oldNetworkOfferingId + " have different securityGroupProperty, can't upgrade");