Blame SOURCES/0187-virt-v2v-Support-for-ova-exported-from-AWS-RHBZ-1371.patch

aa0300
From d84af86948e82322f95a99d2ecd46bec04977d26 Mon Sep 17 00:00:00 2001
aa0300
From: Shahar Havivi <shaharh@redhat.com>
aa0300
Date: Thu, 8 Sep 2016 09:53:37 +0300
aa0300
Subject: [PATCH] virt-v2v: Support for ova exported from AWS (RHBZ#1371843).
aa0300
aa0300
1. AWS the name tag is not mandatory - using default as a name
aa0300
2. AWD doesn't prefix 'ovf:' as prefix to disk path
aa0300
aa0300
There is an open bug for oVirt:
aa0300
https://bugzilla.redhat.com/show_bug.cgi?id=1371843
aa0300
aa0300
Signed-off-by: Shahar Havivi <shaharh@redhat.com>
aa0300
(cherry picked from commit 1ae4252c93c685cb8561b55c1231502b37212b5a)
aa0300
---
aa0300
 v2v/input_ova.ml | 7 ++++---
aa0300
 1 file changed, 4 insertions(+), 3 deletions(-)
aa0300
aa0300
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
aa0300
index 0a4dfd5..932c96b 100644
aa0300
--- a/v2v/input_ova.ml
aa0300
+++ b/v2v/input_ova.ml
aa0300
@@ -185,7 +185,8 @@ object
aa0300
     let name =
aa0300
       match xpath_string "/ovf:Envelope/ovf:VirtualSystem/ovf:Name/text()" with
aa0300
       | None | Some "" ->
aa0300
-        error (f_"could not parse ovf:Name from OVF document")
aa0300
+        warning (f_"could not parse ovf:Name from OVF document");
aa0300
+        "default"
aa0300
       | Some name -> name in
aa0300
 
aa0300
     (* Search for memory. *)
aa0300
@@ -245,10 +246,10 @@ object
aa0300
 
aa0300
         Xml.xpathctx_set_current_context xpathctx n;
aa0300
         let file_id = xpath_string_default "rasd:HostResource/text()" "" in
aa0300
-        let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in
aa0300
+        let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in
aa0300
         if Str.string_match rex file_id 0 then (
aa0300
           (* Chase the references through to the actual file name. *)
aa0300
-          let file_id = Str.matched_group 1 file_id in
aa0300
+          let file_id = Str.matched_group 2 file_id in
aa0300
           let expr = sprintf "/ovf:Envelope/ovf:DiskSection/ovf:Disk[@ovf:diskId='%s']/@ovf:fileRef" file_id in
aa0300
           let file_ref =
aa0300
             match xpath_string expr with
aa0300
-- 
aa0300
2.7.4
aa0300