Thursday, November 22, 2018

Re: Hash of a Java Type

7|
0|
14| <- there are always these three params, we are not interested in them
(1)https://engine.localdomain/ovirt-engine/webadmin/| //URL
(2)E8B2AD24442204349EF795039C3B87E5| //policy name
(3)org.ovirt.engine.ui.frontend.gwtservices.GenericApiGWTService| //service interface
(4)runMultipleActions|//name of the method
(5)org.ovirt.engine.core.common.action.ActionType/12242454|,
(6)java.util.ArrayList/4159755760|,
(7)Z| // bool type
(8)org.ovirt.engine.core.common.action. ShutdownVmParameters/1694554255|
(9)org.ovirt.engine.core.compat.Guid/1992968158|
(10)java.util.UUID/2940008275|
(11)org.ovirt.engine.core.common.action.ActionParametersBase$EndProcedure/1568822488|
(12)java.util.Collections$EmptyMap/4174664486|
(13)org.ovirt.engine.core.common.businessentities.VDSStatus/1938301532|
(14)org.ovirt.engine.core.compat.TransactionScopeOption/1475850853|
1|
2|
3|
4|
4|- method parameters
5|- first type = ActionType
6|- second type = arraylist
7|- third type = boolean
7|- fourth type = boolean
(after that description of each method parameter follows according to serialization rules described in doc)
5(actionType)|9(shutdown)|
6(arraylist)|1(1 element)|
8 (shutdown vm parameters, list object)|1|0|0|0|
9 (guid, ?)|10(UUID)|J$m4mk9wVi3|MjeP460Xkpb|
0(commandId)|
5(actiontype)|0(unknown)|
0(compensationEnabled)|
0(correlationId)|
11(endProcedure, enum)|1(enum value, default, parent managed)|
0(entityInfo (seems no info)|
6(executionReason)|
0(imagesParameters)|
0(jobId)|
0(jobWeight)|
0(lifeInMinutes)|
0(lockProperties)|
0(multipleActions)|
12(operationsJobWeight)|0(seems zero elem)|
-6(from jobweight to vds everything was already serialized, seems in parent call)|
13(VDSStatus, prevvdsstatus)|
0(sessionId, null)|
1(shouldBeLogged)|
0(stepId)|
1(taskGroupSuccess)|
14(TransactionScopeOption)|2(enum, =required)|
0(useCinderCommandCallback)|
0(vdsRunningOn, null, guid)|
0(vdsmTaskIds)|
0(first last bool param)|
0(second last bool param)|
Hello, Thomas,

I thought I could ask one more question as a continuation of this talk. I just saw that sessionIds on oVirt are declared as transient fields. This means they are not serialized, right?
Or just set to zero? (I just ask as I manged to match a zero value against this field in every message in ActionParametersBase)

public class ActionParametersBase implements Serializable, HasCorrelationId {
    private static final long serialVersionUID = 4872560145516614773L;

    private Guid commandId;
    private transient String sessionid;




пн, 5 нояб. 2018 г. в 20:57, Thomas Broyer <t.broyer@gmail.com>:
ActionReturnValue uses a CustomFieldSerializer: https://github.com/oVirt/ovirt-engine/blob/11580030b10331d6f671801206050b5cf393b229/frontend/webadmin/modules/gwt-extension/src/main/java/org/ovirt/engine/core/common/action/ActionReturnValue_CustomFieldSerializer.java

1 → ArrayList
1 → length
2 → ActionReturnValue
0 → isValid(boolean)
1 → validationMessages (arraylist)
3 → length
3 → String
4 →VAR_ACTION_RUN
3 → String
5 → VAR_TYPE_VM
3 → String
6 → USER_NOT_AUTHORIZED_TO_PERFORM_ACTION
1 → executeFailedMessages (arraylist)
0 → length
0 → succeeded(boolean)
0 →isSynchronous(boolean)
7 → description = "vm1"
1 → taskPlaceHolderIdList (arraylist)
0 → length
1 → vdsmTaskIdList (arraylist)
0 → length
1 → endActionTryAgain(boolean)
8 → fault (EngineFault)

On Monday, November 5, 2018 at 4:24:34 PM UTC+1, Anastasiya Ruzhanskaya wrote:
Hi!
Thank you for your answer.
I started to explore the answers which are sent using the same rules I suppose. But faced with some inconsistency.
Here is the example:

//OK[0,0,10,0,471,9,8,1,0,1,0,1,7||,0,0,0,1,6,3,5,3,4,3,3,1,0,2,1,1,[(1)"java.util.ArrayList/4159755760",(2)"org.ovirt.engine.core.common.action.ActionReturnValue/4163585948",(3)"java.lang.String/2004016611",(4)"VAR__ACTION__RUN",(5)"VAR__TYPE__VM",(6)"USER_NOT_AUTHORIZED_TO_PERFORM_ACTION",(7)"vm1",(8)"org.ovirt.engine.core.common.errors.EngineFault/2377218566",(9)"org.ovirt.engine.core.common.errors.EngineError/1938278732",(10)"ENGINE"],0,7]

1->"java.util.ArrayList/4159755760"

1->1 element

2->"org.ovirt.engine.core.common.action.ActionReturnValue/4163585948" (type of one value)

0->correlationId(string)


description (string) (??)
endActionTryAgain (boolean)(??)


1->executeFailedMessages(arraylist)

3-> 3 elements

3-> string type

4->"VAR__ACTION__RUN"

3->string type

5->"VAR__TYPE__VM"

3-> string type

6->"USER_NOT_AUTHORIZED_TO_PERFORM_ACTION"


8->fault(enginefault)

9->engineError

471->type of error


internalVdsmTaskIdList(arraylist) (??)
isSynchronous(boolean) (??)
jobId(guid) (??)
returnValue(object) (??)
succeeded(boolean)  (??)
taskPlaceHolderIdList(arraylist) (??)
valid(boolean) (??)
0->validationMessages(arraylist) (??)
0->vdsmTaskIdList(arraylist) (??)



I sorted the field of ActionReturn Value but the provided values do not really match them.

I would say that not sorted fields match better here. The two sequences I am sure in are 6,3,5,3,4,3,3,1 and 471,9,8

The sorted fields of ActionReturnValue are:


correlationId  description  endActionTryAgain  executeFailedMessages  fault  internalVdsmTaskIdList  isSynchronous  jobId  returnValue  succeeded  taskPlaceHolderIdList  valid  validationMessages  vdsmTaskIdList



вт, 30 окт. 2018 г. в 17:03, Thomas Broyer <t.broyer@gmail.com>:
The hash is a hash of the class, not the value. It's there to ensure that the client and server use the exact same classes, with the same fields, of the same types, in the same order.
This means that the value is dependent on the version of oVirt that you're using, and only on the version of oVirt. IIRC, you should be able to find them in the serialization policy files, or of course in the JS files running in the browser (the hash is computed at compile-time, not at runtime, at least on the client-side, can't remember on the server)
Whenever you update oVirt, the hashes might change, which means that the way the objects are serialized/deserialized has changed; this means you'll then need to update your proxy to account for the changes.

On Tuesday, October 30, 2018 at 1:51:13 PM UTC+1, Anastasiya Ruzhanskaya wrote:
Are there any ideas about this hash function?

пн, 29 окт. 2018 г. в 11:38, Anastasiya Ruzhanskaya <anastasiya.ruzhanskaya@frtk.ru>:
Hello!
I am trying to build a proxy, which will intercept requests from oVirt and send errors if the action should not be performed. I just need to implement it in such a manner due to some legacy issues with using internal access control.

I think that by importing some information from oVirt I can easily parse the message in order to find the action type and id of the object on which it is performed.

The problem is with the answer: I need to send the valid answer.
I created a user in oVirt which is a read-only user. So, I get the following answer:

//OK[0,0,10,0,471,9,8,1,0,1,0,1,7,0,0,0,1,6,3,5,3,4,3,3,1,0,2,1,1,["java.util.ArrayList/4159755760","org.ovirt.engine.core.common.action.ActionReturnValue/4163585948","java.lang.String/2004016611","VAR__ACTION__SHUTDOWN","VAR__TYPE__VM","USER_NOT_AUTHORIZED_TO_PERFORM_ACTION","vm1","org.ovirt.engine.core.common.errors.EngineFault/2377218566","org.ovirt.engine.core.common.errors.EngineError/1938278732","ENGINE"],0,7]

I think the answer should be always pretty the same (maybe only for some cases another one). The only thing which I find tricky here is how to generate a valid hash value?

I found a function in sources of GWT but it accepts a serialization policy and the custom serializers (which is not appropriate for me as for incoming requests I will always look for action type and then object, and for answers I want just to generate this type errors, which I provided above, so I want to include to my proxy as minimum additional information as possible).

So, I would like to find an easy way of generation this hash values (org.ovirt.engine.core.common.errors.EngineFault/2377218566). Or probably it is even possible not ti generate them at all?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment