mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
set template size when creating template from snapshot
This commit is contained in:
parent
a7480530f7
commit
0ce01e56db
@ -39,6 +39,7 @@ public class TemplateObjectTO implements DataTO {
|
||||
private DataStoreTO imageDataStore;
|
||||
private String name;
|
||||
private String guestOsType;
|
||||
private Long size;
|
||||
|
||||
public TemplateObjectTO() {
|
||||
|
||||
@ -159,4 +160,12 @@ public class TemplateObjectTO implements DataTO {
|
||||
public void setGuestOsType(String guestOsType) {
|
||||
this.guestOsType = guestOsType;
|
||||
}
|
||||
|
||||
public Long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Long size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +226,7 @@ public class TemplateObject implements TemplateInfo {
|
||||
if (this.getDataStore().getRole() == DataStoreRole.Image) {
|
||||
VMTemplateVO templateVO = this.imageDao.findById(this.getId());
|
||||
templateVO.setFormat(newTemplate.getFormat());
|
||||
templateVO.setSize(newTemplate.getSize());
|
||||
this.imageDao.update(templateVO.getId(), templateVO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,10 +367,11 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
loc.create(1, true, templateName);
|
||||
loc.addFormat(info);
|
||||
loc.save();
|
||||
|
||||
TemplateProp prop = loc.getTemplateInfo();
|
||||
TemplateObjectTO newTemplate = new TemplateObjectTO();
|
||||
newTemplate.setPath(destData.getPath() + File.separator + templateName);
|
||||
newTemplate.setFormat(ImageFormat.VHD);
|
||||
newTemplate.setSize(prop.getSize());
|
||||
return new CopyCmdAnswer(newTemplate);
|
||||
} catch (ConfigurationException e) {
|
||||
s_logger.debug("Failed to create template from snapshot: " + e.toString());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user