On Wed, Nov 02, 2016 at 05:42:28PM +0100, Pino Toscano wrote:
On Wednesday, 2 November 2016 15:01:08 CET Richard W.M. Jones wrote:
> From: Pavel Butsykin <pbutsykin(a)virtuozzo.com>
>
> This patch improves the search of grub config on EFI partition. This
> means that the config will be found not only for rhel but also for
> many other distributions. Tests were performed on the following
> distributions: centos, fedora, ubuntu, suse. In all cases, the config
> path was /boot/efi/EFI/*distname*/grub.cfg
>
> The main purpose of the patch is to improve support for converting of
> vm with UEFI for most distributions. Unfortunately this patch does not
> solve the problem for all distributions, for example Debian does not
> store grub config on the EFI partition, therefore for such
> distributions another solution is necessary.
>
> Signed-off-by: Pavel Butsykin <pbutsykin(a)virtuozzo.com>
> Signed-off-by: Richard W.M. Jones <rjones(a)redhat.com>
> ---
Mostly LGTM (it was the approach I suggested, after all) -- just one
note below.
> (* Grub1 (AKA grub-legacy) representation. *)
> class bootloader_grub1 (g : G.guestfs) inspect grub_config =
> + let () =
> + if grub_config = "/boot/efi/EFI/redhat/grub.conf" then
> + g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf"
in
I guess this could be changed to be:
if String.is_prefix grub_config "/boot/efi/EFI/" then
g#aug_transform "grub" grub_config
so even if we keep it around for a while, it will work fine also for
other distros than RH-based.
The problem I found is that if the path is included in the Augeas lens
and this code is in libguestfs at the same time, then you get the
error noted before about:
augeas failed to parse [path to grub.conf]:
error "Lenses @Grub and grub.lns could be used to load this file"
I think we should just set Augeas 1.7.0 (released tomorrow) as the
minimum version for virt-v2v users, and then the problem largely goes
away. I was also looking at whether it is possible to detect if the
file has a transform already using Augeas APIs.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html