cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/master to 67beef1
Date Wed, 14 Aug 2013 20:16:42 GMT
Updated Branches:
  refs/heads/master b727001f4 -> 67beef15c


CLOUDSTACK-3706:[Object_Store_Refactor] Failed to create template from
stopped guest vm's root disk.


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

Branch: refs/heads/master
Commit: 67beef15c9d6bc79c5d605af0d79b5a8b5e34e03
Parents: b727001
Author: Min Chen <min.chen@citrix.com>
Authored: Wed Aug 14 11:54:36 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Aug 14 13:11:06 2013 -0700

----------------------------------------------------------------------
 .../storage/image/store/TemplateObject.java           |  4 +++-
 .../storage/resource/NfsSecondaryStorageResource.java | 14 +++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67beef15/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
index 174d5ca..b04ca6c 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
@@ -202,7 +202,9 @@ public class TemplateObject implements TemplateInfo {
                     templateStoreDao.update(templateStoreRef.getId(), templateStoreRef);
                     if (this.getDataStore().getRole() == DataStoreRole.Image) {
                         VMTemplateVO templateVO = this.imageDao.findById(this.getId());
-                        templateVO.setFormat(newTemplate.getFormat());
+                        if (newTemplate.getFormat() != null) {
+                            templateVO.setFormat(newTemplate.getFormat());
+                        }
                         templateVO.setSize(newTemplate.getSize());
                         this.imageDao.update(templateVO.getId(), templateVO);
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67beef15/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 e45b685..f2b40f2 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
@@ -737,13 +737,21 @@ public class NfsSecondaryStorageResource extends ServerResourceBase
implements S
 
             final String bucket = s3.getBucketName();
             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()) {
                 srcFile = _storage.getFile(templatePath + ".qcow2");
                 if (!srcFile.exists()) {
-                    return new CopyCmdAnswer("Can't find src file:" + templatePath);
+                    srcFile = _storage.getFile(templatePath + ".vhd");
+                    if (!srcFile.exists()) {
+                        srcFile = _storage.getFile(templatePath + ".ova");
+                        if (!srcFile.exists()) {
+                            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();
             putFile(s3, srcFile, bucket, key);
 
@@ -1386,7 +1394,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase
implements S
 
     private Answer execute(ListTemplateCommand cmd) {
         if (!_inSystemVM) {
-           return new ListTemplateAnswer(null, null);
+            return new ListTemplateAnswer(null, null);
         }
 
         DataStoreTO store = cmd.getDataStore();


Mime
View raw message