Yair Zaslavsky has posted comments on this change. Change subject: engine: Prevents duplicates parameters in multiple actions ......................................................................
Patch Set 1: (6 comments) http://gerrit.ovirt.org/#/c/36102/1//COMMIT_MSG Commit Message: Line 11: However, it turns out that due to a mysterious bug, in few Line 12: flows the UI provides the same paramter more than once which Line 13: might lead to unexpected behavior (i.e. infinite locked vm). Line 14: Line 15: By replacing the parameters collection type to list we prevents replacing to set? Line 16: that from happen, and each parameter class will implement its Line 17: own euqals() and hasCode() method to enforce the uniqueness. Line 18: Line 19: Change-Id: Ic874d31535d2189f934d629e689aa7a534c165d5 Line 12: flows the UI provides the same paramter more than once which Line 13: might lead to unexpected behavior (i.e. infinite locked vm). Line 14: Line 15: By replacing the parameters collection type to list we prevents Line 16: that from happen, and each parameter class will implement its we prevent that from happening. Line 17: own euqals() and hasCode() method to enforce the uniqueness. Line 18: Line 19: Change-Id: Ic874d31535d2189f934d629e689aa7a534c165d5 Line 13: might lead to unexpected behavior (i.e. infinite locked vm). Line 14: Line 15: By replacing the parameters collection type to list we prevents Line 16: that from happen, and each parameter class will implement its Line 17: own euqals() and hasCode() method to enforce the uniqueness. methods Line 18: Line 19: Change-Id: Ic874d31535d2189f934d629e689aa7a534c165d5 http://gerrit.ovirt.org/#/c/36102/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java: Line 37: public MultipleActionsRunner(VdcActionType actionType, List<VdcActionParametersBase> parameters, CommandContext commandContext, boolean isInternal) { Line 38: this.actionType = actionType; Line 39: this.isInternal = isInternal; Line 40: this.commandContext = commandContext; Line 41: this.parameters = new LinkedHashSet<>(parameters); I wonder, why LinkedHashSet ? Line 42: } Line 43: Line 44: protected Set<VdcActionParametersBase> getParameters() { Line 45: return parameters; http://gerrit.ovirt.org/#/c/36102/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmFromPoolRunner.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmFromPoolRunner.java: Line 62: return getFirstParam() != null ? getFirstParam().getVmPoolId() : null; Line 63: } Line 64: Line 65: private RemoveVmFromPoolParameters getFirstParam() { Line 66: Iterator<VdcActionParametersBase> iterator = getParameters() == null ? null : getParameters().iterator(); > since we don't really need the VdcActionParametersBase type I would change I almost wrote i disagree, but since instanceof is used anyway, I agree :) Line 67: if (iterator != null && iterator.hasNext()) { Line 68: VdcActionParametersBase param = iterator.next(); Line 69: if (param instanceof RemoveVmFromPoolParameters) { Line 70: return ((RemoveVmFromPoolParameters) param); http://gerrit.ovirt.org/#/c/36102/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainsMultipleActionRunner.java: Line 37: for (VdcActionParametersBase param : getParameters()) { Line 38: storageDomainIds.add(((StorageDomainPoolParametersBase) param).getStorageDomainId()); Line 39: } Line 40: ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); Line 41: parameters.add(new StoragePoolWithStoragesParameter(pool, storageDomainIds, parameter.getSessionId())); some unrelated noise? Line 42: if (isInternal) { Line 43: return Backend.getInstance().runInternalMultipleActions(VdcActionType.AddStoragePoolWithStorages, Line 44: parameters); Line 45: } else { -- To view, visit http://gerrit.ovirt.org/36102 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic874d31535d2189f934d629e689aa7a534c165d5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <[email protected]> Gerrit-Reviewer: Arik Hadas <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
