From 307e0586902bb5b1775652e31bca02c8326e15d9 Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Mon, 16 Dec 2013 19:34:32 +0530 Subject: [PATCH] CLOUDSTACK-5517: NPE observed during "release portable IPs" as part of account cleanup ensure proper portable ip address are released as part of account cleanup --- server/src/com/cloud/user/AccountManagerImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 8ea495f2798..22abf785be6 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -750,11 +750,14 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M // release account specific acquired portable IP's. Since all the portable IP's must have been already // disassociated with VPC/guest network (due to deletion), so just mark portable IP as free. - List portableIpsToRelease = _ipAddressDao.listByAccount(accountId); - for (IpAddress ip : portableIpsToRelease) { - s_logger.debug("Releasing portable ip " + ip + " as a part of account id=" + accountId + " cleanup"); - _ipAddrMgr.releasePortableIpAddress(ip.getId()); + List ipsToRelease = _ipAddressDao.listByAccount(accountId); + for (IpAddress ip : ipsToRelease) { + if (ip.isPortable()) { + s_logger.debug("Releasing portable ip " + ip + " as a part of account id=" + accountId + " cleanup"); + _ipAddrMgr.releasePortableIpAddress(ip.getId()); + } } + // release dedication if any List dedicatedResources = _dedicatedDao.listByAccountId(accountId); if (dedicatedResources != null && !dedicatedResources.isEmpty()) {