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