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

Pino Toscano ptoscano at redhat.com
Fri Aug 19 14:25:42 UTC 2016


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 (
-- 
2.7.4




More information about the Libguestfs mailing list