v2v: -o local: Check that UEFI firmware is installed before conversion (RHBZ#1429506).

Avoids a lengthy conversion followed by failure if we discover at the
end that OVMF is not installed.

This also changes the order of the methods in -o libvirt and -o qemu
so that it matches the order in the class interface, and also
logically makes more sense.

Thanks: Christopher Brown
This commit is contained in:
Richard W.M. Jones
2017-03-06 18:11:29 +00:00
parent c6d8d68a46
commit a05e0fc0e8
3 changed files with 15 additions and 6 deletions

View File

@@ -76,8 +76,6 @@ class output_libvirt oc output_pool = object
| None -> sprintf "-o libvirt -os %s" output_pool
| Some uri -> sprintf "-o libvirt -oc %s -os %s" uri output_pool
method supported_firmware = [ TargetBIOS; TargetUEFI ]
method prepare_targets source targets =
(* Get the capabilities from libvirt. *)
let xml = Libvirt_utils.capabilities ?conn:oc () in
@@ -140,6 +138,8 @@ class output_libvirt oc output_pool = object
{ t with target_file = target_file }
) targets
method supported_firmware = [ TargetBIOS; TargetUEFI ]
method check_target_firmware guestcaps target_firmware =
match target_firmware with
| TargetBIOS -> ()

View File

@@ -30,8 +30,6 @@ class output_local dir = object
method as_options = sprintf "-o local -os %s" dir
method supported_firmware = [ TargetBIOS; TargetUEFI ]
method prepare_targets source targets =
List.map (
fun t ->
@@ -39,6 +37,17 @@ class output_local dir = object
{ t with target_file = target_file }
) targets
method supported_firmware = [ TargetBIOS; TargetUEFI ]
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)
method create_metadata source _ target_buses guestcaps _ target_firmware =
(* We don't know what target features the hypervisor supports, but
* assume a common set that libvirt supports.

View File

@@ -31,8 +31,6 @@ object
method as_options =
sprintf "-o qemu -os %s%s" dir (if qemu_boot then " --qemu-boot" else "")
method supported_firmware = [ TargetBIOS; TargetUEFI ]
method prepare_targets source targets =
List.map (
fun t ->
@@ -40,6 +38,8 @@ object
{ t with target_file = target_file }
) targets
method supported_firmware = [ TargetBIOS; TargetUEFI ]
method check_target_firmware guestcaps target_firmware =
match target_firmware with
| TargetBIOS -> ()