Updated Branches: refs/heads/master 20fd2769a -> 85d0f8f93
CLOUDSTACK-5916: associateIpAddress leaves an IP in allocating state Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85d0f8f9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85d0f8f9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85d0f8f9 Branch: refs/heads/master Commit: 85d0f8f93aaf118e0597fcbba0f4cf06efa9df1f Parents: 20fd276 Author: Saksham Srivastava <saksham.srivast...@citrix.com> Authored: Tue Jan 21 13:36:05 2014 +0530 Committer: Murali Reddy <muralimmre...@gmail.com> Committed: Thu Jan 30 17:11:02 2014 +0530 ---------------------------------------------------------------------- server/src/com/cloud/network/NetworkServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d0f8f9/server/src/com/cloud/network/NetworkServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index d02f176..40c5b64 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -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);