Blame SOURCES/0046-v2v-add-and-use-Create_ovf.ovf_flavour_to_string.patch

97ae69
From ecbd5983e10adb6c5d95fdae1dc878a9905ae1b4 Mon Sep 17 00:00:00 2001
97ae69
From: Pino Toscano <ptoscano@redhat.com>
97ae69
Date: Tue, 29 May 2018 07:04:50 +0200
97ae69
Subject: [PATCH] v2v: add and use Create_ovf.ovf_flavour_to_string
97ae69
97ae69
Add an helper to convert an OVF flavour to string, and use it in
97ae69
-o vdsm to print the actual value of the vdsm-ovf-flavour option.
97ae69
97ae69
Thanks to Ming Xie.
97ae69
97ae69
(cherry picked from commit c0da02f90d9b52413c24dd9dae61662ad033cc16)
97ae69
---
97ae69
 v2v/create_ovf.ml  | 4 ++++
97ae69
 v2v/create_ovf.mli | 3 +++
97ae69
 v2v/output_vdsm.ml | 5 +++--
97ae69
 3 files changed, 10 insertions(+), 2 deletions(-)
97ae69
97ae69
diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml
97ae69
index 190cf8bed..ac3c61b13 100644
97ae69
--- a/v2v/create_ovf.ml
97ae69
+++ b/v2v/create_ovf.ml
97ae69
@@ -40,6 +40,10 @@ let ovf_flavour_of_string = function
97ae69
   | "rhvexp" -> RHVExportStorageDomain
97ae69
   | flav -> invalid_arg flav
97ae69
 
97ae69
+let ovf_flavour_to_string = function
97ae69
+  | OVirt -> "ovirt"
97ae69
+  | RHVExportStorageDomain -> "rhvexp"
97ae69
+
97ae69
 (* We set the creation time to be the same for all dates in
97ae69
  * all metadata files.  All dates in OVF are UTC.
97ae69
  *)
97ae69
diff --git a/v2v/create_ovf.mli b/v2v/create_ovf.mli
97ae69
index 2d80660e3..8200b76f9 100644
97ae69
--- a/v2v/create_ovf.mli
97ae69
+++ b/v2v/create_ovf.mli
97ae69
@@ -29,6 +29,9 @@ val ovf_flavours : string list
97ae69
     valid flavour. *)
97ae69
 val ovf_flavour_of_string : string -> ovf_flavour
97ae69
 
97ae69
+(** Convert an OVF flavour to its string representation. *)
97ae69
+val ovf_flavour_to_string : ovf_flavour -> string
97ae69
+
97ae69
 (** Create OVF and related files for RHV.
97ae69
 
97ae69
     The format for RHV export storage domain is described in:
97ae69
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
97ae69
index 92b3fd122..9a1b748bc 100644
97ae69
--- a/v2v/output_vdsm.ml
97ae69
+++ b/v2v/output_vdsm.ml
97ae69
@@ -118,9 +118,10 @@ object
97ae69
        | "0.10" -> "" (* currently this is the default, so don't print it *)
97ae69
        | s -> sprintf " -oo vdsm-compat=%s" s)
97ae69
       (match vdsm_options.ovf_flavour with
97ae69
-       | Create_ovf.OVirt -> "-oo vdsm-ovf-flavour=ovf"
97ae69
        (* currently this is the default, so don't print it *)
97ae69
-       | Create_ovf.RHVExportStorageDomain -> "")
97ae69
+       | Create_ovf.RHVExportStorageDomain -> ""
97ae69
+       | flav -> sprintf "-oo vdsm-ovf-flavour=%s"
97ae69
+                         (Create_ovf.ovf_flavour_to_string flav))
97ae69
 
97ae69
   method supported_firmware = [ TargetBIOS ]
97ae69
 
97ae69
-- 
fd1da6
2.17.2
97ae69