diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2017-05-22 07:57:26 +0200 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2017-05-23 13:43:12 +0200 |
commit | 1f42d8629f7fa516ebe8e02b74cbeba1e46aab4e (patch) | |
tree | 8222a8dde08402c1ab9597b369052140081cfb6d /libvirt-override-virStream.py | |
parent | d8c880a10e4a170ac452dfb3da5a6f42b11e99c0 (diff) | |
download | libvirt-python-1f42d8629f7fa516ebe8e02b74cbeba1e46aab4e.tar.gz |
Implement virStreamSendHole/virStreamRecvHole
The return value for virStreamRecvHole is slightly different to
its C counterpart. In python, either it returns the hole size or
None if C API fails.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'libvirt-override-virStream.py')
-rw-r--r-- | libvirt-override-virStream.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py index 2e77cc7..62c1328 100644 --- a/libvirt-override-virStream.py +++ b/libvirt-override-virStream.py @@ -125,3 +125,24 @@ ret = libvirtmod.virStreamSend(self._o, data) if ret == -1: raise libvirtError ('virStreamSend() failed') return ret + + def recvHole(self, flags = 0): + """This method is used to determine the length in bytes + of the empty space to be created in a stream's target + file when uploading or downloading sparsely populated + files. This is the counterpart to sendHole. + """ + ret = libvirtmod.virStreamRecvHole(self._o, flags) + if ret is None: raise libvirtError ('virStreamRecvHole() failed') + return ret + + def sendHole(self, length, flags = 0): + """Rather than transmitting empty file space, this method + directs the stream target to create length bytes of empty + space. This method would be used when uploading or + downloading sparsely populated files to avoid the + needless copy of empty file space. + """ + ret = libvirtmod.virStreamSendHole(self._o, length, flags) + if ret == -1: raise libvirtError('virStreamSendHole() failed') + return ret |