Richard W.M. Jones
2017-Mar-06 18:20 UTC
[Libguestfs] [PATCH] v2v: -o local: Check that UEFI firmware is installed before conversion.
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. Partial fix for: https://bugzilla.redhat.com/show_bug.cgi?id=1429506 Thanks: Christopher Brown --- v2v/output_libvirt.ml | 4 ++-- v2v/output_local.ml | 13 +++++++++++-- v2v/output_qemu.ml | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml index 072b94f..33f69dc 100644 --- a/v2v/output_libvirt.ml +++ b/v2v/output_libvirt.ml @@ -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 -> () diff --git a/v2v/output_local.ml b/v2v/output_local.ml index 9ba1d6f..9c105ef 100644 --- a/v2v/output_local.ml +++ b/v2v/output_local.ml @@ -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. diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml index 3e28ad0..84efd45 100644 --- a/v2v/output_qemu.ml +++ b/v2v/output_qemu.ml @@ -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 -> () -- 2.9.3
Pino Toscano
2017-Mar-07 09:58 UTC
Re: [Libguestfs] [PATCH] v2v: -o local: Check that UEFI firmware is installed before conversion.
On Monday, 6 March 2017 19:20:56 CET Richard W.M. Jones wrote:> 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. > > Partial fix for: https://bugzilla.redhat.com/show_bug.cgi?id=1429506 > Thanks: Christopher Brown > ---LGTM. Thanks, -- Pino Toscano
Reasonably Related Threads
- [PATCH v3 06/13] v2v: factor out determining the guest firmware
- [PATCH v2 07/17] v2v: factor out determing the guest firmware
- [v2v PATCH 1/2] Add back guestcaps as parameter of output#prepare_targets
- [PATCH] v2v: ovf: add firmware and machine type element
- [PATCH 3/3] v2v: add -o json output mode