From df9003b0b63e38526949788b2b03354a0de7eb2e Mon Sep 17 00:00:00 2001 From: nit Date: Mon, 7 Feb 2011 13:47:51 +0530 Subject: [PATCH] bug 8088: Making template sync more robust. If the url is null we cant initiate a download and so mark it as a download error instead. status 8088: resolved fixed --- .../cloud/storage/download/DownloadMonitorImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java index fe2e3bc40f8..c418bc51633 100755 --- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java +++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java @@ -520,6 +520,17 @@ public class DownloadMonitorImpl implements DownloadMonitor { /*Only download templates whose hypervirsor type is in the zone*/ List availHypers = _clusterDao.getAvailableHypervisorInZone(sserver.getDataCenterId()); for (VMTemplateVO tmplt: toBeDownloaded) { + + if (tmplt.getUrl() == null){ // If url is null we cant initiate the download so mark it as an error. + VMTemplateHostVO tmpltHost = _vmTemplateHostDao.findByHostTemplate(sserver.getId(), tmplt.getId()); + if(tmpltHost != null){ + tmpltHost.setDownloadState(Status.DOWNLOAD_ERROR); + tmpltHost.setDownloadPercent(0); + _vmTemplateHostDao.update(tmpltHost.getId(), tmpltHost); + } + continue; + } + if (availHypers.contains(tmplt.getHypervisorType())) { s_logger.debug("Template " + tmplt.getName() + " needs to be downloaded to " + sserver.getName()); downloadTemplateToStorage(tmplt, sserver);