mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-3706:[Object_Store_Refactor] Failed to create template from
stopped guest vm's root disk.
This commit is contained in:
parent
b727001f48
commit
67beef15c9
@ -202,7 +202,9 @@ public class TemplateObject implements TemplateInfo {
|
|||||||
templateStoreDao.update(templateStoreRef.getId(), templateStoreRef);
|
templateStoreDao.update(templateStoreRef.getId(), templateStoreRef);
|
||||||
if (this.getDataStore().getRole() == DataStoreRole.Image) {
|
if (this.getDataStore().getRole() == DataStoreRole.Image) {
|
||||||
VMTemplateVO templateVO = this.imageDao.findById(this.getId());
|
VMTemplateVO templateVO = this.imageDao.findById(this.getId());
|
||||||
|
if (newTemplate.getFormat() != null) {
|
||||||
templateVO.setFormat(newTemplate.getFormat());
|
templateVO.setFormat(newTemplate.getFormat());
|
||||||
|
}
|
||||||
templateVO.setSize(newTemplate.getSize());
|
templateVO.setSize(newTemplate.getSize());
|
||||||
this.imageDao.update(templateVO.getId(), templateVO);
|
this.imageDao.update(templateVO.getId(), templateVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -737,13 +737,21 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||||||
|
|
||||||
final String bucket = s3.getBucketName();
|
final String bucket = s3.getBucketName();
|
||||||
File srcFile = _storage.getFile(templatePath);
|
File srcFile = _storage.getFile(templatePath);
|
||||||
|
// guard the case where templatePath does not have file extension, since we are not completely sure
|
||||||
|
// about hypervisor, so we check each extension
|
||||||
if (!srcFile.exists()) {
|
if (!srcFile.exists()) {
|
||||||
srcFile = _storage.getFile(templatePath + ".qcow2");
|
srcFile = _storage.getFile(templatePath + ".qcow2");
|
||||||
|
if (!srcFile.exists()) {
|
||||||
|
srcFile = _storage.getFile(templatePath + ".vhd");
|
||||||
|
if (!srcFile.exists()) {
|
||||||
|
srcFile = _storage.getFile(templatePath + ".ova");
|
||||||
if (!srcFile.exists()) {
|
if (!srcFile.exists()) {
|
||||||
return new CopyCmdAnswer("Can't find src file:" + templatePath);
|
return new CopyCmdAnswer("Can't find src file:" + templatePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImageFormat format = this.getTemplateFormat(templatePath);
|
}
|
||||||
|
}
|
||||||
|
ImageFormat format = this.getTemplateFormat(srcFile.getName());
|
||||||
String key = destData.getPath() + S3Utils.SEPARATOR + srcFile.getName();
|
String key = destData.getPath() + S3Utils.SEPARATOR + srcFile.getName();
|
||||||
putFile(s3, srcFile, bucket, key);
|
putFile(s3, srcFile, bucket, key);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user