mirror of https://github.com/apache/cloudstack.git
CS-14555: Calculated checksum before unzip
Otherwise checksum would be overrided by wrong value.
This commit is contained in:
parent
48b6236c64
commit
182a4cf2e9
|
|
@ -317,6 +317,13 @@ public class DownloadManagerImpl implements DownloadManager {
|
|||
String finalTemplatePath = _templateDir + File.separator + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;
|
||||
dnld.setTmpltPath(finalTemplatePath);
|
||||
|
||||
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;
|
||||
|
|
@ -393,9 +400,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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue