[Libguestfs] [PATCH] v2v: linux: handle UEFI path for Grub1 (RHBZ#1152369)

Richard W.M. Jones rjones at redhat.com
Thu Aug 25 14:52:51 UTC 2016


On Fri, Aug 19, 2016 at 04:25:42PM +0200, Pino Toscano wrote:
> Add also /boot/efi/EFI/redhat/grub.conf as configuration of Grub 1;
> since the "grub" lens of Augeas does not handle this path, add a
> transformation so Augeas can parse it.
> ---
>  v2v/convert_linux.ml | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
> index 9941750..2a53315 100644
> --- a/v2v/convert_linux.ml
> +++ b/v2v/convert_linux.ml
> @@ -96,7 +96,11 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
>      ] in
>      let locations =
>        match inspect.i_firmware with
> -      | I_UEFI _ -> ("/boot/efi/EFI/redhat/grub.cfg", `Grub2) :: locations
> +      | I_UEFI _ ->
> +        [
> +          "/boot/efi/EFI/redhat/grub.cfg", `Grub2;
> +          "/boot/efi/EFI/redhat/grub.conf", `Grub1;
> +        ] @ locations
>        | I_BIOS -> locations in
>      try
>        List.find (
> @@ -111,6 +115,11 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
>      match grub with
>      | `Grub2 -> ""
>      | `Grub1 ->
> +      if grub_config = "/boot/efi/EFI/redhat/grub.conf" then (
> +        g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf";
> +        Linux.augeas_reload g;
> +      );
> +
>        let mounts = g#inspect_get_mountpoints inspect.i_root in
>        try
>          List.find (

ACK both.

You might need to adjust the augeas min version detection in
m4/guestfs_libraries.m4.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list