v2 of:
https://www.redhat.com/archives/libvir-list/2016-April/msg01869.html
diff to v1:
- Reworked public API side of the feature. Event approach is no
longer used. Instead I've implemented synchronous APIs as Dan
suggested.
You can find the code at my github repo too:
https://github.com/zippy2/libvirt/tree/sparse_streams2
BTW: here is a measurement I made:
homer libvirt.git # time ./tools/virsh -c qemu+tcp://lisa/system vol-download
/mnt/cdrom/dummy.img /tmp/dummy.img
real 3m9.178s
user 0m32.978s
sys 1m7.758s
homer libvirt.git # time ./tools/virsh -c qemu+tcp://lisa/system vol-download --sparse
/mnt/cdrom/dummy.img /tmp/dummy.img
real 0m1.409s
user 0m0.017s
sys 0m1.042s
masina libvirt.git # ls -lhs /tmp/dummy.img
4.0K -rw-r--r-- 1 root root 21G May 23 17:53 /tmp/dummy.img
Michal Privoznik (32):
Introduce virStreamRecvFlags
Implement virStreamRecvFlags to some drivers
Introduce virStreamSkip
Introduce virStreamHoleSize
Introduce VIR_STREAM_RECV_STOP_AT_HOLE flag
Introduce virStreamSparseRecvAll
Introduce virStreamSparseSendAll
Introduce virStreamInData
virNetClientStreamNew: Track origin stream
Track if stream is skippable
RPC: Introduce virNetStreamSkip
Introduce VIR_NET_STREAM_SKIP message type
Teach wireshark plugin about VIR_NET_STREAM_SKIP
daemon: Introduce virNetServerProgramSendStreamSkip
virnetclientstream: Introduce virNetClientStreamSendSkip
daemon: Implement VIR_NET_STREAM_SKIP handling
virnetclientstream: Introduce virNetClientStreamHandleSkip
remote_driver: Implement virStreamSkip
virNetClientStreamRecvPacket: Introduce @flags argument
Introduce virNetClientStreamHoleSize
remote: Implement virStreamHoleSize
virNetClientStream: Wire up VIR_NET_STREAM_SKIP
remote_driver: Implement VIR_STREAM_RECV_STOP_AT_HOLE
daemonStreamHandleRead: Wire up seekable stream
fdstream: Implement seek
gendispatch: Introduce @sparseflag for our calls
Introduce virStorageVol{Download,Upload}Flags
virsh: Implement sparse stream to vol-download
virsh: Implement sparse stream to vol-upload
daemon: Don't call virStreamInData so often
fdstream: Suppress use of IO helper for sparse streams
storage: Enable sparse streams for virStorageVol{Download,Upload}
daemon/remote.c | 2 +-
daemon/stream.c | 147 +++++++++++-
daemon/stream.h | 3 +-
include/libvirt/libvirt-storage.h | 9 +
include/libvirt/libvirt-stream.h | 86 ++++++-
src/driver-stream.h | 23 ++
src/esx/esx_stream.c | 16 +-
src/fdstream.c | 117 ++++++++-
src/libvirt-storage.c | 4 +-
src/libvirt-stream.c | 454 +++++++++++++++++++++++++++++++++++
src/libvirt_internal.h | 3 +
src/libvirt_private.syms | 1 +
src/libvirt_public.syms | 10 +
src/libvirt_remote.syms | 3 +
src/remote/remote_driver.c | 89 ++++++-
src/remote/remote_protocol.x | 2 +
src/rpc/gendispatch.pl | 21 +-
src/rpc/virnetclient.c | 1 +
src/rpc/virnetclientstream.c | 203 +++++++++++++++-
src/rpc/virnetclientstream.h | 17 +-
src/rpc/virnetprotocol.x | 16 +-
src/rpc/virnetserverprogram.c | 33 +++
src/rpc/virnetserverprogram.h | 7 +
src/storage/storage_backend.c | 6 +-
src/storage/storage_driver.c | 4 +-
src/virnetprotocol-structs | 4 +
tools/virsh-volume.c | 49 ++--
tools/virsh.c | 93 +++++++
tools/virsh.h | 17 ++
tools/virsh.pod | 6 +-
tools/wireshark/src/packet-libvirt.c | 40 +++
tools/wireshark/src/packet-libvirt.h | 2 +
32 files changed, 1419 insertions(+), 69 deletions(-)
--
2.8.3