server: fix VM with ISO attached migration issue (#3935)

As previously described by PR #3929:
If vm has attached ISO, the migration fails with error message "org.libvirt.LibvirtException: Cannot access storage file /mnt/b33e5a1d-e4ea-3465-b6ac-c98dc8ff8af0/207-2-cc5fd717-2d57-3bb3-bcf6-2c930268db6c.iso"
This commit is contained in:
Nicolas Vazquez 2020-03-06 05:02:19 -03:00 committed by GitHub
parent 4be70014bb
commit bd7d41bf6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -68,7 +68,7 @@ public class TemplateDataFactoryImpl implements TemplateDataFactory {
@Override
public TemplateInfo getTemplate(long templateId, DataStore store) {
VMTemplateVO templ = imageDataDao.findById(templateId);
if (store == null) {
if (store == null && !templ.isDirectDownload()) {
TemplateObject tmpl = TemplateObject.getTemplate(templ, null);
return tmpl;
}

View File

@ -584,10 +584,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
}
poolId = storagePool.getId();
}
template = prepareIso(vm.getIsoId(), vm.getDataCenterId(), dest.getHost().getId(), poolId);
} else {
template = _tmplFactory.getTemplate(vm.getIsoId(), DataStoreRole.Primary, dest.getDataCenter().getId());
}
template = prepareIso(vm.getIsoId(), vm.getDataCenterId(), dest.getHost().getId(), poolId);
if (template == null){
s_logger.error("Failed to prepare ISO on secondary or cache storage");