bug 8359: fixed deleteDomainCommand - didn't work when domain had accounts assigned (incorrect method cleanupAccount was called instead of deleteAccount)

status 8359: resolved fixed
This commit is contained in:
alena 2011-02-03 10:38:53 -08:00
parent 026e6905c9
commit e9490bda55
2 changed files with 8 additions and 3 deletions

View File

@ -3011,6 +3011,9 @@ public class ManagementServerImpl implements ManagementServer {
// cleanup sub-domains first
for (DomainVO domain : domains) {
success = (success && cleanupDomain(domain.getId(), domain.getAccountId()));
if (!success) {
s_logger.warn("Failed to cleanup domain id=" + domain.getId());
}
}
}
@ -3020,7 +3023,10 @@ public class ManagementServerImpl implements ManagementServer {
sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
List<AccountVO> accounts = _accountDao.search(sc, null);
for (AccountVO account : accounts) {
success = (success && _accountMgr.cleanupAccount(account, UserContext.current().getCallerUserId(), UserContext.current().getCaller()));
success = (success && _accountMgr.deleteAccount(account, UserContext.current().getCallerUserId(), UserContext.current().getCaller()));
if (!success) {
s_logger.warn("Failed to cleanup account id=" + account.getId() + " as a part of domain cleanup");
}
}
}

View File

@ -814,8 +814,6 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
if (success) {
s_logger.debug("Successfully deleted snapshots directories for all volumes under account " + accountId + " across all zones");
}
// else, there are no snapshots, hence no directory to delete.
// clean up templates
List<VMTemplateVO> userTemplates = _templateDao.listByAccountId(accountId);
@ -830,6 +828,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
}
if (!allTemplatesDeleted) {
s_logger.warn("Failed to delete templates while removing account id=" + accountId);
accountCleanupNeeded = true;
}