Source:
<code>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) { <START> Long percentUsedSize = (1 - confirmedFreeSize/calculateConfirmedVolumeTotal(volume))*100; <END> 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); }); } }</code><technical_language>alert for volume, for storage domain - especially in cases volume is linked sd</technical_language>

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); }); } }