From 5d3bc5339ee3326117de78709e178b7419e262b5 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Mon, 19 Aug 2013 11:21:19 -0700 Subject: [PATCH] CLOUDSTACK-4399:[Templates] template entries are deleted from template_store_ref when downloadTemplate times out. --- .../storage/image/TemplateServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java index ea56f6d7a7d..7d9a7400647 100644 --- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java @@ -367,9 +367,8 @@ public class TemplateServiceImpl implements TemplateService { } } else { + s_logger.info("Template Sync did not find " + uniqueName + " on image store " + storeId + ", may request download based on available hypervisor types"); if (tmpltStore != null) { - s_logger.info("Template Sync did not find " + uniqueName + " on image store " + storeId - + ", may request download based on available hypervisor types"); s_logger.info("Removing leftover template " + uniqueName + " entry from template store table"); // remove those leftover entries _vmTemplateStoreDao.remove(tmpltStore.getId()); @@ -393,20 +392,19 @@ public class TemplateServiceImpl implements TemplateService { // download. for (VMTemplateVO tmplt : toBeDownloaded) { if (tmplt.getUrl() == null) { // If url is null we can't - // initiate the download + s_logger.info("Skip downloading template " + tmplt.getUniqueName() + " since no url is specified."); continue; } - // if this is private template, skip - if (!tmplt.isPublicTemplate() && !tmplt.isFeatured()) { - continue; - } if (availHypers.contains(tmplt.getHypervisorType())) { s_logger.info("Downloading template " + tmplt.getUniqueName() + " to image store " + store.getName()); associateTemplateToZone(tmplt.getId(), zoneId); TemplateInfo tmpl = _templateFactory.getTemplate(tmplt.getId(), DataStoreRole.Image); createTemplateAsync(tmpl, store, null); + } else { + s_logger.info("Skip downloading template " + tmplt.getUniqueName() + " since current data center does not have hypervisor " + + tmplt.getHypervisorType().toString()); } } }