Skip to content

Commit fd39184

Browse files
minchen07chaturvedia
authored andcommitted
CLOUDSTACK-5971:Templates created from a snapshots can't be copied to
other zones.(cherry picked from commit 77aeb28) Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
1 parent 63e839c commit fd39184

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import com.cloud.exception.ResourceAllocationException;
7676
import com.cloud.hypervisor.Hypervisor.HypervisorType;
7777
import com.cloud.storage.DataStoreRole;
78+
import com.cloud.storage.Storage.ImageFormat;
7879
import com.cloud.storage.Storage.TemplateType;
7980
import com.cloud.storage.StoragePool;
8081
import com.cloud.storage.VMTemplateStorageResourceAssoc;
@@ -736,6 +737,13 @@ public void syncTemplateToRegionStore(long templateId, DataStore store) {
736737

737738
@Override
738739
public AsyncCallFuture<TemplateApiResult> copyTemplate(TemplateInfo srcTemplate, DataStore destStore) {
740+
// for vmware template, we need to check if ova packing is needed, since template created from snapshot does not have .ova file
741+
// we invoke createEntityExtractURL to trigger ova packing. Ideally, we can directly use extractURL to pass to following createTemplate.
742+
// Need to understand what is the background to use two different urls for copy and extract.
743+
if (srcTemplate.getFormat() == ImageFormat.OVA){
744+
ImageStoreEntity tmpltStore = (ImageStoreEntity)srcTemplate.getDataStore();
745+
tmpltStore.createEntityExtractUrl(srcTemplate.getInstallPath(), srcTemplate.getFormat(), srcTemplate);
746+
}
739747
// generate a URL from source template ssvm to download to destination data store
740748
String url = generateCopyUrl(srcTemplate);
741749
if (url == null) {

0 commit comments

Comments
 (0)