On Thursday, 22 March 2018 17:05:27 CET Richard W.M. Jones wrote:
When parsing OVA files we have to work backwards to whether the original VMware object was a network or a bridge. It seems as if the presence of <rasd:Connection> is sufficient. I dropped the use of <rasd:ElementName> since it is literally just an internal name for the network element, and is not significant in how the network is used.
Also update documentation because you must use ‘--bridge’ when converting VMware guests to RHV.
For a full explanation see:
Please update the .expected files in the test suite, since the output of --print-source changed for some: FAIL: test-v2v-i-ova-gz.sh FAIL: test-v2v-i-ova-formats.sh FAIL: test-v2v-i-ova-subfolders.sh FAIL: test-v2v-i-ova-tar.sh FAIL: test-v2v-i-ova-two-disks.sh FAIL: test-v2v-i-ova.sh
diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml index d8de0cea1..82d7adf8c 100644 --- a/v2v/parse_ovf_from_ova.ml +++ b/v2v/parse_ovf_from_ova.ml @@ -230,16 +230,17 @@ let parse_ovf_from_ova ovf_filename = for i = 0 to nr_nodes-1 do let n = Xml.xpathobj_node obj i in Xml.xpathctx_set_current_context xpathctx n; - let vnet = - Option.default (sprintf"eth%d" i) - (xpath_string "rasd:ElementName/text()") in + let vnet, vnet_type = + match xpath_string "rasd:Connection/text()" with + | Some connection -> connection, Bridge + | None -> sprintf"eth%d" i, Network in
Missing space here ^ (Yes, it is missing in the current code too, but since it is shuffled by your patch...) The rest of the patch LGTM. -- Pino Toscano