]> xenbits.xensource.com Git - libvirt.git/commit
storage_backend: Fix issue with allocation of 0 length volume
authorJohn Ferlan <jferlan@redhat.com>
Wed, 9 Oct 2013 13:03:25 +0000 (09:03 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 10 Oct 2013 12:33:04 +0000 (08:33 -0400)
commit77fb4c4f9ee0f99b7bfafef2126f9fc85e910ef8
treee8fa97a01a98a12e24cbca0b2ac5ac9135ab5ace
parent9c228e08175bdd76372c236298ce129d9a64e0d8
storage_backend: Fix issue with allocation of 0 length volume

Commit id '532fef36' added a call to fallocate() and some error
handling based on whether or not the function existed. This new
call resulted in libvirt-cim/cimtest failures when attempting to
create a volume with "0" (zero) allocation value. The failure is
logged as:

Oct  9 07:51:33 localhost libvirtd[8030]: cannot allocate 0 bytes in
file '/var/lib/libvirt/images/cimtest-vol.img': Invalid argument

This can also be seen with virsh vol-create-as:

error: Failed to create vol test
error: cannot allocate 0 bytes in file '/home/vm-images/test': Invalid
argument

error: Failed to create vol test
error: cannot allocate 0 bytes in file '/home/vm-images/test': Invalid
argument

It turns out fallocate() will return EINVAL when the incoming 'len'
(or allocation) value is 0 (or less).
src/storage/storage_backend.c