From: Richard Jones Date: Thu, 21 May 2009 15:17:38 +0000 (+0100) Subject: Add e2fsck_f command, and modify lvresize test to use it (RHBZ 502018). X-Git-Tag: 1.0.29~2 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=0f81d0941a2705d49bc129f69924265fa60d9677;p=libguestfs.git Add e2fsck_f command, and modify lvresize test to use it (RHBZ 502018). --- diff --git a/daemon/ext2.c b/daemon/ext2.c index 639ae5d..ab03528 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -253,3 +253,22 @@ do_resize2fs (const char *device) free (err); return 0; } + +int +do_e2fsck_f (const char *device) +{ + char *err; + int r; + + IS_DEVICE (device, -1); + + r = command (NULL, &err, "/sbin/e2fsck", "-p", "-f", device, NULL); + if (r == -1) { + reply_with_error ("e2fsck: %s", err); + free (err); + return -1; + } + + free (err); + return 0; +} diff --git a/src/generator.ml b/src/generator.ml index 5eb6122..d2451f0 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2114,6 +2114,7 @@ are activated or deactivated."); ["write_file"; "/new"; "test content"; "0"]; ["umount"; "/"]; ["lvresize"; "/dev/VG/LV"; "20"]; + ["e2fsck_f"; "/dev/VG/LV"]; ["resize2fs"; "/dev/VG/LV"]; ["mount"; "/dev/VG/LV"; "/"]; ["cat"; "/new"]], "test content")], @@ -2128,7 +2129,13 @@ is lost."); "resize an ext2/ext3 filesystem", "\ This resizes an ext2 or ext3 filesystem to match the size of -the underlying device."); +the underlying device. + +I It is sometimes required that you run C +on the C before calling this command. For unknown reasons +C sometimes gives an error about this and sometimes not. +In any case, it is always safe to call C before +calling this function."); ("find", (RStringList "names", [String "directory"]), 107, [], [InitBasicFS, Always, TestOutputList ( @@ -2169,6 +2176,17 @@ an error. The returned list is sorted."); + ("e2fsck_f", (RErr, [String "device"]), 108, [], + [], (* lvresize tests this *) + "check an ext2/ext3 filesystem", + "\ +This runs C, ie. runs the ext2/ext3 +filesystem checker on C, noninteractively (C<-p>), +even if the filesystem appears to be clean (C<-f>). + +This command is only needed because of C +(q.v.). Normally you should use C."); + ] let all_functions = non_daemon_functions @ daemon_functions