[Libvir] [PATCH] Remote 3/8: Client-side

Richard W.M. Jones rjones at redhat.com
Sat May 5 11:17:44 UTC 2007

Richard W.M. Jones wrote:
> 3 Client-side
> -------------
> A src/remote_internal.c
> A src/remote_internal.h
> M src/driver.h
> M src/libvirt.c

This is the code which serialises requests on the client side.  First up 
is a small patch against driver.h and libvirt.c which just declares and 
registers the new driver.

Secondly, the driver itself (remote_internal.h / remote_internal.c) 
which I will describe in more detail.

The header file is small and I think non-controversial.  It just 
declares the remoteRegister function and a handful of constants like 
paths and port numbers.

The driver itself (remote_internal.c) consists of the following parts, 
arranged here in the same order that they appear in the file:

(1) remoteOpen and associated, GnuTLS initialisation

This function and associated functions deals with parsing the remote 
URI, deciding which transport to use, deciding the URI to forward to the 
remote end, creating the transport (including initialising GnuTLS, 
forking ssh, ...), and verifying the server's certificate.

(2) The driver functions, remoteClose, remoteType, etc. etc.
(3) The network driver functions, remoteNetworkOpen, etc. etc.

For each function we serialise the parameters as an XDR remote_foo_args 
object, use the generic "call" function to dispatch the call, then 
deserialise the XDR remote_foo_ret return value.  Most of the heavy 
lifting for the RPC is done in the "call" function itself ...

(4) The RPC implementation (function "call"), error handling, 
serialisation of virDomainPtr and virNetworkPtr.

... which also deals with making error handling transparent.

There are also some functions at the bottom to handle serialising and 
deserialising virDomainPtr and virNetworkPtr.  We do this by essentially 
translating them into (name, UUID) pairs.

(5) Table of functions and registration.

And finally comes the table of functions and declaration of remoteRegister.

If you're having difficulty following XDR code, it may help to read this 
first: http://et.redhat.com/~rjones/xdr_tests/


Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421

Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.
Registered in England and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-remote-3of8-20070505.patch
Type: text/x-patch
Size: 1409 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070505/d9296452/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remote_internal.c
Type: text/x-csrc
Size: 78345 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070505/d9296452/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remote_internal.h
Type: text/x-chdr
Size: 1659 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070505/d9296452/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070505/d9296452/attachment-0007.bin>

More information about the libvir-list mailing list