Source:
<code>public boolean CheckFreeSpaceOnDestinationDomains() { boolean retValue = true; VmTemplate vmTemplate = DbFacade.getInstance().getVmTemplateDAO() .get(getParameters().getVmStaticData().getvmt_guid()); VmTemplateHandler.UpdateDisksFromDb(vmTemplate); double size = 0.0; java.util.ArrayList<Guid> domainsList; if (getStorageDomainId() == null || getStorageDomainId().getValue().equals(Guid.Empty)) { domainsList = (java.util.ArrayList<Guid>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.GetImageDomainsList, new GetImageDomainsListVDSCommandParameters(vmTemplate.getstorage_pool_id().getValue(), vmTemplate.getDiskList().get(0).getimage_group_id().getValue())).getReturnValue(); } else { domainsList = new java.util.ArrayList<Guid>(); domainsList.add(getStorageDomainId().getValue()); } for (Guid domainId : domainsList) { storage_domains domain = DbFacade.getInstance().getStorageDomainDAO().getForStoragePool(domainId, vmTemplate.getstorage_pool_id()); if (domain != null && domain.getstorage_domain_type() != StorageDomainType.ImportExport && domain.getstatus() == StorageDomainStatus.Active && domain.getavailable_disk_size() != null && StorageDomainSpaceChecker.hasSpaceForRequest(domain, getBlockSparseInitSizeInGB())) { size += <START> domain.getavailable_disk_size() <END> - Config.<Integer> GetValue(ConfigValues.FreeSpaceCriticalLowInGB); } } if (size < (getBlockSparseInitSizeInGB() * getParameters().getVmsCount() * vmTemplate.getDiskMap().size())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); } return retValue; }</code><technical_language>config value, moved some method</technical_language>

Target:
public boolean CheckFreeSpaceOnDestinationDomains() { boolean retValue = true; VmTemplate vmTemplate = DbFacade.getInstance().getVmTemplateDAO() .get(getParameters().getVmStaticData().getvmt_guid()); VmTemplateHandler.UpdateDisksFromDb(vmTemplate); double size = 0.0; java.util.ArrayList<Guid> domainsList; if (getStorageDomainId() == null || getStorageDomainId().getValue().equals(Guid.Empty)) { domainsList = (java.util.ArrayList<Guid>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.GetImageDomainsList, new GetImageDomainsListVDSCommandParameters(vmTemplate.getstorage_pool_id().getValue(), vmTemplate.getDiskList().get(0).getimage_group_id().getValue())).getReturnValue(); } else { domainsList = new java.util.ArrayList<Guid>(); domainsList.add(getStorageDomainId().getValue()); } for (Guid domainId : domainsList) { storage_domains domain = DbFacade.getInstance().getStorageDomainDAO().getForStoragePool(domainId, vmTemplate.getstorage_pool_id()); if (domain != null && domain.getstorage_domain_type() != StorageDomainType.ImportExport && domain.getstatus() == StorageDomainStatus.Active && domain.getavailable_disk_size() != null && StorageDomainSpaceChecker.hasSpaceForRequest(domain, getBlockSparseInitSizeInGB())) { size += domain.getavailable_disk_size() - getFreeSpaceCriticalLowInGB(); } } if (size < (getBlockSparseInitSizeInGB() * getParameters().getVmsCount() * vmTemplate.getDiskMap().size())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); } return retValue; }