2 # libguestfs virt-resize 2.0 test script
3 # Copyright (C) 2010-2011 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 # This exercises a number of interesting codepaths including resizing
25 # LV content, handling GPT, and using qcow2 as a target.
27 ../fish/guestfish -N bootrootlv:/dev/VG/LV:ext2:ext4:400M:32M:gpt </dev/null
29 qemu-img create -f qcow2 test2.img 500M
30 ./virt-resize -d --expand /dev/sda2 --lv-expand /dev/VG/LV test1.img test2.img
32 # Test shrinking in a semi-realistic scenario. Although the disk
33 # image created above contains no data, we will nevertheless use
34 # similar operations to ones that might be used by a real admin.
36 ../fish/guestfish -a test1.img <<EOF
38 resize2fs-size /dev/VG/LV 190M
39 lvresize /dev/VG/LV 190
40 pvresize-size /dev/sda2 200M
44 rm -f test2.img; truncate -s 300M test2.img
45 ./virt-resize -d --shrink /dev/sda2 test1.img test2.img
47 rm -f test1.img test2.img