Tuesday, October 23, 2018

Re: parsing GWT messages in oVirt project (webadmin interface)

Dear Thomas,
thank you a lot for a detailed answer!

I saw this documentation, but seems should look more thoroughly into serialization inside GWT.

Concerning the numbers 0|5|0|0|0 - after VmOperationParameterBase class where there is a private field vmId we move down to ActionParameterBase class (as you said), so 0 here will correspond to the first parameter inside this class in alphabetical order (seems commanId)? And five - to some value or to a type of parameter? (sometimes it is not clear does the payload mean the type or the value itself). There is a field there - ActionType commandType; which has type 5.

вторник, 23 октября 2018 г., 13:26:06 UTC+3 пользователь Thomas Broyer написал:
On Tuesday, October 23, 2018 at 11:46:56 AM UTC+2, Anastasiya Ruzhanskaya wrote:
Hello all!
I am working with oVirt (which helps to manage virtual machines) project and it uses GWT RPC protocol in it's communications.
I want to parse messages in GWT RPC format which I get after deciphering the traffic.

I hope that even without being totally familiar with the ovirt project, someone will be able to help me a little bit.

I already separated it on some meaningful parts), numbers in braces just help to make correspondence between payload and strings:
(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|, // type1
(6)java.util.ArrayList/4159755760|, // type2
(7)Z| // type3 (bool)
(8)org.ovirt.engine.core.common.action.ShutdownVmParameters/1694554255| // class which contains uuid of the virtual machine
(10)java.util.UUID/2940008275| // seems the uuid of the virtual machine)
(the following is the payload separated and commented in places where I can understand it)
4|- 4 method parameters
5|- first type = ActionType
6|- second type = arraylist
7|- third type = boolean
7|- fourth type = boolean
5(actionType)|9 (shutdown)|
8 (shutdown vm parameters, list object)|1|0|0|0|(??)
9 (guid, ?)|10(UUID)|J$m4mk9wVi3|MjeP460Xkpb (vm uuid)|0|5|0|0|0|11|1|0|6|0|0|0|0|0|0|12|0|-6|13|0|1|0|1|14|2|0|0|0|0|0|

Until virtual machine uuid parameter it is kind of clear what is happening, but I still wonder what do the parameters 1 and 0 mean in places marked as (??). I understand, that there is a method called runMultipleActions and it has four parameters. I found in source examples of calling this method .Then I determine types of these parameters. Then the type of action performed ( I shut down the machine). Then  there should be an ArrayList, which contains several objects. I assume that 8(shutdown vm parameters) should follow right after 6 (arraylist), but there a "1" which I can't explain. Also I don't know what for are these four boolean values (1|0|0|0) What do they mean? And how can I cope with the left payload?

This is the example of the call from ovirt source code:

ArrayList<ActionParametersBase> parameters = new ArrayList<>();
.add(new ActionParametersBase());
.add(new ActionParametersBase());
.runMultipleAction(ActionType.AddLocalStorageDomain, parameters, false, mockMultipleActionCallback,

Thank you in advance for any help!

I know this is kind of specific for oVirt but probably there is something more that I should know about parsing the messages ( in the internet I found a couple of articles about this, which helped me to understand the first part of the message).

The first value after the ArrayList runtime type is its length (see [1] and [2]). In this case, the list contains only one item.

Then, according to the doc, the fields of the ShutdownVmParameters are serialized in alphabetical order, walking up the class hierarchy. So the first boolean would be ShutdownVmParameters#waitBeforeShutdown (boolean true), followed by StopVmParametersBase#stopReason (0 means null), then VmOperationParameterBase#quotaId (again a null), and VmOperationParameterBase#rerun (boolean false).
This is then followed by VmOperationParameterBase#vmId, which is a Guid, itself having a single field of type UUID, which is serialized as a pair of longs by a UUID_CustomFieldSerializer [3], as you correctly identified.
Following would be the ActionParametersBase [4] fields, followed by the last 2 method arguments.

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