mirror of https://github.com/apache/cloudstack.git
vpc: prevent sourcenat ip disassociation for an active vpc (#6664)
Fixes #6663 Source NAT IP should not be disassociated from an active vpc
This commit is contained in:
parent
814dbbaf86
commit
cd37b135a0
|
|
@ -1075,7 +1075,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
if (networkId != null) {
|
||||
guestNetwork = getNetwork(networkId);
|
||||
}
|
||||
if (ipVO.isSourceNat() && guestNetwork != null && guestNetwork.getState() != Network.State.Allocated) {
|
||||
Vpc vpc = null;
|
||||
if (ipVO.getVpcId() != null) {
|
||||
vpc = _vpcMgr.getActiveVpc(ipVO.getVpcId());
|
||||
}
|
||||
if (ipVO.isSourceNat() && ((guestNetwork != null && guestNetwork.getState() != Network.State.Allocated) || vpc != null)) {
|
||||
throw new IllegalArgumentException("ip address is used for source nat purposes and can not be disassociated.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue