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

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