[Libguestfs] [PATCH] v2v: bootloaders: search grub config for all distributions

Pavel Butsykin pbutsykin at virtuozzo.com
Tue Nov 1 14:45:10 UTC 2016


On 01.11.2016 17:06, Richard W.M. Jones wrote:
> On Tue, Nov 01, 2016 at 03:10:51PM +0300, Pavel Butsykin wrote:
>> On 01.11.2016 13:11, Richard W.M. Jones wrote:
>>> On Thu, Oct 27, 2016 at 08:22:30PM +0300, Pavel Butsykin wrote:
>>>>     match typ with
>>>>     | Grub1 ->
>>>> -    if config_file = "/boot/efi/EFI/redhat/grub.conf" then
>>>> -      g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf";
>>>> -
>>>> +    (match inspect.i_firmware with
>>>> +    | I_BIOS -> ()
>>>> +    | I_UEFI _ -> g#aug_transform "grub" config_file
>>>> +    );
>>>>       new bootloader_grub1 g inspect config_file
>>>>     | Grub2 -> new bootloader_grub2 g config_file
>>>
>>> I don't think this part of the patch is correct.  We need to use the
>>> Augeas transform only for a particular path which is missing from the
>>> Augeas lens.
>>
>> It is necessary for /EFI/redhat/, but no need for others?
>
> I believe so, because the Augeas grub lens has:
>
>      (* View: filter *)
>      let filter = incl "/boot/grub/grub.conf"
>                 . incl "/boot/grub/menu.lst"
>                 . incl "/etc/grub.conf"
>
> so it wouldn't normally be activated for a grub.conf found under
> any other path.

We can have the following paths:

/boot/efi/EFI/centos/grub.conf
/boot/efi/EFI/fedora/grub.conf
/boot/efi/EFI/*/grub.conf

which also need to activate. The Augeas grub lens has filters which are
used only for the BIOS. So (if I understand correctly) we have to use
the Augeas transform for other EFI paths too.

>>> What do you think of the attached version instead?  It's smaller and
>>> more efficient (only makes 2 libguestfs API calls in the normal case)?
>>
>> Yeah, I agree. And in this version the code is easier to read :)
>
> The slow tests passed, so I'll push this version shortly.
>
> Thanks,
>
> Rich.
>




More information about the Libguestfs mailing list