Skip to content

Commit 837f101

Browse files
committed
CLOUDSTACK-3741: a typo in adding .qcow2 extension.
1 parent fee5fce commit 837f101

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,10 @@ protected Answer copySnapshotToTemplateFromNfsToNfs(CopyCommand cmd, SnapshotObj
417417
} else if (srcData.getHypervisorType() == HypervisorType.KVM) {
418418
File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl());
419419
File destFile = getFile(destData.getPath(), destDataStore.getUrl());
420-
// get snapshot file name, add extension if it is missing
420+
// get snapshot file name
421421
String templateName = srcFile.getName();
422-
if (!templateName.endsWith(ImageFormat.QCOW2.getFileExtension())) {
423-
templateName = templateName + ImageFormat.QCOW2.getFileExtension();
424-
}
425-
String destFileFullPath = destFile.getAbsolutePath() + File.separator + templateName;
422+
// add kvm file extension for copied template name
423+
String destFileFullPath = destFile.getAbsolutePath() + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension();
426424
s_logger.debug("copy snapshot " + srcFile.getAbsolutePath() + " to template " + destFileFullPath);
427425
Script.runSimpleBashScript("cp " + srcFile.getAbsolutePath() + " " + destFileFullPath);
428426
// template post processing
@@ -439,7 +437,7 @@ protected Answer copySnapshotToTemplateFromNfsToNfs(CopyCommand cmd, SnapshotObj
439437
loc.save();
440438
TemplateProp prop = loc.getTemplateInfo();
441439
TemplateObjectTO newTemplate = new TemplateObjectTO();
442-
newTemplate.setPath(destData.getPath() + File.separator + templateName);
440+
newTemplate.setPath(destData.getPath() + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension());
443441
newTemplate.setFormat(ImageFormat.QCOW2);
444442
newTemplate.setSize(prop.getSize());
445443
return new CopyCmdAnswer(newTemplate);

0 commit comments

Comments
 (0)