[libvirt] creating stream

Michal Privoznik mprivozn at redhat.com
Fri Apr 21 11:14:09 UTC 2017


On 04/21/2017 12:12 PM, Vasiliy Tolstov wrote:
> 2017-04-20 21:14 GMT+03:00 Vasiliy Tolstov <v.tolstov at selfip.ru>:
>> I found , so i can decode all typed params to map[string]interface{} thanks!
>
>
> I'm try to add support for DomainOpenConsole and don't understand
> underline payload:
> https://gist.github.com/vtolstov/f8a0f80de82100440b1c0e824436be5a
>
> I'm not handmade this data, i'm use generator from remote_protocol.x
> to get request struct.
> If i compare to virsh payload i see , that payload size different.
> Virsh send 80 byte payload, but i send only 76.
> https://gist.github.com/vtolstov/56344b8ce309f54441f2dbce851f6b59
>
> type RemoteDomainOpenConsoleReq struct {
>   Domain  *RemoteDomain
>   DevName string
>   Flags   uint32
> }
>
> If i add to generated struct 4 empty bytes, and change order of
> variables inside all works fine, but flags not passed (because it
> shifted). But payload looks ok. So my question - what i miss in this
> specific case? (P.S. DomainScreenshot that have identical parts of
> call and workflow works fine for me using generated structs)
>
> type RemoteDomainOpenConsoleReq struct {
>   Domain  *RemoteDomain
> Flags  uint32
>   DevName string
>   Flags2   uint32
> }
>
>

That's how strings are encoded in RPC. the first four bytes say how long 
the string is followed by N bytes (padded to 4 bytes boundary) of the 
actual string.

Michal




More information about the libvir-list mailing list