Allow shrinking of file based volumes
Allow shrinking of file based volumes

While the main storage driver code allows the flag
VIR_STORAGE_VOL_RESIZE_SHRINK to be set, none of the backend
drivers are supporting it. At the very least this can work
for plain file based volumes since we just ftruncate() them
to the new size. It does not work with qcow2 volumes, but we
can arguably delegate to qemu-img for error reporting for that
instead of second guessing this for ourselves:

$ virsh vol-resize --shrink /home/berrange/VirtualMachines/demo.qcow2 2G
error: Failed to change size of volume 'demo.qcow2' to 2G

error: internal error: Child process (/usr/bin/qemu-img resize /home/berrange/VirtualMachines/demo.qcow2 2147483648) unexpected exit status 1: qemu-img: qcow2 doesn't support shrinking images yet
qemu-img: This image does not support resize

See also https://bugzilla.redhat.com/show_bug.cgi?id=1021802

datto/libvirt,libvirt/libvirt,shugaoye/libvirt,agx/libvirt,zippy2/libvirt,libvirt/libvirt,VenkatDatta/libvirt,taget/libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,shugaoye/libvirt,olafhering/libvirt,olafhering/libvirt,andreabolognani/libvirt,jardasgit/libvirt,olafhering/libvirt,eskultety/libvirt,rlaager/libvirt,jfehlig/libvirt,nertpinx/libvirt,agx/libvirt,jfehlig/libvirt,rlaager/libvirt,crobinso/libvirt,andreabolognani/libvirt,olafhering/libvirt,VenkatDatta/libvirt,taget/libvirt,crobinso/libvirt,fabianfreyer/libvirt,crobinso/libvirt,nertpinx/libvirt,andreabolognani/libvirt,nertpinx/libvirt,eskultety/libvirt,datto/libvirt,taget/libvirt,datto/libvirt,zippy2/libvirt,zippy2/libvirt,rlaager/libvirt,zippy2/libvirt,shugaoye/libvirt,eskultety/libvirt,taget/libvirt,agx/libvirt,jfehlig/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,datto/libvirt,fabianfreyer/libvirt,crobinso/libvirt,rlaager/libvirt,libvirt/libvirt,libvirt/libvirt,fabianfreyer/libvirt,taget/libvirt,jardasgit/libvirt,rlaager/libvirt,jardasgit/libvirt,eskultety/libvirt,datto/libvirt,agx/libvirt,jfehlig/libvirt,jardasgit/libvirt,shugaoye/libvirt,jardasgit/libvirt,agx/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,VenkatDatta/libvirt,shugaoye/libvirt,eskultety/libvirt,nertpinx/libvirt