[libvirt] [PATCH 0/8] Early preview: Re-factoring XDR RPC code

Daniel P. Berrange berrange at redhat.com
Wed Dec 1 17:26:26 UTC 2010


NB: This patch series isn't intended to be applied yet.

The current remote driver and libvirtd daemon have a horrible mix
of network I/O,  RPC dispatch and RPC handling functionality. It
it neccessary to introduce a new daemon to provide a lock manager
for VM disks. Doing so would effectively require cut+paste of a
large part of libvirtd code since there are no reusable APis in
it. Likewise for the client side.

To address this problem, this series is an attempt to produce a
reusable set of APIs for building RPC servers and clients. The
new APIs will handle all the networking/sockets functionality
and all the RPC dispatch/serialization/deserialization code.

This will enable libvirtd and the remote driver to be gutted,
so that they only contain the code for actually implementing
the RPC handlers. Thus a lock daemon + lock plugin can be
provided without any code duplication.

This will also make it far easier for us to introduce new
RPC programs, eg an administrative program to allow libvirtd
itself to be manipulated, say, to changing logging levels on
the fly, kill mis-behaving network client, etc, etc. It would
also make it practical to experiment with splitting libvirtd
up into smaller daemons each handling one area of functionality.
This would in turn make it practical to write useful SELinux
policy for confining libvirt daemons

This series is *far* from complete. The streams stuff is
completely missing in the new APis. I have also not yet gutted
libvirtd, only the remote driver. It is also not fully tested
for ABI wire compatibility with existing libvirtd, though I
believe it is correctly preserving ABI. 

The diffstat is slightly mis-leading because lots of code
remains to be deleted from daemon/libvirtd.c and
daemon/dispatch.c. None the less, it is expected that the
total lines will increase, but this wll be offset by the
improved code clarity and separation of functionality.

Daniel

 daemon/event.c                    |    3 
 src/Makefile.am                   |   90 +
 src/remote/remote_driver.c        | 2530 ++++++--------------------------------
 src/rpc/virnetclient.c            | 1237 ++++++++++++++++++
 src/rpc/virnetclient.h            |   60 
 src/rpc/virnetclientprogram.c     |  258 +++
 src/rpc/virnetclientprogram.h     |   71 +
 src/rpc/virnetclientsaslcontext.c |  246 +++
 src/rpc/virnetclientsaslcontext.h |   66 
 src/rpc/virnetmessage.c           |  215 +++
 src/rpc/virnetmessage.h           |   31 
 src/rpc/virnetprotocol.c          |  108 +
 src/rpc/virnetprotocol.h          |   81 +
 src/rpc/virnetprotocol.x          |  162 ++
 src/rpc/virnetserver.c            |  654 +++++++++
 src/rpc/virnetserver.h            |   74 +
 src/rpc/virnetserverclient.c      |  974 ++++++++++++++
 src/rpc/virnetserverclient.h      |   40 
 src/rpc/virnetservermessage.h     |   20 
 src/rpc/virnetserverprogram.c     |  437 ++++++
 src/rpc/virnetserverprogram.h     |   76 +
 src/rpc/virnetserverservice.c     |  208 +++
 src/rpc/virnetserverservice.h     |   32 
 src/rpc/virnetsocket.c            |  715 ++++++++++
 src/rpc/virnetsocket.h            |   97 +
 src/rpc/virnettlscontext.c        |  611 +++++++++
 src/rpc/virnettlscontext.h        |   63 
 src/util/logging.c                |    4 
 src/util/threadpool.c             |  178 ++
 src/util/threadpool.h             |   23 
 src/virtlockd.c                   |  620 +++++++++
 31 files changed, 7866 insertions(+), 2118 deletions(-)





More information about the libvir-list mailing list