mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
v2v: uefi: Add function to error out unless UEFI firmware is installed.
No change, just refactoring.
This commit is contained in:
@@ -145,13 +145,11 @@ class output_libvirt oc output_pool = object
|
||||
match target_firmware with
|
||||
| TargetBIOS -> ()
|
||||
| TargetUEFI ->
|
||||
(* This will fail with an error if the target firmware is
|
||||
* not installed on the host.
|
||||
* XXX Can remove this method when libvirt supports
|
||||
(* XXX Can remove this method when libvirt supports
|
||||
* <loader type="efi"/> since then it will be up to
|
||||
* libvirt to check this.
|
||||
*)
|
||||
ignore (find_uefi_firmware guestcaps.gcaps_arch)
|
||||
error_unless_uefi_firmware guestcaps.gcaps_arch
|
||||
|
||||
method create_metadata source _ target_buses guestcaps _ target_firmware =
|
||||
(* We copied directly into the final pool directory. However we
|
||||
|
||||
@@ -44,10 +44,11 @@ class output_local dir = object
|
||||
match target_firmware with
|
||||
| TargetBIOS -> ()
|
||||
| TargetUEFI ->
|
||||
(* This will fail with an error if the target firmware is
|
||||
* not installed on the host.
|
||||
(* XXX Can remove this method when libvirt supports
|
||||
* <loader type="efi"/> since then it will be up to
|
||||
* libvirt to check this.
|
||||
*)
|
||||
ignore (find_uefi_firmware guestcaps.gcaps_arch)
|
||||
error_unless_uefi_firmware guestcaps.gcaps_arch
|
||||
|
||||
method create_metadata source _ target_buses guestcaps _ target_firmware =
|
||||
(* We don't know what target features the hypervisor supports, but
|
||||
|
||||
@@ -44,11 +44,7 @@ object
|
||||
method check_target_firmware guestcaps target_firmware =
|
||||
match target_firmware with
|
||||
| TargetBIOS -> ()
|
||||
| TargetUEFI ->
|
||||
(* This will fail with an error if the target firmware is
|
||||
* not installed on the host.
|
||||
*)
|
||||
ignore (find_uefi_firmware guestcaps.gcaps_arch)
|
||||
| TargetUEFI -> error_unless_uefi_firmware guestcaps.gcaps_arch
|
||||
|
||||
method create_metadata source _ target_buses guestcaps inspect
|
||||
target_firmware =
|
||||
|
||||
@@ -79,6 +79,9 @@ let find_uefi_firmware guest_arch =
|
||||
in
|
||||
loop files
|
||||
|
||||
let error_unless_uefi_firmware guest_arch =
|
||||
ignore (find_uefi_firmware guest_arch)
|
||||
|
||||
let compare_app2_versions app1 app2 =
|
||||
let i = compare app1.Guestfs.app2_epoch app2.Guestfs.app2_epoch in
|
||||
if i <> 0 then i
|
||||
|
||||
@@ -32,6 +32,9 @@ val find_uefi_firmware : string -> Uefi.uefi_firmware
|
||||
(** Find the UEFI firmware for the guest architecture.
|
||||
This cannot return an error, it calls [error] and fails instead. *)
|
||||
|
||||
val error_unless_uefi_firmware : string -> unit
|
||||
(** Check UEFI firmware is installed on the local host and error out if not. *)
|
||||
|
||||
val compare_app2_versions : Guestfs.application2 -> Guestfs.application2 -> int
|
||||
(** Compare two app versions. *)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user