Moti Asayag has posted comments on this change. Change subject: engine,webadmin: add canDo action to check it qos exists on VnicProfile ......................................................................
Patch Set 3: Code-Review+2 (5 comments) .................................................... Commit Message Line 6: Line 7: engine,webadmin: add canDo action to check it qos exists on VnicProfile Line 8: Line 9: Add canDoAction to AddVnicProfileCommand and UpdateVnicProfileCommand Line 10: to check that the vnicProfileId on the commands parameters exists. s/vnicProfileId/networkQosId Line 11: Line 12: Change-Id: I6b4ad298c55ca0f3daef99ff333f800202476eff .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VnicProfileValidator.java Line 22: Line 23: private VnicProfile vnicProfile; Line 24: private VnicProfile oldVnicProfile; Line 25: private Network network; Line 26: private NetworkQoS networkQos; there is no need to cache the variable since it isn't being used more than once. Line 27: private List<VnicProfile> vnicProfiles; Line 28: private List<VM> vms; Line 29: Line 30: public VnicProfileValidator(VnicProfile vnicProfile) { Line 51: return new NetworkValidator(getNetwork()).networkIsSet(); Line 52: } Line 53: Line 54: public ValidationResult networkQosExistsOrNull() { Line 55: return vnicProfile.getNetworkQosId() != null && getNetworkQos() == null be positive: return vnicProfile.getNetworkQosId() == null || getNetworkQos() != null ? ValidationResult.VALID : new ValidationResult(VdcBllMessages.NETWORK_QOS_NOT_EXISTS) ; Line 56: ? new ValidationResult(VdcBllMessages.NETWORK_QOS_NOT_EXISTS) Line 57: : ValidationResult.VALID; Line 58: } Line 59: Line 135: Line 136: return network; Line 137: } Line 138: Line 139: protected NetworkQoS getNetworkQos() { this method isn't required. please inline. Line 140: if (networkQos == null) { Line 141: networkQos = getDbFacade().getQosDao().get(vnicProfile.getNetworkQosId()); Line 142: } Line 143: .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java Line 385: NETWORK_HOST_IS_BUSY(ErrorType.CONFLICT), Line 386: ACTION_TYPE_FAILED_NETWORK_NAME_IN_USE(ErrorType.CONFLICT), Line 387: ACTION_TYPE_FAILED_NETWORK_IN_USE(ErrorType.CONFLICT), Line 388: NETWORK_NOT_EXISTS(ErrorType.BAD_PARAMETERS), Line 389: NETWORK_QOS_NOT_EXISTS(ErrorType.BAD_PARAMETERS), s/NETWORK_QOS_NOT_EXISTS/ACTION_TYPE_FAILED_NETWORK_QOS_NOT_EXISTS (make sure to change properties files as well) Line 390: NETWORK_NOT_EXISTS_IN_CLUSTER(ErrorType.BAD_PARAMETERS), Line 391: NETWORK_OLD_NETWORK_NOT_SPECIFIED(ErrorType.BAD_PARAMETERS), Line 392: NETWORK_CAN_NOT_REMOVE_DEFAULT_NETWORK(ErrorType.CONSTRAINT_VIOLATION), Line 393: NETWORK_VLAN_IN_USE(ErrorType.CONFLICT), -- To view, visit http://gerrit.ovirt.org/17974 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6b4ad298c55ca0f3daef99ff333f800202476eff Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <alkap...@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