You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/01/28 22:17:15 UTC

git commit: updated refs/heads/4.3-forward to 77aeb28

Updated Branches:
  refs/heads/4.3-forward 782265e71 -> 77aeb2871


CLOUDSTACK-5971:Templates created from a snapshots can't be copied to
other zones.

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

Branch: refs/heads/4.3-forward
Commit: 77aeb2871ba393adb311f590185f2a34055c1aa1
Parents: 782265e
Author: Min Chen <mi...@citrix.com>
Authored: Tue Jan 28 13:09:57 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Jan 28 13:09:57 2014 -0800

----------------------------------------------------------------------
 .../apache/cloudstack/storage/image/TemplateServiceImpl.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/77aeb287/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index 7514f43..a649bb7 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -75,6 +75,7 @@ import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.TemplateType;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
@@ -736,6 +737,13 @@ public class TemplateServiceImpl implements TemplateService {
 
     @Override
     public AsyncCallFuture<TemplateApiResult> copyTemplate(TemplateInfo srcTemplate, DataStore destStore) {
+        // for vmware template, we need to check if ova packing is needed, since template created from snapshot does not have .ova file
+        // we invoke createEntityExtractURL to trigger ova packing. Ideally, we can directly use extractURL to pass to following createTemplate. 
+        // Need to understand what is the background to use two different urls for copy and extract.
+        if (srcTemplate.getFormat() == ImageFormat.OVA){
+            ImageStoreEntity tmpltStore = (ImageStoreEntity)srcTemplate.getDataStore();
+            tmpltStore.createEntityExtractUrl(srcTemplate.getInstallPath(), srcTemplate.getFormat(), srcTemplate);
+        }
         // generate a URL from source template ssvm to download to destination data store
         String url = generateCopyUrl(srcTemplate);
         if (url == null) {