Ramesh N has posted comments on this change. Change subject: gluster: dao changes for volume capacity info ......................................................................
Patch Set 16: (2 comments) http://gerrit.ovirt.org/#/c/23010/16/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java: Line 231: private static final class GlusterBrickPropertiesRowMapper implements RowMapper<BrickProperties> { Line 232: @Override Line 233: public BrickProperties mapRow(ResultSet rs, int rowNum) Line 234: throws SQLException { Line 235: BrickProperties brickProperties = new BrickProperties(); Doing division on integers truncates the result to the integer value closest to zero. To avoid this, we have to convert the either of the operand to double before division. Line 236: brickProperties.setTotalSize(rs.getLong("total_space") / SizeConverter.BYTES_IN_MB); Line 237: brickProperties.setFreeSize(rs.getLong("free_space") / SizeConverter.BYTES_IN_MB); Line 238: return brickProperties; Line 239: } http://gerrit.ovirt.org/#/c/23010/16/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java: Line 409: throws SQLException { Line 410: GlusterVolumeAdvancedDetails advancedDetails = new GlusterVolumeAdvancedDetails(); Line 411: GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo(); Line 412: capacityInfo.setVolumeId(getGuid(rs, "volume_id")); Line 413: capacityInfo.setTotalSize(rs.getLong("total_space")); > is this null safe? Null is allowed here. Null will be treated as zero by rs.getLong(). I have added an entry in fixtures with null values and updated the test case to test that Line 414: capacityInfo.setUsedSize(rs.getLong("used_space")); Line 415: capacityInfo.setFreeSize(rs.getLong("free_space")); Line 416: advancedDetails.setUpdatedAt(rs.getDate("_update_date")); Line 417: advancedDetails.setCapacityInfo(capacityInfo); -- To view, visit http://gerrit.ovirt.org/23010 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7d67b7ee22f4cb6839d0f14d3f27f3e22149ff22 Gerrit-PatchSet: 16 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ramesh N <rnach...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Ramesh N <rnach...@redhat.com> Gerrit-Reviewer: Sahina Bose <sab...@redhat.com> Gerrit-Reviewer: Shubhendu Tripathi <shtri...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: anmolbabu <anb...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches