Tomáš Golembiovský
2018-Oct-10 17:25 UTC
[Libguestfs] [PATCH v2 0/2] v2v: machine type for oVirt
changes in v2: - split patch in two - changed as per suggestions Tomáš Golembiovský (2): v2v: ovf: add firmware and machine type element v2v: enable UEFI for oVirt/RHV outputs v2v/create_ovf.ml | 12 +++++++++++- v2v/create_ovf.mli | 2 +- v2v/output_rhv.ml | 6 ++---- v2v/output_rhv_upload.ml | 4 ++-- v2v/output_vdsm.ml | 6 ++---- v2v/test-v2v-o-rhv.ovf.expected | 1 + v2v/test-v2v-o-vdsm-options.ovf.expected | 1 + 7 files changed, 20 insertions(+), 12 deletions(-) -- 2.19.0
Tomáš Golembiovský
2018-Oct-10 17:25 UTC
[Libguestfs] [PATCH v2 1/2] v2v: ovf: add firmware and machine type element
Add oVirt specific elemnt to OVF. It represents the combination of machine type (i440fx/q35) and firmware (BIOS/UEFI). Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> --- v2v/create_ovf.ml | 12 +++++++++++- v2v/create_ovf.mli | 2 +- v2v/output_rhv.ml | 2 +- v2v/output_rhv_upload.ml | 2 +- v2v/output_vdsm.ml | 1 + v2v/test-v2v-o-rhv.ovf.expected | 1 + v2v/test-v2v-o-vdsm-options.ovf.expected | 1 + 7 files changed, 17 insertions(+), 4 deletions(-) diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml index f2441cc3f..0ec281d62 100644 --- a/v2v/create_ovf.ml +++ b/v2v/create_ovf.ml @@ -462,6 +462,14 @@ let origin_of_source_hypervisor = function *) | _ -> None +(* Set the <BiosType> element. Other possible values: + * 1 q35 + SeaBIOS + * 3 q35 + UEFI + Secure Boot + *) +let get_ovirt_biostype = function + | TargetBIOS -> 0 (* i440fx + SeaBIOS *) + | TargetUEFI -> 2 (* q35 + UEFI *) + (* Generate the .meta file associated with each volume. *) let create_meta_files output_alloc sd_uuid image_uuids overlays (* Note: Upper case in the .meta, mixed case in the OVF. *) @@ -506,7 +514,7 @@ let create_meta_files output_alloc sd_uuid image_uuids overlays ) (List.combine overlays image_uuids) (* Create the OVF file. *) -let rec create_ovf source targets guestcaps inspect +let rec create_ovf source targets guestcaps inspect target_firmware output_alloc sd_uuid image_uuids vol_uuids vm_uuid ovf_flavour assert (List.length targets = List.length vol_uuids); @@ -515,6 +523,7 @@ let rec create_ovf source targets guestcaps inspect let vmtype = get_vmtype inspect in let vmtype = match vmtype with `Desktop -> "0" | `Server -> "1" in let ostype = get_ostype inspect in + let biostype = get_ovirt_biostype target_firmware in let ovf : doc doc "ovf:Envelope" [ @@ -562,6 +571,7 @@ let rec create_ovf source targets guestcaps inspect e "VmType" [] [PCData vmtype]; (* See https://bugzilla.redhat.com/show_bug.cgi?id=1260590#c17 *) e "DefaultDisplayType" [] [PCData "1"]; + e "BiosType" [] [PCData (string_of_int biostype)]; ] in (match source.s_cpu_model with diff --git a/v2v/create_ovf.mli b/v2v/create_ovf.mli index 10c2d6619..f6c7668ae 100644 --- a/v2v/create_ovf.mli +++ b/v2v/create_ovf.mli @@ -43,7 +43,7 @@ val ovf_flavour_to_string : ovf_flavour -> string create OVF for another target management system then we would need to heavily modify or even duplicate this code. *) -val create_ovf : Types.source -> Types.target list -> Types.guestcaps -> Types.inspect -> Types.output_allocation -> string -> string list -> string list -> string -> ovf_flavour -> DOM.doc +val create_ovf : Types.source -> Types.target list -> Types.guestcaps -> Types.inspect -> Types.target_firmware -> Types.output_allocation -> string -> string list -> string list -> string -> ovf_flavour -> DOM.doc (** Create the OVF file. Actually a {!DOM} document is created, not a file. It can be written diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml index 768e4f699..52750f715 100644 --- a/v2v/output_rhv.ml +++ b/v2v/output_rhv.ml @@ -267,7 +267,7 @@ object (* Create the metadata. *) let ovf = Create_ovf.create_ovf source targets guestcaps inspect - output_alloc esd_uuid image_uuids vol_uuids vm_uuid + target_firmware output_alloc esd_uuid image_uuids vol_uuids vm_uuid Create_ovf.RHVExportStorageDomain in (* Write it to the metadata file. *) diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index 3bb2ca807..961f3c780 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -388,7 +388,7 @@ If the messages above are not sufficient to diagnose the problem then add the (* Create the metadata. *) let ovf Create_ovf.create_ovf source targets guestcaps inspect - output_alloc + target_firmware output_alloc sd_uuid image_uuids vol_uuids vm_uuid OVirt in let ovf = DOM.doc_to_string ovf in diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index dc107cf2f..eb7c581d3 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -237,6 +237,7 @@ object (* Create the metadata. *) let ovf = Create_ovf.create_ovf source targets guestcaps inspect + target_firmware output_alloc dd_uuid vdsm_options.image_uuids vdsm_options.vol_uuids diff --git a/v2v/test-v2v-o-rhv.ovf.expected b/v2v/test-v2v-o-rhv.ovf.expected index 7bcc456c5..c6bd05c56 100644 --- a/v2v/test-v2v-o-rhv.ovf.expected +++ b/v2v/test-v2v-o-rhv.ovf.expected @@ -25,6 +25,7 @@ <IsStateless>False</IsStateless> <VmType>0</VmType> <DefaultDisplayType>1</DefaultDisplayType> + <BiosType>0</BiosType> <Section ovf:id='#VM_ID#' ovf:required='false' xsi:type='ovf:OperatingSystemSection_Type'> <Info>Microsoft Windows 7 Phony Edition</Info> <Description>Windows7</Description> diff --git a/v2v/test-v2v-o-vdsm-options.ovf.expected b/v2v/test-v2v-o-vdsm-options.ovf.expected index abaf37e54..f0d418b46 100644 --- a/v2v/test-v2v-o-vdsm-options.ovf.expected +++ b/v2v/test-v2v-o-vdsm-options.ovf.expected @@ -25,6 +25,7 @@ <IsStateless>False</IsStateless> <VmType>0</VmType> <DefaultDisplayType>1</DefaultDisplayType> + <BiosType>0</BiosType> <OperatingSystemSection ovf:id='VM' ovf:required='false' ovirt:id='11'> <Info>Microsoft Windows 7 Phony Edition</Info> <Description>Windows7</Description> -- 2.19.0
Tomáš Golembiovský
2018-Oct-10 17:25 UTC
[Libguestfs] [PATCH v2 2/2] v2v: enable UEFI for oVirt/RHV outputs
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> --- v2v/output_rhv.ml | 4 +--- v2v/output_rhv_upload.ml | 2 +- v2v/output_vdsm.ml | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml index 52750f715..18f0104b7 100644 --- a/v2v/output_rhv.ml +++ b/v2v/output_rhv.ml @@ -115,7 +115,7 @@ object method as_options = sprintf "-o rhv -os %s" os - method supported_firmware = [ TargetBIOS ] + method supported_firmware = [ TargetBIOS; TargetUEFI ] (* RHV doesn't support serial consoles. This causes the conversion * step to remove it. @@ -262,8 +262,6 @@ object (* This is called after conversion to write the OVF metadata. *) method create_metadata source targets _ guestcaps inspect target_firmware - (* See #supported_firmware above. *) - assert (target_firmware = TargetBIOS); (* Create the metadata. *) let ovf = Create_ovf.create_ovf source targets guestcaps inspect diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index 961f3c780..baf033c32 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -240,7 +240,7 @@ object sprintf " -oc %s -op %s -os %s" output_conn output_password output_storage - method supported_firmware = [ TargetBIOS ] + method supported_firmware = [ TargetBIOS; TargetUEFI ] (* rhev-apt.exe will be installed (if available). *) method install_rhev_apt = true diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index eb7c581d3..d9fb290a8 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -123,7 +123,7 @@ object | flav -> sprintf "-oo vdsm-ovf-flavour=%s" (Create_ovf.ovf_flavour_to_string flav)) - method supported_firmware = [ TargetBIOS ] + method supported_firmware = [ TargetBIOS; TargetUEFI ] (* RHV doesn't support serial consoles. This causes the conversion * step to remove it. @@ -232,9 +232,6 @@ object (* This is called after conversion to write the OVF metadata. *) method create_metadata source targets _ guestcaps inspect target_firmware - (* See #supported_firmware above. *) - assert (target_firmware = TargetBIOS); - (* Create the metadata. *) let ovf = Create_ovf.create_ovf source targets guestcaps inspect target_firmware -- 2.19.0
Richard W.M. Jones
2018-Oct-12 13:02 UTC
Re: [Libguestfs] [PATCH v2 0/2] v2v: machine type for oVirt
On Wed, Oct 10, 2018 at 07:25:48PM +0200, Tomáš Golembiovský wrote:> changes in v2: > - split patch in two > - changed as per suggestions > > Tomáš Golembiovský (2): > v2v: ovf: add firmware and machine type element > v2v: enable UEFI for oVirt/RHV outputs > > v2v/create_ovf.ml | 12 +++++++++++- > v2v/create_ovf.mli | 2 +- > v2v/output_rhv.ml | 6 ++---- > v2v/output_rhv_upload.ml | 4 ++-- > v2v/output_vdsm.ml | 6 ++---- > v2v/test-v2v-o-rhv.ovf.expected | 1 + > v2v/test-v2v-o-vdsm-options.ovf.expected | 1 + > 7 files changed, 20 insertions(+), 12 deletions(-)Patch series looks fine to me. Any comments Pino? If not, I'll push it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Pino Toscano
2018-Oct-12 15:54 UTC
Re: [Libguestfs] [PATCH v2 0/2] v2v: machine type for oVirt
On Friday, 12 October 2018 15:02:31 CEST Richard W.M. Jones wrote:> On Wed, Oct 10, 2018 at 07:25:48PM +0200, Tomáš Golembiovský wrote: > > changes in v2: > > - split patch in two > > - changed as per suggestions > > > > Tomáš Golembiovský (2): > > v2v: ovf: add firmware and machine type element > > v2v: enable UEFI for oVirt/RHV outputs > > > > v2v/create_ovf.ml | 12 +++++++++++- > > v2v/create_ovf.mli | 2 +- > > v2v/output_rhv.ml | 6 ++---- > > v2v/output_rhv_upload.ml | 4 ++-- > > v2v/output_vdsm.ml | 6 ++---- > > v2v/test-v2v-o-rhv.ovf.expected | 1 + > > v2v/test-v2v-o-vdsm-options.ovf.expected | 1 + > > 7 files changed, 20 insertions(+), 12 deletions(-) > > Patch series looks fine to me. > > Any comments Pino? If not, I'll push it.OK for me too -- if possible, please update the documentation as well (the "UEFI" section, in particular). -- Pino Toscano
Reasonably Related Threads
- [PATCH] v2v: ovf: add firmware and machine type element
- [PATCH v2 0/3] Make generated OVF more conforming to standard
- [PATCH 0/3] Make generated OVF more conforming to standard
- [PATCH] v2v: Rename OVF module to Create_ovf.
- [PATCH v2 0/3] v2v: Add -o rhv-upload output mode.