diff --git a/core/src/com/cloud/storage/template/DownloadManagerImpl.java b/core/src/com/cloud/storage/template/DownloadManagerImpl.java index b1f09069622..4f01842cbab 100755 --- a/core/src/com/cloud/storage/template/DownloadManagerImpl.java +++ b/core/src/com/cloud/storage/template/DownloadManagerImpl.java @@ -334,6 +334,13 @@ public class DownloadManagerImpl implements DownloadManager { _storage.mkdirs(resourcePath); dnld.setTmpltPath(finalResourcePath); + File originalTemplate = new File(td.getDownloadLocalPath()); + String checkSum = computeCheckSum(originalTemplate); + if (checkSum == null) { + s_logger.warn("Something wrong happened when try to calculate the checksum of downloaded template!"); + } + dnld.setCheckSum(checkSum); + int imgSizeGigs = (int) Math.ceil(_storage.getSize(td.getDownloadLocalPath()) * 1.0d / (1024 * 1024 * 1024)); imgSizeGigs++; // add one just in case long timeout = imgSizeGigs * installTimeoutPerGig; @@ -417,9 +424,6 @@ public class DownloadManagerImpl implements DownloadManager { } } - String checkSum = computeCheckSum(downloadedTemplate); - dnld.setCheckSum(checkSum); - if (!loc.save()) { s_logger.warn("Cleaning up because we're unable to save the formats"); loc.purge();