Gilad Chaplik has posted comments on this change. Change subject: core: Add CRUD commands and queries for QoS objects (storage) ......................................................................
Patch Set 19: (7 comments) http://gerrit.ovirt.org/#/c/27096/19/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQosByIdQuery.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQosByIdQuery.java: Line 9: } Line 10: Line 11: @Override Line 12: protected void executeQueryCommand() { Line 13: getQueryReturnValue().setReturnValue(getDbFacade().getStorageQosDao().get(getParameters().getId())); > this one should be "generic" as well, [please replace getDbFacade().getStor getQosDao() is currently used by networkQos. should be done in a later patch. Line 14: } Line 15: http://gerrit.ovirt.org/#/c/27096/19/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/QosCommandBase.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/QosCommandBase.java: Line 61: Line 62: @Override Line 63: public Guid getStoragePoolId() { Line 64: if (super.getStoragePoolId() == null) { Line 65: setStoragePoolId(getQos().getStoragePoolId()); > NPE if qos is null Done Line 66: } Line 67: return super.getStoragePoolId(); Line 68: } Line 69: Line 75: } Line 76: Line 77: @Override Line 78: public List<PermissionSubject> getPermissionCheckSubjects() { Line 79: return Collections.singletonList(new PermissionSubject(getStoragePoolId(), > what if the poolid is null? should be dealt by mla infra, no? Line 80: VdcObjectType.StoragePool, getActionType().getActionGroup())); Line 81: } Line 82: Line 83: protected abstract QosDao<T> getQosDao(); http://gerrit.ovirt.org/#/c/27096/19/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/QosValidator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/QosValidator.java: Line 23: } Line 24: Line 25: protected T getOldQos() { Line 26: if (oldQos == null) { Line 27: oldQos = getQosDao().get(qos.getId()); > if qos is null NPE will be thrown.. Done Line 28: } Line 29: return oldQos; Line 30: } Line 31: Line 41: /** Line 42: * Verify that the QoS entity had previously existed in the database. Line 43: */ Line 44: public ValidationResult qosExists() { Line 45: return (qos != null && getOldQos() == null) > this needs a little touch, qos can't be null all over. will throw an exception in c'tor if qos == null. Line 46: ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_NOT_FOUND) Line 47: : ValidationResult.VALID; Line 48: } Line 49: Line 49: Line 50: /** Line 51: * Verify that the QoS entity has the same DC ID as the one stored in the database. Line 52: */ Line 53: public ValidationResult consistentDataCenter() { > /s/consistentDataCenter/dataCenterUnchanged why? Line 54: return (qos != null && (getOldQos() == null || !qos.getStoragePoolId().equals(getOldQos().getStoragePoolId()))) Line 55: ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_INVALID_DC_ID) Line 56: : ValidationResult.VALID; Line 57: } Line 51: * Verify that the QoS entity has the same DC ID as the one stored in the database. Line 52: */ Line 53: public ValidationResult consistentDataCenter() { Line 54: return (qos != null && (getOldQos() == null || !qos.getStoragePoolId().equals(getOldQos().getStoragePoolId()))) Line 55: ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_INVALID_DC_ID) > if qos==null you shouldn't get VALID, Done Line 56: : ValidationResult.VALID; Line 57: } Line 58: Line 59: /** -- To view, visit http://gerrit.ovirt.org/27096 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1a9af59277b5055453159f002f19046c00522ddb Gerrit-PatchSet: 19 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Daniel Erez <[email protected]> Gerrit-Reviewer: Doron Fediuck <[email protected]> Gerrit-Reviewer: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Kobi Ianko <[email protected]> Gerrit-Reviewer: Liron Aravot <[email protected]> Gerrit-Reviewer: Maor Lipchuk <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
