Updated Branches:
  refs/heads/4.2 fee5fce5c -> 837f10111

CLOUDSTACK-3741: a typo in adding .qcow2 extension.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/837f1011
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/837f1011
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/837f1011

Branch: refs/heads/4.2
Commit: 837f10111fe06c8eb600a8b44412bbc54c1aff07
Parents: fee5fce
Author: Min Chen <[email protected]>
Authored: Wed Jul 24 14:48:05 2013 -0700
Committer: Min Chen <[email protected]>
Committed: Wed Jul 24 14:48:35 2013 -0700

----------------------------------------------------------------------
 .../storage/resource/NfsSecondaryStorageResource.java     | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/837f1011/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
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 29c05d5..082fc6c 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);

Reply via email to