Tuesday, October 23, 2018

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

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:
7|
0|
14|
(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
(9)org.ovirt.engine.core.compat.Guid/1992968158|
(10)java.util.UUID/2940008275| // seems the uuid of the virtual machine)
(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|
(the following is the payload separated and commented in places where I can understand it)
1|
2|
3|
4| 
4|- 4 method parameters
5|- first type = ActionType
6|- second type = arraylist
7|- third type = boolean
7|- fourth type = boolean
5(actionType)|9 (shutdown)|
6(arrayList)|1(??)|
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<>();
parameters
.add(new ActionParametersBase());
parameters
.get(0).setCommandId(Guid.Empty);
parameters
.add(new ActionParametersBase());
frontend
.runMultipleAction(ActionType.AddLocalStorageDomain, parameters, false, mockMultipleActionCallback,
                testState
);



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).

Fwiw, the GWT-RPC wire protocol is documented at https://docs.google.com/document/d/1eG0YocsYYbNAtivkLtcaiEE5IOF5u4LUol8-LL0TIKU/view

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.

[1] https://github.com/gwtproject/gwt/blob/2.8.2/user/src/com/google/gwt/user/client/rpc/core/java/util/ArrayList_CustomFieldSerializerBase.java
[2] https://github.com/gwtproject/gwt/blob/2.8.2/user/src/com/google/gwt/user/client/rpc/core/java/util/Collection_CustomFieldSerializerBase.java
[3] https://github.com/oVirt/ovirt-engine/blob/60b63cf01dd46721afa269f1fbbc16d0ade2257b/frontend/webadmin/modules/gwt-extension/src/main/java/com/google/gwt/user/client/rpc/core/java/util/UUID_CustomFieldSerializer.java
[4] https://github.com/oVirt/ovirt-engine/blob/60b63cf01dd46721afa269f1fbbc16d0ade2257b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/ActionParametersBase.java

--
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