From db901b4130518717aec43818441bd26cbebbc85f Mon Sep 17 00:00:00 2001 From: Kadin Sayani Date: Mon, 7 Oct 2024 20:06:36 -0600 Subject: [PATCH] tests/storage-vm: Add test for live resizing of VM disks with zfs or lvm pool driver Signed-off-by: Kadin Sayani --- tests/storage-vm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/storage-vm b/tests/storage-vm index f1f8532c..3ed84e15 100755 --- a/tests/storage-vm +++ b/tests/storage-vm @@ -281,9 +281,25 @@ for poolDriver in $poolDriverList; do echo "==> Testing VM optimized export/import (while running to check config.mount is excluded)" ! lxc export v1 --quiet --compression=none - --optimized-storage | tar -tf - | grep -F config.mount || false - echo "==> Increasing VM root disk size for next boot (24GiB)" - lxc config device set v1 root size=24GiB - [ "$(lxc config get v1 volatile.root.apply_quota)" = "true" ] + LIVE_GROWING_SUPPORTED=0 + if hasNeededAPIExtension vm_zfs_storage_disk_live_resize && [ "${poolDriver}" = "zfs" ]; then + LIVE_GROWING_SUPPORTED=1 + elif hasNeededAPIExtension vm_lvm_storage_disk_live_resize; then + if [ "${poolDriver}" = "lvm" ] || [ "${poolDriver}" = "lvm-thin" ]; then + LIVE_GROWING_SUPPORTED=1 + fi + fi + + if [ "${LIVE_GROWING_SUPPORTED}" = 1 ]; then + echo "==> Checking live root disk device resize support with ${poolDriver} backend" + lxc config device set v1 root size=16GiB + [ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_root) / GiB))" -eq "16" ] + [ "$(lxc config get v1 volatile.root.apply_quota)" = "" ] + else + echo "==> Increasing VM root disk size for next boot (24GiB)" + lxc config device set v1 root size=24GiB + [ "$(lxc config get v1 volatile.root.apply_quota)" = "true" ] + fi if [ "${poolDriver}" != "powerflex" ]; then echo "==> Check VM online shrink is allowed if it greater or equal to initial size"