virt-v2v/0040-convert_linux.get_uefi...

62 lines
2.2 KiB
Diff

From 3ffada4717e1f90843c67b2292ac7b9c6880c79c Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 2 Dec 2022 13:44:08 +0100
Subject: [PATCH] convert_linux.get_uefi_arch_suffix: move to Utils
So that Windows conversion can use the same function.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149629
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20221202124409.11741-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit b13813b527856749bea4087cb9c6deba2d67eff6)
---
convert/convert_linux.ml | 6 ------
lib/utils.ml | 5 +++++
lib/utils.mli | 5 +++++
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index 5bfdac5a..cde3b037 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -1327,12 +1327,6 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
info (f_"Can't fix UEFI bootloader. VM may not boot.")
in
- let get_uefi_arch_suffix = function
- | "x86_64" -> Some "X64"
- | "i386" -> Some "X32"
- | _ -> None
- in
-
match get_uefi_arch_suffix inspect.i_arch with
| None -> cant_fix_uefi ()
| Some suffix -> (
diff --git a/lib/utils.ml b/lib/utils.ml
index 84b9a93f..e355eb3e 100644
--- a/lib/utils.ml
+++ b/lib/utils.ml
@@ -259,3 +259,8 @@ let get_disk_allocated ~dir ~disknr =
Some !allocated
) else None
)
+
+let get_uefi_arch_suffix = function
+ | "x86_64" -> Some "X64"
+ | "i386" -> Some "X32"
+ | _ -> None
diff --git a/lib/utils.mli b/lib/utils.mli
index d431e21f..5687bf75 100644
--- a/lib/utils.mli
+++ b/lib/utils.mli
@@ -98,3 +98,8 @@ val get_disk_allocated : dir:string -> disknr:int -> int64 option
image, according to the "base:allocation" metadata context. If the context
is not supported by the NBD server behind the socket, the function returns
None. *)
+
+val get_uefi_arch_suffix : string -> string option
+(** [get_uefi_arch_suffix arch] maps [arch] from [inspect.i_arch] representation
+ to UEFI spec representation. If a mapping cannot be found, [None] is
+ returned. *)