From 7799f6482fe8c16923554cd6515cc8783be363d2 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Wed, 24 Jul 2013 14:48:05 -0700 Subject: [PATCH] CLOUDSTACK-3741: a typo in adding .qcow2 extension. --- .../storage/resource/NfsSecondaryStorageResource.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 29c05d5dfa3..082fc6c1cdb 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 @@ -417,12 +417,10 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S } else if (srcData.getHypervisorType() == HypervisorType.KVM) { File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl()); File destFile = getFile(destData.getPath(), destDataStore.getUrl()); - // get snapshot file name, add extension if it is missing + // get snapshot file name String templateName = srcFile.getName(); - if (!templateName.endsWith(ImageFormat.QCOW2.getFileExtension())) { - templateName = templateName + ImageFormat.QCOW2.getFileExtension(); - } - String destFileFullPath = destFile.getAbsolutePath() + File.separator + templateName; + // add kvm file extension for copied template name + String destFileFullPath = destFile.getAbsolutePath() + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension(); s_logger.debug("copy snapshot " + srcFile.getAbsolutePath() + " to template " + destFileFullPath); Script.runSimpleBashScript("cp " + srcFile.getAbsolutePath() + " " + destFileFullPath); // template post processing @@ -439,7 +437,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S loc.save(); TemplateProp prop = loc.getTemplateInfo(); TemplateObjectTO newTemplate = new TemplateObjectTO(); - newTemplate.setPath(destData.getPath() + File.separator + templateName); + newTemplate.setPath(destData.getPath() + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension()); newTemplate.setFormat(ImageFormat.QCOW2); newTemplate.setSize(prop.getSize()); return new CopyCmdAnswer(newTemplate);