Storage: ZFS: implement resizeVol method to support native resize
ZFS doesn't have thick allocations, every allocation is
thin-provisioned, so resize operation is essentially
a zvol size limit change
(zfs set volsize=X pool/zvol_name).
Shrink is allowed too (which leads to data destruction), but shrink restriction is already implemented in libvirt, so this function doesn't need to check anything.
This is my first contribution to libvirt, feel free to tell anything I should do to get this PR merged, thank you!
How it was tested: I've build it and checked on live server that now I can successfully resize zvol volumes:
virsh # vol-create-as --pool rpool --name vol1 --capacity 1G
Vol vol1 created
virsh # vol-resize --pool rpool --capacity 2G --vol vol1
Size of volume 'vol1' successfully changed to 2G
virsh # vol-resize --pool rpool --capacity 3G --vol vol1
Size of volume 'vol1' successfully changed to 3G
# Test shrink check
virsh # vol-resize --pool rpool --capacity 1G --vol vol1
error: Failed to change size of volume 'vol1' to 1G
error: invalid argument: can't shrink capacity below existing allocation
$ sudo zpool history
...
2025-07-11.14:34:23 zfs create -V 1048576K rpool/disks/vol1
2025-07-11.14:37:27 zfs set volsize=2147483648 rpool/disks/vol1
2025-07-11.14:38:01 zfs set volsize=3221225472 rpool/disks/vol1
Edited by George Melikov