Arik Hadas has posted comments on this change.

Change subject: core: filter duplicate requests to run the same vm
......................................................................


Patch Set 5:

(1 comment)

http://gerrit.ovirt.org/#/c/36009/5/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVMActionRunner.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVMActionRunner.java:

Line 24:     protected List<VdcActionParametersBase> 
validateParameters(List<VdcActionParametersBase> parameters) {
Line 25:         Set<VdcActionParametersBase> set = new TreeSet<>(new 
Comparator<VdcActionParametersBase>() {
Line 26:             @Override
Line 27:             public int compare(VdcActionParametersBase parameters1, 
VdcActionParametersBase parameters2) {
Line 28:                 Guid vmId1 = ((VmOperationParameterBase) 
parameters1).getVmId();
> What it really means is that we are missing some information about the acti
I don't think we're missing anything. we get the action to be executed and the 
parameters as an input, it's just that the infra is missing validation of 
whether the parameters match the patameters type the command expects to get.

see for example line 43 below - you know that you'll get RunVmCommand, and 
still you need to make unsafe cast to RunVmCommandBase. the infra side in this 
classes should be extended with generics to eliminate this casts.

I considered your suggestion to put it in the UI, but it would mean either:
1. check it in every place you call migrate/run in the UI - not nice
2. put it in a central place in the UI and filter the duplicate params for 
those actions - it is the same as putting this here

I think that from the API point of view it is better that the engine will 
validate its input instead of assuming the client pass validate input, don't 
you think?
Line 29:                 Guid vmId2 = ((VmOperationParameterBase) 
parameters2).getVmId();
Line 30:                 return vmId1 != null && vmId1.equals(vmId2) ? 0 : 1;
Line 31:             }
Line 32:         });


-- 
To view, visit http://gerrit.ovirt.org/36009
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I91320cfd50fc7a12b01afae2885a783c0516a6df
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Shahar Havivi <shav...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@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

Reply via email to