Source:
<code>private void refreshBrickDetails(GlusterVolumeEntity volume, GlusterVolumeAdvancedDetails volumeAdvancedDetails, Map<Guid, GlusterLocalVolumeInfo> localVolumeInfo) { List<GlusterBrickEntity> bricksToUpdate = new ArrayList<>(); List<GlusterBrickEntity> brickPropertiesToUpdate = new ArrayList<>(); List<GlusterBrickEntity> brickPropertiesToAdd = new ArrayList<>(); Map<Guid, BrickProperties> brickPropertiesMap = getBrickPropertiesMap(volumeAdvancedDetails); for (GlusterBrickEntity brick : volume.getBricks()) { BrickProperties brickProperties = brickPropertiesMap.get(brick.getId()); if (brickProperties != null) { brickProperties.setConfirmedFreeSize( localVolumeInfo.get(brick.getServerId()) <START> .getThinSizeForDevice(brickProperties.getDevice()) <END> .map(Long::doubleValue).map(v -> v/1048576).orElseGet(null) ); if (brickProperties.getStatus() != brick.getStatus()) { logBrickStatusChange(volume, brick, brickProperties.getStatus()); brick.setStatus(brickProperties.getStatus()); bricksToUpdate.add(brick); } if (brick.getBrickProperties() == null) { BrickDetails brickDetails = new BrickDetails(); brickDetails.setBrickProperties(brickProperties); brick.setBrickDetails(brickDetails); brickPropertiesToAdd.add(brick); } else if (brickProperties.getTotalSize() != brick.getBrickProperties().getTotalSize() || brickProperties.getFreeSize() != brick.getBrickProperties().getFreeSize()) { brick.getBrickDetails().setBrickProperties(brickProperties); brickPropertiesToUpdate.add(brick); } } } if (!brickPropertiesToAdd.isEmpty()) { brickDao.addBrickProperties(brickPropertiesToAdd); } if (!brickPropertiesToUpdate.isEmpty()) { brickDao.updateBrickProperties(brickPropertiesToUpdate); } if (!bricksToUpdate.isEmpty()) { brickDao.updateBrickStatuses(bricksToUpdate); } }</code><technical_language>brickProperties.getDevice() null/empty - getThinSizeForDevice need handle this</technical_language>

Target:
private void refreshBrickDetails(GlusterVolumeEntity volume, GlusterVolumeAdvancedDetails volumeAdvancedDetails, Map<Guid, GlusterLocalVolumeInfo> localVolumeInfo) { List<GlusterBrickEntity> bricksToUpdate = new ArrayList<>(); List<GlusterBrickEntity> brickPropertiesToUpdate = new ArrayList<>(); List<GlusterBrickEntity> brickPropertiesToAdd = new ArrayList<>(); Map<Guid, BrickProperties> brickPropertiesMap = getBrickPropertiesMap(volumeAdvancedDetails); for (GlusterBrickEntity brick : volume.getBricks()) { BrickProperties brickProperties = brickPropertiesMap.get(brick.getId()); if (brickProperties != null && brickProperties.getDevice() != null) { brickProperties.setConfirmedFreeSize( localVolumeInfo.get(brick.getServerId()) .getThinSizeForDevice(brickProperties.getDevice()) .map(Long::doubleValue).map(v -> v/ SizeConverter.BYTES_IN_MB).orElseGet(null) ); if (brickProperties.getStatus() != brick.getStatus()) { logBrickStatusChange(volume, brick, brickProperties.getStatus()); brick.setStatus(brickProperties.getStatus()); bricksToUpdate.add(brick); } if (brick.getBrickProperties() == null) { BrickDetails brickDetails = new BrickDetails(); brickDetails.setBrickProperties(brickProperties); brick.setBrickDetails(brickDetails); brickPropertiesToAdd.add(brick); } else if (brickProperties.getTotalSize() != brick.getBrickProperties().getTotalSize() || brickProperties.getFreeSize() != brick.getBrickProperties().getFreeSize()) { brick.getBrickDetails().setBrickProperties(brickProperties); brickPropertiesToUpdate.add(brick); } } } if (!brickPropertiesToAdd.isEmpty()) { brickDao.addBrickProperties(brickPropertiesToAdd); } if (!brickPropertiesToUpdate.isEmpty()) { brickDao.updateBrickProperties(brickPropertiesToUpdate); } if (!bricksToUpdate.isEmpty()) { brickDao.updateBrickStatuses(bricksToUpdate); } }