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

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