Merge remote-tracking branch 'apache/4.17' into main

This commit is contained in:
Abhishek Kumar 2022-08-25 10:09:11 +05:30
commit f76b6c686d

View File

@ -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.");
}