Skip to content

Commit a26c811

Browse files
committed
CLOUDSTACK-5971:Templates created from a snapshots can't be copied to
other zones.
1 parent bd2acd1 commit a26c811

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;
@@ -721,6 +722,13 @@ public void syncTemplateToRegionStore(long templateId, DataStore store) {
721722

722723
@Override
723724
public AsyncCallFuture<TemplateApiResult> copyTemplate(TemplateInfo srcTemplate, DataStore destStore) {
725+
// for vmware template, we need to check if ova packing is needed, since template created from snapshot does not have .ova file
726+
// we invoke createEntityExtractURL to trigger ova packing. Ideally, we can directly use extractURL to pass to following createTemplate.
727+
// Need to understand what is the background to use two different urls for copy and extract.
728+
if (srcTemplate.getFormat() == ImageFormat.OVA){
729+
ImageStoreEntity tmpltStore = (ImageStoreEntity)srcTemplate.getDataStore();
730+
tmpltStore.createEntityExtractUrl(srcTemplate.getInstallPath(), srcTemplate.getFormat(), srcTemplate);
731+
}
724732
// generate a URL from source template ssvm to download to destination data store
725733
String url = generateCopyUrl(srcTemplate);
726734
if (url == null) {

0 commit comments

Comments
 (0)