diff --git a/core/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java b/core/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java index 2347de35168..bcf6eb9a11a 100644 --- a/core/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java +++ b/core/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java @@ -39,6 +39,7 @@ public class TemplateObjectTO implements DataTO { private String name; private String guestOsType; private Long size; + private Long physicalSize; private Hypervisor.HypervisorType hypervisorType; public TemplateObjectTO() { @@ -200,6 +201,14 @@ public class TemplateObjectTO implements DataTO { this.size = size; } + public Long getPhysicalSize() { + return physicalSize; + } + + public void setPhysicalSize(Long physicalSize) { + this.physicalSize = physicalSize; + } + @Override public String toString() { return new StringBuilder("TemplateTO[id=").append(id).append("|origUrl=").append(origUrl) diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java index 0c0aa996793..174d5ca293e 100644 --- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java @@ -198,6 +198,7 @@ public class TemplateObject implements TemplateInfo { templateStoreRef.setDownloadPercent(100); templateStoreRef.setDownloadState(Status.DOWNLOADED); templateStoreRef.setSize(newTemplate.getSize()); + templateStoreRef.setPhysicalSize(newTemplate.getPhysicalSize()); templateStoreDao.update(templateStoreRef.getId(), templateStoreRef); if (this.getDataStore().getRole() == DataStoreRole.Image) { VMTemplateVO templateVO = this.imageDao.findById(this.getId()); diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index 340100618e9..e45b6858c5b 100755 --- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -382,6 +382,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S newTemplate.setPath(destData.getPath() + File.separator + templateName); newTemplate.setFormat(ImageFormat.VHD); newTemplate.setSize(prop.getSize()); + newTemplate.setPhysicalSize(prop.getPhysicalSize()); return new CopyCmdAnswer(newTemplate); } catch (ConfigurationException e) { s_logger.debug("Failed to create template from snapshot: " + e.toString()); @@ -444,6 +445,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S newTemplate.setPath(destData.getPath() + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension()); newTemplate.setFormat(ImageFormat.QCOW2); newTemplate.setSize(prop.getSize()); + newTemplate.setPhysicalSize(prop.getPhysicalSize()); return new CopyCmdAnswer(newTemplate); } catch (ConfigurationException e) { s_logger.debug("Failed to create template:" + e.toString());