diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 3e9ed681304..c5355701a40 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -998,6 +998,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag s_logger.debug("Destroying # of vms (accountId=" + accountId + "): " + vms.size()); } + //no need to catch exception at this place as expunging vm should pass in order to perform further cleanup for (UserVmVO vm : vms) { if (!_vmMgr.expunge(vm, callerUserId, caller)) { s_logger.error("Unable to destroy vm: " + vm.getId()); @@ -1011,7 +1012,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag if (!volume.getState().equals(Volume.State.Destroy)) { try { _storageMgr.destroyVolume(volume); - } catch (ConcurrentOperationException ex) { + } catch (Exception ex) { s_logger.warn("Failed to cleanup volumes as a part of account id=" + accountId + " cleanup due to Exception: ", ex); accountCleanupNeeded = true; } @@ -1069,7 +1070,11 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag } return true; - } finally { + } catch (Exception ex) { + s_logger.warn("Failed to cleanup account " + account + " due to ", ex); + accountCleanupNeeded = true; + return true; + }finally { s_logger.info("Cleanup for account " + account.getId() + (accountCleanupNeeded ? " is needed." : " is not needed.")); if (accountCleanupNeeded) { _accountDao.markForCleanup(accountId); diff --git a/server/src/com/cloud/user/dao/AccountDaoImpl.java b/server/src/com/cloud/user/dao/AccountDaoImpl.java index 57ad47018ce..f88bff831db 100755 --- a/server/src/com/cloud/user/dao/AccountDaoImpl.java +++ b/server/src/com/cloud/user/dao/AccountDaoImpl.java @@ -228,7 +228,9 @@ public class AccountDaoImpl extends GenericDaoBase implements A AccountVO account = findByIdIncludingRemoved(accountId); if (!account.getNeedsCleanup()) { account.setNeedsCleanup(true); - update(accountId, account); + if (!update(accountId, account)) { + s_logger.warn("Failed to mark account id=" + accountId + " for cleanup"); + } } } }