mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-18 11:34:23 +01:00
Don't allow to upgrade networkOfferingId and networkDomain for Shared network offerings
This commit is contained in:
parent
8836a08e60
commit
eac54e3ad4
@ -34,7 +34,6 @@ import com.cloud.api.Parameter;
|
|||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.api.response.NetworkOfferingResponse;
|
import com.cloud.api.response.NetworkOfferingResponse;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.offering.NetworkOffering.Availability;
|
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
|
|
||||||
@Implementation(description="Updates a network offering.", responseObject=NetworkOfferingResponse.class)
|
@Implementation(description="Updates a network offering.", responseObject=NetworkOfferingResponse.class)
|
||||||
|
|||||||
@ -3282,6 +3282,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (networkOfferingId != oldNetworkOfferingId) {
|
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
|
//check if the network is upgradable
|
||||||
if (!canUpgrade(oldNetworkOfferingId, networkOfferingId)) {
|
if (!canUpgrade(oldNetworkOfferingId, networkOfferingId)) {
|
||||||
throw new InvalidParameterValueException("Can't upgrade from network offering " + oldNetworkOfferingId + " to " + networkOfferingId + "; check logs for more information");
|
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 \"-\"");
|
+ "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;
|
long offeringId = oldNetworkOfferingId;
|
||||||
if (networkOfferingId != null) {
|
if (networkOfferingId != null) {
|
||||||
offeringId = networkOfferingId;
|
offeringId = networkOfferingId;
|
||||||
@ -3532,6 +3542,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);
|
NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);
|
||||||
NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId);
|
NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId);
|
||||||
|
|
||||||
|
//can upgrade only Isolated networks
|
||||||
|
|
||||||
//security group service should be the same
|
//security group service should be the same
|
||||||
if (areServicesSupportedByNetworkOffering(oldNetworkOfferingId, Service.SecurityGroup) != areServicesSupportedByNetworkOffering(newNetworkOfferingId, Service.SecurityGroup)) {
|
if (areServicesSupportedByNetworkOffering(oldNetworkOfferingId, Service.SecurityGroup) != areServicesSupportedByNetworkOffering(newNetworkOfferingId, Service.SecurityGroup)) {
|
||||||
s_logger.debug("Offerings " + newNetworkOfferingId + " and " + oldNetworkOfferingId + " have different securityGroupProperty, can't upgrade");
|
s_logger.debug("Offerings " + newNetworkOfferingId + " and " + oldNetworkOfferingId + " have different securityGroupProperty, can't upgrade");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user