diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2010-09-27 17:06:14 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-09-27 18:28:34 +0100 |
commit | c6c030b64bab98602363485cb62a9e1d847d570e (patch) | |
tree | b5826f7ca4cbf47d28606ddebbd704f646e6521c /tools | |
parent | 0dc1f8e7aeb390e72125f459930850b8050318df (diff) | |
download | libguestfs-c6c030b64bab98602363485cb62a9e1d847d570e.tar.gz libguestfs-c6c030b64bab98602363485cb62a9e1d847d570e.tar.xz libguestfs-c6c030b64bab98602363485cb62a9e1d847d570e.zip |
Add test for virt-resize.
This tests a number of things which have caused problems for us:
- resizing PVs and LV content
- handling GPT format disks
- using qcow2 as a target disk format
- shrinking disk images
Note that the disk content is empty (not a real VM), but this is
adequate since all we want to test are the operations and calculations
done by virt-resize. We are not interested here in whether e2fsprogs
and LVM actually works.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 1 | ||||
-rwxr-xr-x | tools/test-virt-resize.sh | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index ab14fe0f..b92243c0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -86,6 +86,7 @@ TESTS = test-virt-cat.sh \ test-virt-list-filesystems.sh \ test-virt-ls.sh \ test-virt-make-fs.sh \ + test-virt-resize.sh \ test-virt-tar.sh endif diff --git a/tools/test-virt-resize.sh b/tools/test-virt-resize.sh new file mode 100755 index 00000000..75d51474 --- /dev/null +++ b/tools/test-virt-resize.sh @@ -0,0 +1,31 @@ +#!/bin/bash - + +export LANG=C +set -e + +# Test expanding. +# +# This exercises a number of interesting codepaths including resizing +# LV content, handling GPT, and using qcow2 as a target. + +../fish/guestfish -N bootrootlv:/dev/VG/LV:ext2:ext4:400M:32M:gpt </dev/null + +qemu-img create -f qcow2 test2.img 500M +./virt-resize -d --expand /dev/sda2 --lv-expand /dev/VG/LV test1.img test2.img + +# Test shrinking in a semi-realistic scenario. Although the disk +# image created above contains no data, we will nevertheless use +# similar operations to ones that might be used by a real admin. + +../fish/guestfish -a test1.img <<EOF +run +resize2fs-size /dev/VG/LV 190M +lvresize /dev/VG/LV 190 +pvresize-size /dev/sda2 200M +fsck ext4 /dev/VG/LV +EOF + +rm -f test2.img; truncate -s 300M test2.img +./virt-resize -d --shrink /dev/sda2 test1.img test2.img + +rm -f test1.img test2.img |