From: Richard Jones Date: Fri, 30 Apr 2010 09:51:49 +0000 (+0100) Subject: lvresize: Use --force so it can make LVs smaller (RHBZ#587484). X-Git-Tag: 1.3.9~4 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=c24de46d06cc3ecccf00bfaaffb06172659cdd0a;p=libguestfs.git lvresize: Use --force so it can make LVs smaller (RHBZ#587484). This also adds a regression test for this bug. --- diff --git a/daemon/lvm.c b/daemon/lvm.c index e44f4c2..18d6519 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -267,7 +267,7 @@ do_lvresize (const char *logvol, int mbytes) r = command (NULL, &err, "lvm", "lvresize", - "-L", size, logvol, NULL); + "--force", "-L", size, logvol, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); diff --git a/src/generator.ml b/src/generator.ml index 14cf462..766327e 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2585,7 +2585,14 @@ are activated or deactivated."); ["e2fsck_f"; "/dev/VG/LV"]; ["resize2fs"; "/dev/VG/LV"]; ["mount_options"; ""; "/dev/VG/LV"; "/"]; - ["cat"; "/new"]], "test content")], + ["cat"; "/new"]], "test content"); + InitNone, Always, TestRun ( + (* Make an LV smaller to test RHBZ#587484. *) + [["part_disk"; "/dev/sda"; "mbr"]; + ["pvcreate"; "/dev/sda1"]; + ["vgcreate"; "VG"; "/dev/sda1"]; + ["lvcreate"; "LV"; "VG"; "20"]; + ["lvresize"; "/dev/VG/LV"; "10"]])], "resize an LVM logical volume", "\ This resizes (expands or shrinks) an existing LVM logical