From 654bcdeb5e907df1b01a8cde47ae34e5d2c23fc8 Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 2 Sep 2011 16:06:55 -0700 Subject: [PATCH] bug 10751: don't remove already removed templates during the account cleanup status 10751: resolved fixed --- server/src/com/cloud/user/AccountManagerImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 69b4ccad975..7d89d52a8e8 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -1084,11 +1084,13 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag List userTemplates = _templateDao.listByAccountId(accountId); boolean allTemplatesDeleted = true; for (VMTemplateVO template : userTemplates) { - try { - allTemplatesDeleted = _tmpltMgr.delete(callerUserId, template.getId(), null); - } catch (Exception e) { - s_logger.warn("Failed to delete template while removing account: " + template.getName() + " due to: ", e); - allTemplatesDeleted = false; + if (template.getRemoved() == null) { + try { + allTemplatesDeleted = _tmpltMgr.delete(callerUserId, template.getId(), null); + } catch (Exception e) { + s_logger.warn("Failed to delete template while removing account: " + template.getName() + " due to: ", e); + allTemplatesDeleted = false; + } } }