[libvirt] [PATCH v2] lib: Add note that bulk stats API queries may overrun RPC buffers

Richard W.M. Jones rjones at redhat.com
Wed May 24 12:42:44 UTC 2017


On Tue, May 23, 2017 at 05:07:40PM +0200, Michal Privoznik wrote:
> Because:
> 
> https://www.redhat.com/archives/libvir-list/2017-May/msg00088.html

I don't think this is a reason at all.

Libguestfs uses an RPC system which was modelled on the libvirt one,
and has exactly the same problem with message size limits, except
smaller -- 4MB and we've never had to increase it.

We get around this by batching operations over messages as necessary
(eg [1]).  This adds a little complexity in the implementation of the
API, but the point is that the complexity is entirely hidden to users
of the APIs.

Rich.

[1] https://github.com/libguestfs/libguestfs/blob/master/lib/file.c#L375-L415

In this code, ‘guestfs_impl_lstatnslist’ is the publicly visible API
(it's the implementation of the public API guestfs_lstatnslist).
‘guestfs_internal_lstatnslist’ is the message which travels over the
RPC.  The batching of 1000 requests per message was chosen based on
pathname limits on Linux so that each request will always fit into a
single message.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the libvir-list mailing list