Shubhendu Tripathi has posted comments on this change. Change subject: gluster: Additional validations for volume snapshot create/schedule ......................................................................
Patch Set 4: (2 comments) https://gerrit.ovirt.org/#/c/38468/4/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java: Line 56: Date currentDate = new Date(); Line 57: Date convertedStartDate = convertDate(schedule.getStartDate(), schedule.getTimeZone()); Line 58: Date convertedEndByDate = convertDate(schedule.getEndByDate(), schedule.getTimeZone()); Line 59: Line 60: if (!(schedule.getRecurrence() == null || schedule.getRecurrence() == GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN)) { > I think if we don't check the second one it would be more safer right? Its better to check for not null and UNKNOWN for REST case I feel. There is "!" in the start btw :) so only if recurrence is not null and not equal to UNKNOWN these checks are performed. I think I would change the condition as below for better clarity If (schedule.getRecurrence() != null && schedule.getRecurrence() != GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN) Line 61: if (schedule.getStartDate() != null && convertedStartDate.compareTo(currentDate) < 0) { Line 62: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_START_DATE_BEFORE_CURRENT_DATE); Line 63: } Line 64: if (schedule.getEndByDate() != null) { Line 67: } Line 68: if (schedule.getStartDate() != null && convertedEndByDate.compareTo(convertedStartDate) <= 0) { Line 69: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_END_BY_DATE_BEFORE_START_DATE); Line 70: } Line 71: } > may be check for non-null converted date in case the schedule.getEndByDate( done Line 72: } Line 73: Line 74: return true; Line 75: } -- To view, visit https://gerrit.ovirt.org/38468 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I437344f106b9e998a8f9258ca836f91d39c7ad32 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com> Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Sahina Bose <sab...@redhat.com> Gerrit-Reviewer: Shubhendu Tripathi <shtri...@redhat.com> Gerrit-Reviewer: anmolbabu <anb...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org 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