Explicitely do not allocate initial space for virtual volumes

Initialize virtual volumes with no allocated initial space to prevent
consuming all space available during volume creation.
The behavior of virsh has changed, by default in the past the virtual
volumes were initialized automatically with no initial allocated space,
while with recent versions we need to specify explicitly to not
allocate initial space for the virtual volumes.

Change-Id: I588d0888c19304119af607433de6e35199f7c555
This commit is contained in:
Riccardo Pittau 2020-09-01 18:14:40 +02:00
parent 99e8fc9810
commit ce39115fa7
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ if ! virsh list --all | grep -q $NAME; then
fi
virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $vol_name &&
virsh vol-delete $vol_name --pool $LIBVIRT_STORAGE_POOL >&2
virsh vol-create-as $LIBVIRT_STORAGE_POOL ${vol_name} ${DISK}G --format $DISK_FORMAT $PREALLOC >&2
virsh vol-create-as $LIBVIRT_STORAGE_POOL ${vol_name} ${DISK}G --allocation 0 --format $DISK_FORMAT $PREALLOC >&2
volume_path=$(virsh vol-path --pool $LIBVIRT_STORAGE_POOL $vol_name)
# Pre-touch the VM to set +C, as it can only be set on empty files.
sudo touch "$volume_path"