mirror of https://github.com/apache/cloudstack.git
Allow disassociating sourceNat ip address when SourceNat service is not supported by corresponding network any longer (can be disabled during the network offering upgrade)
This commit is contained in:
parent
7b51782163
commit
1fe3bc066b
|
|
@ -30,6 +30,7 @@ import com.cloud.async.AsyncJob;
|
|||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@Implementation(description="Disassociates an ip address from the account.", responseObject=SuccessResponse.class)
|
||||
|
|
@ -96,6 +97,10 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
}
|
||||
ownerId = ip.getAccountId();
|
||||
}
|
||||
|
||||
if (ownerId == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
return ownerId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1588,8 +1588,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
if (ipVO.getAllocatedToAccountId() != null) {
|
||||
_accountMgr.checkAccess(caller, null, ipVO);
|
||||
}
|
||||
|
||||
Network associatedNetwork = getNetwork(ipVO.getAssociatedWithNetworkId());
|
||||
|
||||
if (ipVO.isSourceNat()) {
|
||||
if (isServiceSupportedByNetworkOffering(associatedNetwork.getNetworkOfferingId(), Service.SourceNat)) {
|
||||
throw new IllegalArgumentException("ip address is used for source nat purposes and can not be disassociated.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue