Richard W.M. Jones
2017-Apr-05 13:38 UTC
[Libguestfs] [PATCH] v2v: Rename OVF module to Create_ovf.
This is just a bit of preparatory refactoring ... Rich.
Richard W.M. Jones
2017-Apr-05 13:38 UTC
[Libguestfs] [PATCH] v2v: Rename OVF module to Create_ovf.
It's not a general OVF module at all. It only creates OVF, and only for RHV. --- v2v/Makefile.am | 6 +-- v2v/{OVF.ml => create_ovf.ml} | 6 +-- v2v/{OVF.mli => create_ovf.mli} | 18 +++++-- v2v/output_rhv.ml | 4 +- v2v/output_vdsm.ml | 4 +- v2v/v2v_unit_tests.ml | 113 ++++++++++++++++++++++------------------ 6 files changed, 83 insertions(+), 68 deletions(-) rename v2v/{OVF.ml => create_ovf.ml} (99%) rename v2v/{OVF.mli => create_ovf.mli} (74%) diff --git a/v2v/Makefile.am b/v2v/Makefile.am index 133a411bc..55893ab65 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -30,6 +30,7 @@ SOURCES_MLI = \ convert_linux.mli \ convert_windows.mli \ create_libvirt_xml.mli \ + create_ovf.mli \ DOM.mli \ input_disk.mli \ input_libvirt.mli \ @@ -52,7 +53,6 @@ SOURCES_MLI = \ output_qemu.mli \ output_rhv.mli \ output_vdsm.mli \ - OVF.mli \ parse_ovf_from_ova.mli \ parse_libvirt_xml.mli \ qemu_command.mli \ @@ -73,8 +73,8 @@ SOURCES_ML = \ libvirt_utils.ml \ DOM.ml \ changeuid.ml \ - OVF.ml \ parse_ovf_from_ova.ml \ + create_ovf.ml \ linux.ml \ windows.ml \ windows_virtio.ml \ @@ -448,7 +448,7 @@ v2v_unit_tests_BOBJECTS = \ uefi.cmo \ utils.cmo \ DOM.cmo \ - OVF.cmo \ + create_ovf.cmo \ windows.cmo \ windows_virtio.cmo \ linux.cmo \ diff --git a/v2v/OVF.ml b/v2v/create_ovf.ml similarity index 99% rename from v2v/OVF.ml rename to v2v/create_ovf.ml index f29aefcf9..cfca63452 100644 --- a/v2v/OVF.ml +++ b/v2v/create_ovf.ml @@ -16,11 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -(* Functions for dealing with OVF files. - * - * The format is described in - * http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt - *) +(* Create OVF and related files for RHV. *) open Common_gettext.Gettext open Common_utils diff --git a/v2v/OVF.mli b/v2v/create_ovf.mli similarity index 74% rename from v2v/OVF.mli rename to v2v/create_ovf.mli index 732213a90..793478d1d 100644 --- a/v2v/OVF.mli +++ b/v2v/create_ovf.mli @@ -16,7 +16,20 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -(** Functions for dealing with OVF files. *) +(** Create OVF and related files for RHV. + + The format is described in + http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt + + OVF isn't a real standard, so it's likely that if we ever had to + 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 -> DOM.doc +(** Create the OVF file. + + Actually a {!DOM} document is created, not a file. It can be written + to the desired output location using {!DOM.doc_to_chan}. *) val create_meta_files : Types.output_allocation -> string -> string list -> Types.target list -> string list (** Create the .meta file associated with each target. @@ -26,9 +39,6 @@ val create_meta_files : Types.output_allocation -> string -> string list -> Type file is returned (one per target), and they must be written to [target_file ^ ".meta"]. *) -val create_ovf : Types.source -> Types.target list -> Types.guestcaps -> Types.inspect -> Types.output_allocation -> string -> string list -> string list -> string -> DOM.doc -(** Create the OVF file. *) - (**/**) (* For use by v2v_unit_tests only. *) diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml index c7b96ab86..34078aeef 100644 --- a/v2v/output_rhv.ml +++ b/v2v/output_rhv.ml @@ -236,7 +236,7 @@ object (* Generate the .meta file associated with each volume. *) let metas - OVF.create_meta_files output_alloc esd_uuid image_uuids + Create_ovf.create_meta_files output_alloc esd_uuid image_uuids targets in List.iter ( fun ({ target_file = target_file }, meta) -> @@ -268,7 +268,7 @@ object assert (target_firmware = TargetBIOS); (* Create the metadata. *) - let ovf = OVF.create_ovf source targets guestcaps inspect + let ovf = Create_ovf.create_ovf source targets guestcaps inspect output_alloc esd_uuid image_uuids vol_uuids vm_uuid in (* Write it to the metadata file. *) diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index e8342f6d3..d8cd20156 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -138,7 +138,7 @@ object (* Generate the .meta files associated with each volume. *) let metas - OVF.create_meta_files output_alloc dd_uuid + Create_ovf.create_meta_files output_alloc dd_uuid vdsm_params.image_uuids targets in List.iter ( fun ({ target_file = target_file }, meta) -> @@ -168,7 +168,7 @@ object assert (target_firmware = TargetBIOS); (* Create the metadata. *) - let ovf = OVF.create_ovf source targets guestcaps inspect + let ovf = Create_ovf.create_ovf source targets guestcaps inspect output_alloc dd_uuid vdsm_params.image_uuids vdsm_params.vol_uuids diff --git a/v2v/v2v_unit_tests.ml b/v2v/v2v_unit_tests.ml index bd65788b0..bae7cf0b7 100644 --- a/v2v/v2v_unit_tests.ml +++ b/v2v/v2v_unit_tests.ml @@ -39,65 +39,74 @@ let inspect_defaults = { let test_get_ostype ctx let printer = identity in assert_equal ~printer "RHEL6" - (OVF.get_ostype { inspect_defaults with - i_type = "linux"; i_distro = "rhel"; - i_major_version = 6; - i_minor_version = 0; - i_arch = "i386" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "linux"; i_distro = "rhel"; + i_major_version = 6; + i_minor_version = 0; + i_arch = "i386" }); assert_equal ~printer "RHEL6x64" - (OVF.get_ostype { inspect_defaults with - i_type = "linux"; i_distro = "rhel"; - i_major_version = 6; - i_minor_version = 0; - i_arch = "x86_64" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "linux"; i_distro = "rhel"; + i_major_version = 6; + i_minor_version = 0; + i_arch = "x86_64" }); assert_equal ~printer "rhel_7x64" - (OVF.get_ostype { inspect_defaults with - i_type = "linux"; i_distro = "rhel"; - i_major_version = 7; - i_minor_version = 0; - i_arch = "x86_64" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "linux"; i_distro = "rhel"; + i_major_version = 7; + i_minor_version = 0; + i_arch = "x86_64" }); assert_equal ~printer "Windows7" - (OVF.get_ostype { inspect_defaults with - i_type = "windows"; - i_major_version = 6; - i_minor_version = 1; - i_product_variant = "Client"; - i_arch = "i386" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "windows"; + i_major_version = 6; + i_minor_version = 1; + i_product_variant = "Client"; + i_arch = "i386" }); assert_equal ~printer "Windows7x64" - (OVF.get_ostype { inspect_defaults with - i_type = "windows"; - i_major_version = 6; - i_minor_version = 1; - i_product_variant = "Client"; - i_arch = "x86_64" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "windows"; + i_major_version = 6; + i_minor_version = 1; + i_product_variant = "Client"; + i_arch = "x86_64" }); assert_equal ~printer "windows_8" - (OVF.get_ostype { inspect_defaults with - i_type = "windows"; - i_major_version = 6; - i_minor_version = 2; - i_product_variant = "Client"; - i_arch = "i386" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "windows"; + i_major_version = 6; + i_minor_version = 2; + i_product_variant = "Client"; + i_arch = "i386" }); assert_equal ~printer "windows_8x64" - (OVF.get_ostype { inspect_defaults with - i_type = "windows"; - i_major_version = 6; - i_minor_version = 2; - i_product_variant = "Client"; - i_arch = "x86_64" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "windows"; + i_major_version = 6; + i_minor_version = 2; + i_product_variant = "Client"; + i_arch = "x86_64" }); assert_equal ~printer "windows_2012x64" - (OVF.get_ostype { inspect_defaults with - i_type = "windows"; - i_major_version = 6; - i_minor_version = 2; - i_product_variant = "Server"; - i_arch = "x86_64" }); + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "windows"; + i_major_version = 6; + i_minor_version = 2; + i_product_variant = "Server"; + i_arch = "x86_64" }); assert_equal ~printer "windows_2012R2x64" - (OVF.get_ostype { inspect_defaults with - i_type = "windows"; - i_major_version = 6; - i_minor_version = 3; - i_product_variant = "Server"; - i_arch = "x86_64" }) + (Create_ovf.get_ostype { + inspect_defaults with + i_type = "windows"; + i_major_version = 6; + i_minor_version = 3; + i_product_variant = "Server"; + i_arch = "x86_64" }) let test_drive_name ctx let printer = identity in @@ -791,7 +800,7 @@ let test_qemu_img_supports ctx let suite "virt-v2v" >::: [ - "OVF.get_ostype" >:: test_get_ostype; + "Create_ovf.get_ostype" >:: test_get_ostype; "Utils.drive_name" >:: test_drive_name; "Utils.drive_index" >:: test_drive_index; "Windows_virtio.virtio_iso_path_matches_guest_os" >:: -- 2.12.0
Possibly Parallel Threads
- Re: [PATCH v2 1/2] v2v: OVF: write ovirt:id attribute for the OS in OVirt flavour
- [PATCH v3 0/3] v2v: improve OVF in OVirt flavour
- Re: [PATCH v2 1/2] v2v: OVF: write ovirt:id attribute for the OS in OVirt flavour
- [PATCH v2 0/2] v2v: improve OVF in OVirt flavour
- [PATCH] v2v: OVF: write ovirt:id attribute for the OS in OVirt flavour