@@ -983,6 +983,7 @@ public boolean cleanupAccount(AccountVO account, long callerUserId, Account call
983983 s_logger .debug ("Destroying # of vms (accountId=" + accountId + "): " + vms .size ());
984984 }
985985
986+ //no need to catch exception at this place as expunging vm should pass in order to perform further cleanup
986987 for (UserVmVO vm : vms ) {
987988 if (!_vmMgr .expunge (vm , callerUserId , caller )) {
988989 s_logger .error ("Unable to destroy vm: " + vm .getId ());
@@ -996,7 +997,7 @@ public boolean cleanupAccount(AccountVO account, long callerUserId, Account call
996997 if (!volume .getState ().equals (Volume .State .Destroy )) {
997998 try {
998999 _storageMgr .destroyVolume (volume );
999- } catch (ConcurrentOperationException ex ) {
1000+ } catch (Exception ex ) {
10001001 s_logger .warn ("Failed to cleanup volumes as a part of account id=" + accountId + " cleanup due to Exception: " , ex );
10011002 accountCleanupNeeded = true ;
10021003 }
@@ -1054,7 +1055,11 @@ public boolean cleanupAccount(AccountVO account, long callerUserId, Account call
10541055 }
10551056
10561057 return true ;
1057- } finally {
1058+ } catch (Exception ex ) {
1059+ s_logger .warn ("Failed to cleanup account " + account + " due to " , ex );
1060+ accountCleanupNeeded = true ;
1061+ return true ;
1062+ }finally {
10581063 s_logger .info ("Cleanup for account " + account .getId () + (accountCleanupNeeded ? " is needed." : " is not needed." ));
10591064 if (accountCleanupNeeded ) {
10601065 _accountDao .markForCleanup (accountId );
0 commit comments