v2v: uefi: Add function to error out unless UEFI firmware is installed.

No change, just refactoring.
This commit is contained in:
Richard W.M. Jones
2017-07-27 12:03:25 +01:00
parent 7cd2753115
commit b981ac0a6e
5 changed files with 13 additions and 12 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 =

View File

@@ -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

View File

@@ -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. *)