X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=939f1f60e8202ace0aa91eeedef90ecf6874f659;hp=efc8bfd85d242f55cd0285afb23996a2c4b10420;hb=cbe80b2bcfdee437d195f25aaf6f5d96329ab360;hpb=1020b212b189968ead013436cac79019fbd8fdad diff --git a/src/generator.ml b/src/generator.ml index efc8bfd..939f1f6 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2320,16 +2320,30 @@ any partition tables, filesystem superblocks and so on. See also: C, C."); ("grub_install", (RErr, [Pathname "root"; Device "device"]), 86, [], - (* Test disabled because grub-install incompatible with virtio-blk driver. - * See also: https://bugzilla.redhat.com/show_bug.cgi?id=479760 + (* See: + * https://bugzilla.redhat.com/show_bug.cgi?id=484986 + * https://bugzilla.redhat.com/show_bug.cgi?id=479760 *) - [InitBasicFS, Disabled, TestOutputTrue ( - [["grub_install"; "/"; "/dev/sda1"]; + [InitBasicFS, Always, TestOutputTrue ( + [["mkdir_p"; "/boot/grub"]; + ["write"; "/boot/grub/device.map"; "(hd0) /dev/vda"]; + ["grub_install"; "/"; "/dev/vda"]; ["is_dir"; "/boot"]])], "install GRUB", "\ This command installs GRUB (the Grand Unified Bootloader) on -C, with the root directory being C."); +C, with the root directory being C. + +Note: If grub-install reports the error +\"No suitable drive was found in the generated device map.\" +it may be that you need to create a C +file first that contains the mapping between grub device names +and Linux device names. It is usually sufficient to create +a file containing: + + (hd0) /dev/vda + +replacing C with the name of the installation device."); ("cp", (RErr, [Pathname "src"; Pathname "dest"]), 87, [], [InitBasicFS, Always, TestOutput ( @@ -6824,6 +6838,19 @@ static void print_table (char const *const *argv) } */ +static int +is_available (const char *group) +{ + const char *groups[] = { group, NULL }; + int r; + + suppress_error = 1; + r = guestfs_available (g, (char **) groups); + suppress_error = 0; + + return r == 0; +} + "; (* Generate a list of commands which are not tested anywhere. *) @@ -7066,16 +7093,9 @@ static int %s (void) List.iter ( function | Optional group -> - pr " {\n"; - pr " const char *groups[] = { \"%s\", NULL };\n" group; - pr " int r;\n"; - pr " suppress_error = 1;\n"; - pr " r = guestfs_available (g, (char **) groups);\n"; - pr " suppress_error = 0;\n"; - pr " if (r == -1) {\n"; - pr " printf (\" %%s skipped (reason: group %%s not available in daemon)\\n\", \"%s\", groups[0]);\n" test_name; - pr " return 0;\n"; - pr " }\n"; + pr " if (!is_available (\"%s\")) {\n" group; + pr " printf (\" %%s skipped (reason: group %%s not available in daemon)\\n\", \"%s\", \"%s\");\n" test_name group; + pr " return 0;\n"; pr " }\n"; | _ -> () ) flags;