X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=88c0afeffc7e2deffd6f330dc03da00e8f9c9a00;hp=9a9c168ed630f8a3583306edae18cca7440dcf80;hb=632012e6419f04fab93909f92ecbab5a2c590447;hpb=f7e6ffa8a82f8a7a214a47ff32f46d9e893902d8 diff --git a/src/generator.ml b/src/generator.ml index 9a9c168..88c0afe 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -1632,6 +1632,150 @@ to return the existing UUID of a filesystem."); This returns the ext2/3/4 filesystem UUID of the filesystem on C."); + ("fsck", (RInt "status", [String "fstype"; String "device"]), 84, [], + [InitBasicFS, TestOutputInt ( + [["umount"; "/dev/sda1"]; + ["fsck"; "ext2"; "/dev/sda1"]], 0); + InitBasicFS, TestOutputInt ( + [["umount"; "/dev/sda1"]; + ["zero"; "/dev/sda1"]; + ["fsck"; "ext2"; "/dev/sda1"]], 8)], + "run the filesystem checker", + "\ +This runs the filesystem checker (fsck) on C which +should have filesystem type C. + +The returned integer is the status. See L for the +list of status codes from C. + +Notes: + +=over 4 + +=item * + +Multiple status codes can be summed together. + +=item * + +A non-zero return code can mean \"success\", for example if +errors have been corrected on the filesystem. + +=item * + +Checking or repairing NTFS volumes is not supported +(by linux-ntfs). + +=back + +This command is entirely equivalent to running C."); + + ("zero", (RErr, [String "device"]), 85, [], + [InitBasicFS, TestOutput ( + [["umount"; "/dev/sda1"]; + ["zero"; "/dev/sda1"]; + ["file"; "/dev/sda1"]], "data")], + "write zeroes to the device", + "\ +This command writes zeroes over the first few blocks of C. + +How many blocks are zeroed isn't specified (but it's I enough +to securely wipe the device). It should be sufficient to remove +any partition tables, filesystem superblocks and so on."); + + ("grub_install", (RErr, [String "root"; String "device"]), 86, [], + [InitBasicFS, TestOutputTrue ( + [["grub_install"; "/"; "/dev/sda1"]; + ["is_dir"; "/boot"]])], + "install GRUB", + "\ +This command installs GRUB (the Grand Unified Bootloader) on +C, with the root directory being C."); + + ("cp", (RErr, [String "src"; String "dest"]), 87, [], + [InitBasicFS, TestOutput ( + [["write_file"; "/old"; "file content"; "0"]; + ["cp"; "/old"; "/new"]; + ["cat"; "/new"]], "file content"); + InitBasicFS, TestOutputTrue ( + [["write_file"; "/old"; "file content"; "0"]; + ["cp"; "/old"; "/new"]; + ["is_file"; "/old"]]); + InitBasicFS, TestOutput ( + [["write_file"; "/old"; "file content"; "0"]; + ["mkdir"; "/dir"]; + ["cp"; "/old"; "/dir/new"]; + ["cat"; "/dir/new"]], "file content")], + "copy a file", + "\ +This copies a file from C to C where C is +either a destination filename or destination directory."); + + ("cp_a", (RErr, [String "src"; String "dest"]), 88, [], + [InitBasicFS, TestOutput ( + [["mkdir"; "/olddir"]; + ["mkdir"; "/newdir"]; + ["write_file"; "/olddir/file"; "file content"; "0"]; + ["cp_a"; "/olddir"; "/newdir"]; + ["cat"; "/newdir/olddir/file"]], "file content")], + "copy a file or directory recursively", + "\ +This copies a file or directory from C to C +recursively using the C command."); + + ("mv", (RErr, [String "src"; String "dest"]), 89, [], + [InitBasicFS, TestOutput ( + [["write_file"; "/old"; "file content"; "0"]; + ["mv"; "/old"; "/new"]; + ["cat"; "/new"]], "file content"); + InitBasicFS, TestOutputFalse ( + [["write_file"; "/old"; "file content"; "0"]; + ["mv"; "/old"; "/new"]; + ["is_file"; "/old"]])], + "move a file", + "\ +This moves a file from C to C where C is +either a destination filename or destination directory."); + + ("drop_caches", (RErr, [Int "whattodrop"]), 90, [], + [InitEmpty, TestRun ( + [["drop_caches"; "3"]])], + "drop kernel page cache, dentries and inodes", + "\ +This instructs the guest kernel to drop its page cache, +and/or dentries and inode caches. The parameter C +tells the kernel what precisely to drop, see +L + +Setting C to 3 should drop everything. + +This automatically calls L before the operation, +so that the maximum guest memory is freed."); + + ("dmesg", (RString "kmsgs", []), 91, [], + [InitEmpty, TestRun ( + [["dmesg"]])], + "return kernel messages", + "\ +This returns the kernel messages (C output) from +the guest kernel. This is sometimes useful for extended +debugging of problems. + +Another way to get the same information is to enable +verbose messages with C or by setting +the environment variable C before +running the program."); + + ("ping_daemon", (RErr, []), 92, [], + [InitEmpty, TestRun ( + [["ping_daemon"]])], + "ping the guest daemon", + "\ +This is a test probe into the guestfs daemon running inside +the qemu subprocess. Calling this function checks that the +daemon responds to the ping message, without affecting the daemon +or attached block device(s) in any other way."); + ] let all_functions = non_daemon_functions @ daemon_functions