mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-15 18:12:35 +01:00
CLOUDSTACK-4295 : TemplateTO should contain physical size along with virtual size. Usage ignores templates with size 0
This commit is contained in:
parent
d771e3fa5b
commit
21831211f6
@ -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)
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user