Fix size issue for template created from snapshot.

This commit is contained in:
Min Chen 2013-05-13 17:45:22 -07:00
parent 0ce01e56db
commit 3424ac86ad
2 changed files with 38 additions and 33 deletions

View File

@ -168,8 +168,12 @@ public class TemplateLocation {
tmplInfo.isCorrupted = _isCorrupted;
tmplInfo.isPublic = Boolean.parseBoolean(_props.getProperty("public"));
tmplInfo.templateName = _props.getProperty("uniquename");
if (_props.getProperty("virtualsize") != null) {
tmplInfo.size = Long.parseLong(_props.getProperty("virtualsize"));
}
if (_props.getProperty("physicalSize") != null) {
tmplInfo.physicalSize = Long.parseLong(_props.getProperty("physicalSize"));
}
return tmplInfo;
}

View File

@ -222,6 +222,7 @@ public class TemplateObject implements TemplateInfo {
templateStoreRef.setInstallPath(newTemplate.getPath());
templateStoreRef.setDownloadPercent(100);
templateStoreRef.setDownloadState(Status.DOWNLOADED);
templateStoreRef.setSize(newTemplate.getSize());
templateStoreDao.update(templateStoreRef.getId(), templateStoreRef);
if (this.getDataStore().getRole() == DataStoreRole.Image) {
VMTemplateVO templateVO = this.imageDao.findById(this.getId());