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

other zones.
This commit is contained in:
Min Chen 2014-01-28 13:09:57 -08:00
parent bd2acd1eff
commit a26c81178b
1 changed files with 8 additions and 0 deletions

View File

@ -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;
@ -721,6 +722,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) {