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

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