[libvirt] [PATCH v2] virsh: Checking the volume capacity before uploading a new file.

Michal Privoznik mprivozn at redhat.com
Mon Jan 29 11:47:46 UTC 2018

On 01/23/2018 03:42 AM, Julio Faracco wrote:
> Hi Peter,
> I agree about "length" parameter.
> What I didn't understand is this error (check my test case):
> # virsh vol-create-as --pool disk-loop loop0 --capacity 20M
> # virsh vol-info loop0 disk-loop
> Name:           loop0
> Type:           file
> Capacity:       20.00 MiB
> Allocation:     20.00 MiB
> # dd if=/dev/zero of=/tmp/test bs=10M count=1
> # ls -l /tmp/test
> -rw-rw-r-- 1 julio julio 10485760 Jan 23 00:31 /tmp/test
> Now, let's upload 5M (partial):
> # virsh vol-upload loop0 /tmp/test --pool disk-loop --length 5242880
> error: cannot send data to volume loop0
> error: Library function returned error but did not set virError

This is a libvirt bug. Very likely introduced by me when writing the
sparse streams feature. Please report a bug unless you want to
investigate further. My quick glance at the issue suggests that the
problem lies in daemonStreamHandleWriteData() and the way end of stream
is handled. I mean, daemonStreamHandleWriteData() calls virStreamSend()
which in turn calls virFDStreamWrite(). On the last call, fdst->length
is equal fdst->offset which causes error. Well, it needs to cause stream

BTW: another problem is that virReportSystemError(ENOSPC) is not being
propagated to the client.


More information about the libvir-list mailing list