From c24de46d06cc3ecccf00bfaaffb06172659cdd0a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 30 Apr 2010 10:51:49 +0100 Subject: [PATCH] lvresize: Use --force so it can make LVs smaller (RHBZ#587484). This also adds a regression test for this bug. --- daemon/lvm.c | 2 +- src/generator.ml | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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 -- 1.8.3.1