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
This commit is contained in:
Murali Reddy 2013-12-16 19:34:32 +05:30
parent df16623533
commit 307e058690
1 changed files with 7 additions and 4 deletions

View File

@ -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<? extends IpAddress> 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<? extends IpAddress> 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<DedicatedResourceVO> dedicatedResources = _dedicatedDao.listByAccountId(accountId);
if (dedicatedResources != null && !dedicatedResources.isEmpty()) {