search for: xpathobj_nod

Displaying 20 results from an estimated 49 matches for "xpathobj_nod".

Did you mean: xpathobj_node
2015 Jun 25
0
[PATCH v2] v2v: Free XML objects in the correct order.
...irtxml.ml index ba00d94..646346d 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -44,14 +44,14 @@ let parse_libvirt_xml ?conn xml = let obj = Xml.xpath_eval_expression xpathctx expr in if Xml.xpathobj_nr_nodes obj < 1 then default else ( - let node = Xml.xpathobj_node doc obj 0 in + let node = Xml.xpathobj_node obj 0 in Xml.node_as_string node ) and xpath_to_int expr default = let obj = Xml.xpath_eval_expression xpathctx expr in if Xml.xpathobj_nr_nodes obj < 1 then default else ( - let node = Xml.xpathobj_node doc obj...
2015 Jun 25
0
[PATCH] v2v: Free XML objects in the correct order.
...irtxml.ml index ba00d94..646346d 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -44,14 +44,14 @@ let parse_libvirt_xml ?conn xml = let obj = Xml.xpath_eval_expression xpathctx expr in if Xml.xpathobj_nr_nodes obj < 1 then default else ( - let node = Xml.xpathobj_node doc obj 0 in + let node = Xml.xpathobj_node obj 0 in Xml.node_as_string node ) and xpath_to_int expr default = let obj = Xml.xpath_eval_expression xpathctx expr in if Xml.xpathobj_nr_nodes obj < 1 then default else ( - let node = Xml.xpathobj_node doc obj...
2015 Jun 25
2
[PATCH v2] v2v: Free XML objects in the correct order.
In version 2: - No substantial change, I just tidied up the code a bit. - Removed one case where whitespace changes had crept in. Rich.
2015 Aug 28
7
v2v: -i libvirtxml: Map empty network or bridge name to a default (RHBZ#1257895).
When importing from VMware via the libvirt driver, the libvirt driver can add an empty source bridge name: <interface type='bridge'> <mac address='00:01:02:03:04:05:06'/> <source bridge=''/> </interface> Replicate what we do on the -i ova path, and map these to "eth0", "eth1" etc. This also includes a bunch
2017 Oct 08
1
Re: [PATCH v11 5/6] mllib: add XPath helper xpath_get_nodes()
...to drop ‘()’. On Thu, Oct 05, 2017 at 04:58:29PM +0200, Cédric Bosdonnat wrote: > + > +let xpath_get_nodes xpathctx expr = > + let obj = Xml.xpath_eval_expression xpathctx expr in > + let nodes = ref [] in > + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do > + let node = Xml.xpathobj_node obj i in > + push_back nodes node > + done; > + !nodes ‘push_back’ is unfortunately O(n) and no tail recursive, and so the whole loop is O(n²). It's going to be much more efficient therefore to build the list up in reverse and reverse it at the end: for ... ... push_...
2014 Nov 24
3
[PATCH] v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
...- v2v/input_ova.ml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index 95af2e5..9a9c10a 100644 --- a/v2v/input_ova.ml +++ b/v2v/input_ova.ml @@ -187,14 +187,17 @@ object for i = 0 to nr_nodes-1 do let n = Xml.xpathobj_node doc obj i in Xml.xpathctx_set_current_context xpathctx n; - let parent_id = xpath_to_int "rasd:Parent/text()" 0 in (* XXX We assume the OVF lists these in order. let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in *)...
2017 Oct 27
0
[PATCH v11 7/8] mllib: add XPath helper xpath_get_nodes
...= xpath_eval identity let xpath_int = xpath_eval int_of_string let xpath_int64 = xpath_eval Int64.of_string + +let xpath_get_nodes xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + let nodes = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let node = Xml.xpathobj_node obj i in + push_front node nodes + done; + List.rev !nodes diff --git a/common/mltools/xpath_helpers.mli b/common/mltools/xpath_helpers.mli index 3a8190b05..3a2607aeb 100644 --- a/common/mltools/xpath_helpers.mli +++ b/common/mltools/xpath_helpers.mli @@ -25,3 +25,7 @@ val xpath_int : Xml.xpa...
2017 Mar 13
0
[PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
...) = - let expr = "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType/text()=17]" in - let obj = Xml.xpath_eval_expression xpathctx expr in - let nr_nodes = Xml.xpathobj_nr_nodes obj in - for i = 0 to nr_nodes-1 do - let n = Xml.xpathobj_node obj i in - Xml.xpathctx_set_current_context xpathctx n; - - (* XXX We assume the OVF lists these in order. - let address = xpath_int "rasd:AddressOnParent/text()" in - *) - - (* Find the parent controller. *) - let parent_id = xpath_int "ras...
2017 Apr 04
1
Re: [PATCH v5 09/10] mllib: add XPath helper xpath_get_nodes()
...int_of_string > let xpath_int64_default = xpath_eval_default Int64.of_string > + > +let xpath_get_nodes xpathctx expr = > + let obj = Xml.xpath_eval_expression xpathctx expr in > + let nodes = ref [] in > + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do > + let node = Xml.xpathobj_node obj i in > + nodes := List.append !nodes [node] You can use the utilities from Common_utils for manipulating list references, so: push_back nodes node; The other option to not use a list reference to collect the nodes would be to use a tail-recursive function to iterate the xpathobj nod...
2017 Mar 13
4
[PATCH 0/2] v2v: -i ova: A couple of cleanup patches.
A couple of patches cleaning up the -i ova code. These are both just refactoring (or should be at any rate). The second patch is best viewed with 'git show -w' to exclude whitespace changes. Rich.
2018 Mar 22
1
[PATCH] v2v: Fix parsing of OVA files and documentation for --network and --bridge (RHBZ#1559027).
...ns(+), 22 deletions(-) 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()&qu...
2014 Oct 31
0
[PATCH] v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
...Old virt-v2v used to die here, but that seems unfair since the + * user has gone through conversion before we reach here. + *) + warning (f_"the target hypervisor does not support a %s KVM guest") arch; + [] + ) else ( + let node (* first matching <guest> *) = Xml.xpathobj_node doc obj 0 in + Xml.xpathctx_set_current_context xpathctx node; + + (* Get guest/features/* nodes. *) + let obj = Xml.xpath_eval_expression xpathctx "features/*" in + + let features = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let feature_node = Xml.xp...
2017 Mar 23
0
[PATCH v5 09/10] mllib: add XPath helper xpath_get_nodes()
...h_int_default = xpath_eval_default int_of_string let xpath_int64_default = xpath_eval_default Int64.of_string + +let xpath_get_nodes xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + let nodes = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let node = Xml.xpathobj_node obj i in + nodes := List.append !nodes [node] + done; + !nodes diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli index 7434ba645..ab176351f 100644 --- a/mllib/xpath_helpers.mli +++ b/mllib/xpath_helpers.mli @@ -31,3 +31,7 @@ val xpath_int_default : Xml.xpathctx -> string ->...
2017 Sep 12
0
[PATCH v8 6/7] mllib: add XPath helper xpath_get_nodes()
...h_int_default = xpath_eval_default int_of_string let xpath_int64_default = xpath_eval_default Int64.of_string + +let xpath_get_nodes xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + let nodes = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let node = Xml.xpathobj_node obj i in + push_back nodes node + done; + !nodes diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli index 7434ba645..83c770281 100644 --- a/mllib/xpath_helpers.mli +++ b/mllib/xpath_helpers.mli @@ -31,3 +31,7 @@ val xpath_int_default : Xml.xpathctx -> string -> int -> int...
2017 Sep 18
0
[PATCH v9 5/7] mllib: add XPath helper xpath_get_nodes()
...h_int_default = xpath_eval_default int_of_string let xpath_int64_default = xpath_eval_default Int64.of_string + +let xpath_get_nodes xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + let nodes = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let node = Xml.xpathobj_node obj i in + push_back nodes node + done; + !nodes diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli index 7434ba645..83c770281 100644 --- a/mllib/xpath_helpers.mli +++ b/mllib/xpath_helpers.mli @@ -31,3 +31,7 @@ val xpath_int_default : Xml.xpathctx -> string -> int -> int...
2017 Sep 20
0
[PATCH v10 5/6] mllib: add XPath helper xpath_get_nodes()
...h_int_default = xpath_eval_default int_of_string let xpath_int64_default = xpath_eval_default Int64.of_string + +let xpath_get_nodes xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + let nodes = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let node = Xml.xpathobj_node obj i in + push_back nodes node + done; + !nodes diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli index 7434ba645..83c770281 100644 --- a/mllib/xpath_helpers.mli +++ b/mllib/xpath_helpers.mli @@ -31,3 +31,7 @@ val xpath_int_default : Xml.xpathctx -> string -> int -> int...
2017 Oct 05
0
[PATCH v11 5/6] mllib: add XPath helper xpath_get_nodes()
...h_int_default = xpath_eval_default int_of_string let xpath_int64_default = xpath_eval_default Int64.of_string + +let xpath_get_nodes xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + let nodes = ref [] in + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do + let node = Xml.xpathobj_node obj i in + push_back nodes node + done; + !nodes diff --git a/common/mltools/xpath_helpers.mli b/common/mltools/xpath_helpers.mli index 7434ba645..83c770281 100644 --- a/common/mltools/xpath_helpers.mli +++ b/common/mltools/xpath_helpers.mli @@ -31,3 +31,7 @@ val xpath_int_default : Xml.xpath...
2018 Jun 07
0
[PATCH] v2v: parse_libvirt_xml: Simplify code by using xpath_get_nodes utility fn.
...let parse_libvirt_xml ?conn xml = | _, _, _ -> None in let features = - let features = ref [] in - let obj = Xml.xpath_eval_expression xpathctx "/domain/features/*" in - let nr_nodes = Xml.xpathobj_nr_nodes obj in - for i = 0 to nr_nodes-1 do - let node = Xml.xpathobj_node obj i in - List.push_front (Xml.node_name node) features - done; - !features in + let nodes = xpath_get_nodes xpathctx "/domain/features/*" in + List.map Xml.node_name nodes in let display = let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/gra...
2014 Nov 24
0
Re: [PATCH] v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
...1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml > index 95af2e5..9a9c10a 100644 > --- a/v2v/input_ova.ml > +++ b/v2v/input_ova.ml > @@ -187,14 +187,17 @@ object > for i = 0 to nr_nodes-1 do > let n = Xml.xpathobj_node doc obj i in > Xml.xpathctx_set_current_context xpathctx n; > - let parent_id = xpath_to_int "rasd:Parent/text()" 0 in > > (* XXX We assume the OVF lists these in order. > let address = xpath_to_int "rasd:AddressOnParent/text()&quot...
2015 Oct 08
0
[PATCH] v2v: Add xpath_int64 functions, and use them to read memory values.
...rror (f_"expecting XML expression to return an integer (expression: %s, matching string: %s)") expr str ) +let xpath_int64 xpathctx expr = + let obj = Xml.xpath_eval_expression xpathctx expr in + if Xml.xpathobj_nr_nodes obj < 1 then None + else ( + let node = Xml.xpathobj_node obj 0 in + let str = Xml.node_as_string node in + try Some (Int64.of_string str) + with Failure "int_of_string" -> + error (f_"expecting XML expression to return an integer (expression: %s, matching string: %s)") + expr str + ) (* Parse an xpath...