mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-04 20:29:27 +01:00
CLOUDSTACK-5916: associateIpAddress leaves an IP in allocating state
This commit is contained in:
parent
20fd2769a9
commit
85d0f8f93a
@ -3865,10 +3865,16 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
||||
|
||||
Network network = _networksDao.findById(networkId);
|
||||
if (network == null) {
|
||||
// release the acquired IP addrress before throwing the exception
|
||||
// else it will always be in allocating state
|
||||
releaseIpAddress(ipId);
|
||||
throw new InvalidParameterValueException("Invalid network id is given");
|
||||
}
|
||||
|
||||
if (network.getVpcId() != null) {
|
||||
// release the acquired IP addrress before throwing the exception
|
||||
// else it will always be in allocating state
|
||||
releaseIpAddress(ipId);
|
||||
throw new InvalidParameterValueException("Can't assign ip to the network directly when network belongs" + " to VPC.Specify vpcId to associate ip address to VPC");
|
||||
}
|
||||
return _ipAddrMgr.associateIPToGuestNetwork(ipId, networkId, true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user