Source:
protected boolean canDoAction() { boolean retValue = true; if (getVmTemplate() == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } else if (getTemplateDisks() == null || getTemplateDisks().size() <= 0) { addCanDoActionMessage(VdcBllMessages.TEMPLATE_IMAGE_NOT_EXIST); retValue = false; } else { for (DiskImage diskImage : getTemplateDisks()) { if (diskImage.isShareable()) { addCanDoActionMessage(VdcBllMessages.SHAREABLE_DISK_IS_NOT_SUPPORTED); return false; } } ensureDomainMap(getTemplateDisks(), getParameters().getStorageDomainId()); ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), imageFromSourceDomainMap, null, true); if (getVmTemplate().getDiskMap().values().size() != imageFromSourceDomainMap.size()) { log.errorFormat("Can not found any default active domain for one of the disks of template with id : {0}", getVmTemplate().getId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS); retValue = false; } retValue = retValue && VmTemplateCommand.isVmTemplateImagesReady(getVmTemplate(), null, getReturnValue().getCanDoActionMessages(), true, true, true, false, getTemplateDisks()); if (retValue) { setStoragePoolId(getVmTemplate().getstorage_pool_id()); retValue = CheckStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active) && checkIfDisksExist(getTemplateDisks()) && checkFreeSpaceOnDestinationDomain(getStorageDomain(), (int) getVmTemplate().getActualDiskSize()); } if (retValue && DbFacade.getInstance() .getStoragePoolIsoMapDAO() .get(new StoragePoolIsoMapId(getStorageDomain().getId(), getVmTemplate().getstorage_pool_id().getValue())) == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH); } } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = true; if (getVmTemplate() == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } else if (getTemplateDisks() == null || getTemplateDisks().size() <= 0) { addCanDoActionMessage(VdcBllMessages.TEMPLATE_IMAGE_NOT_EXIST); retValue = false; } else { ensureDomainMap(getTemplateDisks(), getParameters().getStorageDomainId()); ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), imageFromSourceDomainMap, null, true); if (getVmTemplate().getDiskMap().values().size() != imageFromSourceDomainMap.size()) { log.errorFormat("Can not found any default active domain for one of the disks of template with id : {0}", getVmTemplate().getId()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS); retValue = false; } retValue = retValue && VmTemplateCommand.isVmTemplateImagesReady(getVmTemplate(), null, getReturnValue().getCanDoActionMessages(), true, true, true, false, getTemplateDisks()); if (retValue) { setStoragePoolId(getVmTemplate().getstorage_pool_id()); retValue = CheckStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active) && checkIfDisksExist(getTemplateDisks()) && checkFreeSpaceOnDestinationDomain(getStorageDomain(), (int) getVmTemplate().getActualDiskSize()); } if (retValue && DbFacade.getInstance() .getStoragePoolIsoMapDAO() .get(new StoragePoolIsoMapId(getStorageDomain().getId(), getVmTemplate().getstorage_pool_id().getValue())) == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH); } } return retValue; }