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
5021274232
commit
1ced2ed424
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue