Source:
private void refreshVolumeCapacity(GlusterVolumeEntity volume, GlusterVolumeAdvancedDetails volumeAdvancedDetails) { Long confirmedFreeSize = calculateConfirmedVolumeCapacity(volume); if (volume.getAdvancedDetails().getCapacityInfo() == null) { volumeDao.addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } else { volumeAdvancedDetails.getCapacityInfo().setConfirmedFreeSize(confirmedFreeSize); volumeDao.updateVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } if (confirmedFreeSize != null) { Long percentUsedSize = (1 - confirmedFreeSize/calculateConfirmedVolumeTotal(volume))*100; List<Guid> sdId = storageDomainStaticDao.getAllForStoragePool(clusterDao.get(volume.getClusterId()).getStoragePoolId()) .stream() .map(StorageDomainStatic::getId) .filter(sd -> storageServerConnectionDao.getAllForDomain(sd) .stream() .anyMatch(c -> volume.getId().equals(c.getGlusterVolumeId()))) .collect(Collectors.toList()); sdId.stream().map(i -> storageDomainDynamicDao.get(i)) .forEach(d -> { d.setConfirmedAvailableDiskSize((int) (confirmedFreeSize / SizeConverter.BYTES_IN_GB)); storageDomainDynamicDao.updateConfirmedSize(d); }); sdId.stream() .map(storageDomainStaticDao::get) .filter(s -> s.getWarningLowConfirmedSpaceIndicator() != null) .filter(s -> s.getWarningLowConfirmedSpaceIndicator() < percentUsedSize) .forEach(sd -> { AuditLogable event = new AuditLogableImpl(); event.setStorageDomainId(sd.getId()); event.setStorageDomainName(sd.getName()); event.setRepeatable(true); event.addCustomValue("DiskSpace", confirmedFreeSize.toString()); auditLogDirector.log(event, AuditLogType.IRS_CONFIRMED_DISK_SPACE_LOW); }); } }

Target:
private void refreshVolumeCapacity(GlusterVolumeEntity volume, GlusterVolumeAdvancedDetails volumeAdvancedDetails) { Long confirmedFreeSize = calculateConfirmedVolumeCapacity(volume); if (volume.getAdvancedDetails().getCapacityInfo() == null) { volumeDao.addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } else { volumeAdvancedDetails.getCapacityInfo().setConfirmedFreeSize(confirmedFreeSize); volumeDao.updateVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } if (confirmedFreeSize != null) { Long confirmedTotalSize = calculateConfirmedVolumeTotal(volume); Double percentUsedSize = (1 - confirmedFreeSize.doubleValue()/confirmedTotalSize)*100; List<Guid> sdId = storageDomainStaticDao.getAllForStoragePool(clusterDao.get(volume.getClusterId()).getStoragePoolId()) .stream() .map(StorageDomainStatic::getId) .filter(sd -> storageServerConnectionDao.getAllForDomain(sd) .stream() .anyMatch(c -> volume.getId().equals(c.getGlusterVolumeId()))) .collect(Collectors.toList()); sdId.stream().map(i -> storageDomainDynamicDao.get(i)) .forEach(d -> { d.setConfirmedAvailableDiskSize((int) (confirmedFreeSize / SizeConverter.BYTES_IN_GB)); storageDomainDynamicDao.updateConfirmedSize(d); }); sdId.stream() .map(storageDomainStaticDao::get) .filter(s -> s.getWarningLowConfirmedSpaceIndicator() != null) .filter(s -> s.getWarningLowConfirmedSpaceIndicator() < percentUsedSize) .forEach(sd -> { AuditLogable event = new AuditLogableImpl(); event.setStorageDomainId(sd.getId()); event.setStorageDomainName(sd.getName()); event.setRepeatable(true); event.addCustomValue("DiskSpace", String.valueOf(confirmedFreeSize / SizeConverter.BYTES_IN_GB)); auditLogDirector.log(event, AuditLogType.IRS_CONFIRMED_DISK_SPACE_LOW); }); } }