[libvirt] [PATCH] add compress stream support

Daniel P. Berrange berrange at redhat.com
Wed Sep 23 13:18:01 UTC 2015

On Wed, Sep 23, 2015 at 03:20:51PM +0300, Vasiliy Tolstov wrote:
> 2015-09-23 14:54 GMT+03:00 Daniel P. Berrange <berrange at redhat.com>:
> > How have you actually tested this in practice - your patch does
> > not change any code to make use of this new feate. You're changing
> > the public API which suggests you expect the client apps to use
> > this when passing a virStreamPtr to the virStorageVolDownload
> > method, but the stream client apps pass is not backed by a
> > virFDStream object. Only libvirtd uses the virFDSteam objects
> > and you've not changed anything to make use ot that. So this is
> > all rather strange still. Can you more clearly state what you
> > are expecting to do.
> As i'm understand client create stream via virStreamNew , when user
> invoke virStoreVolDownload this function use created stream.
> If i'm correct, libvirt when read/write in
> virStoreVolDownload/virStoreVolUpload uses fdstream functions
> internally. So data compressed or decompressed.
> Or when client create virStreamNew and pass it libvirt not always use
> fdstream functions ?

It is not quite that simple because we have a client/server architecture.

So the client app creates a virStreamPtr. This is used by the remote
driver, via a virNetClientStream object to tunnel data over the
libvirtd connection.

The libvirtd daemon then creates another virStreamPtr object. This is
used by the straoge driver, via the virFDStream object to fetch the
data the client is requesting.

So having the client app request compression on its virStreamPtr
does not work, because that stream object is not the one used
by the virFDStream code.

An alternative approach would be to not try to change the stream API
at all.

Instead pass flags to the virStorageVolDownload/Upload functions,
eg VIR_STORAGE_VOL_STREAM_COMPRESS_ZLIB. This flag would get passed
across to the storage driver, which can then turn on compression in
the virFDStream impl. This would require

 - Add the enum flags to include/libvirt/libvirt-storage.h
 - Add libarchive support to src/fdstream.c
 - Handle the new flags in src/storage/storage_driver.c to
   turn on the libarchive compression in fdsream.c

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the libvir-list mailing list