Gilad Chaplik has posted comments on this change. Change subject: engine: Extracted some QoS validation to NetworkQosValidator ......................................................................
Patch Set 13: (2 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateNetworkQoSCommand.java Line 19: NetworkQosValidator validator = new NetworkQosValidator(getNetworkQoS()); Line 20: if (!validate(validator.qosExists()) || !validate(validator.consistentDataCenter())) { Line 21: return false; Line 22: } else { Line 23: NetworkQoS oldNetworkQoS = getNetworkQoSDao().get(getNetworkQoS().getId()); you fetched for old networkQoS in the validator Line 24: if (validateValues()) { Line 25: if (!oldNetworkQoS.getName().equals(getNetworkQoS().getName())) { Line 26: return validateNameNotExistInDC(); Line 27: } .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/NetworkQosValidator.java Line 33: /** Line 34: * Verify that the QoS entity has the same DC ID as the one stored in the database. Line 35: */ Line 36: public ValidationResult consistentDataCenter() { Line 37: return (qos != null && (getOldQos() == null || !qos.getStoragePoolId().equals(getOldQos().getStoragePoolId()))) 1) minor: qos can't be null 2) asking: qos storage pool can be null now -> possible NPE, no DB constraint for null, results in bad user flow? Line 38: ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID) Line 39: : ValidationResult.VALID; Line 40: } Line 41: -- To view, visit http://gerrit.ovirt.org/22600 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I13dbb35bbd4cdbf4071e79d81eeb52667b734fcb Gerrit-PatchSet: 13 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <lver...@redhat.com> Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com> Gerrit-Reviewer: Gilad Chaplik <gchap...@redhat.com> Gerrit-Reviewer: Lior Vernia <lver...@redhat.com> Gerrit-Reviewer: Mike Kolesnik <mkole...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@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