search for: xpathctx

Displaying 20 results from an estimated 147 matches for "xpathctx".

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.
2017 Oct 27
0
[PATCH v11 7/8] mllib: add XPath helper xpath_get_nodes
...--------------- 4 files changed, 30 insertions(+), 45 deletions(-) diff --git a/common/mltools/xpath_helpers.ml b/common/mltools/xpath_helpers.ml index 3afee8b21..d2bfd3fb9 100644 --- a/common/mltools/xpath_helpers.ml +++ b/common/mltools/xpath_helpers.ml @@ -40,3 +40,12 @@ let xpath_eval parsefn xpathctx expr = let xpath_string = 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 -...
2015 Jun 25
0
[PATCH v2] v2v: Free XML objects in the correct order.
...by 0x400A4A: main (in /tmp/test) The following simple test program demonstrates the problem: #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <libxml/xpath.h> int main (int argc, char *argv[]) { xmlDocPtr doc; xmlXPathContextPtr xpathctx; xmlXPathObjectPtr xpathobj; doc = xmlReadMemory ("<test/>", 7, NULL, NULL, XML_PARSE_NONET); assert (doc); xpathctx = xmlXPathNewContext (doc); assert (xpathctx); xpathobj = xmlXPathEvalExpression (BAD_CAST "/test", xpathctx); assert (xpathobj...
2015 Jun 25
0
[PATCH] v2v: Free XML objects in the correct order.
...by 0x400A4A: main (in /tmp/test) The following simple test program demonstrates the problem: #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <libxml/xpath.h> int main (int argc, char *argv[]) { xmlDocPtr doc; xmlXPathContextPtr xpathctx; xmlXPathObjectPtr xpathobj; doc = xmlReadMemory ("<test/>", 7, NULL, NULL, XML_PARSE_NONET); assert (doc); xpathctx = xmlXPathNewContext (doc); assert (xpathctx); xpathobj = xmlXPathEvalExpression (BAD_CAST "/test", xpathctx); assert (xpathobj...
2017 Oct 08
0
[PATCH v2 4/4] common/mltools: xpath_helpers: Get rid of xpath_*_default functions.
...+++++++-------- 5 files changed, 15 insertions(+), 34 deletions(-) diff --git a/common/mltools/xpath_helpers.ml b/common/mltools/xpath_helpers.ml index 05fad89a4..3afee8b21 100644 --- a/common/mltools/xpath_helpers.ml +++ b/common/mltools/xpath_helpers.ml @@ -40,15 +40,3 @@ let xpath_eval parsefn xpathctx expr = let xpath_string = xpath_eval identity let xpath_int = xpath_eval int_of_string let xpath_int64 = xpath_eval Int64.of_string - -(* Parse an xpath expression and return a string/int; if the expression - * doesn't match, return the default. - *) -let xpath_eval_default parsefn xpath exp...
2015 Oct 08
0
[PATCH] v2v: Add xpath_int64 functions, and use them to read memory values.
....ml | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml index 976848f..d8c6215 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -54,7 +54,8 @@ let parse_libvirt_xml ?conn xml = let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx and xpath_int = xpath_int xpathctx - and xpath_int_default = xpath_int_default xpathctx in + and xpath_int_default = xpath_int_default xpathctx + and xpath_int64_default = xpath_int64_default xpathctx in let hyper...
2014 Aug 26
3
Segmentation fault when trying to add binding
...=============================================================== diff --git a/v2v/xml-c.c b/v2v/xml-c.c index 4c9bc77..a917c24 100644 --- a/v2v/xml-c.c +++ b/v2v/xml-c.c @@ -141,6 +141,16 @@ v2v_xml_xpath_new_context (value docv) } value +v2v_xml_xpath_register_ns (value prefix, value uri, value xpathctx) +{ + CAMLparam3 (prefix, uri, xpathctx); + CAMLlocal1 (retval); + retval = xmlXPathRegisterNs (BAD_CAST String_val (prefix), BAD_CAST String_val (uri), xpathctx); + + CAMLreturn (retval); +} + +value v2v_xml_xpath_eval_expression (value xpathctxv, value exprv) { CAMLparam2 (xpathctxv, exp...
2017 Mar 16
2
[PATCH v2] v2v: -i libvirt: If <vcpu> is missing, calculate it from CPU topology.
...v-print-source.expected | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index 6032c31..2dee274 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -50,7 +50,7 @@ let parse_libvirt_xml ?conn xml = let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx and xpath_int = xpath_int xpathctx - and xpath_int_default = xpath_int_default xpathctx + (*and xpath_int_default = xpath_int_default xpathctx*) and xpath_int64_default = xpath_int64_default xpathctx in let hype...
2017 Mar 13
0
[PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
...oop () in (try loop () with End_of_file -> ()); close_in chan ) mf; - (* Parse the ovf file. *) let ovf_folder = Filename.dirname ovf in - let xml = read_whole_file ovf in - let doc = Xml.parse_memory xml in - - (* Handle namespaces. *) - let xpathctx = Xml.xpath_new_context doc in - Xml.xpath_register_ns xpathctx - "ovf" "http://schemas.dmtf.org/ovf/envelope/1"; - Xml.xpath_register_ns xpathctx - "rasd" "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";...
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 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.
2017 Apr 04
1
Re: [PATCH v5 09/10] mllib: add XPath helper xpath_get_nodes()
...> @@ -53,3 +53,12 @@ let xpath_eval_default parsefn xpath expr default = > let xpath_string_default = xpath_eval_default identity > let xpath_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] You can use the utilities from Common_utils for manip...
2017 Oct 08
1
Re: [PATCH v11 5/6] mllib: add XPath helper xpath_get_nodes()
The subject says ‘xpath_get_nodes()‘, but this function doesn't actually take a unit parameter, so it's better 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...
2016 Nov 16
3
[PATCH 1/2] libvirt: un-duplicate XPath code
...ObjectPtr xpvolume = NULL; - xmlAttrPtr attr; int readonly; int t; @@ -527,31 +528,21 @@ for_each_disk (guestfs_h *g, * Check the <disk type=..> attribute first to find out which one. */ xptype = xmlXPathEvalExpression (BAD_CAST "./@type", xpathCtx); - if (xptype == NULL || - xptype->nodesetval == NULL || - xptype->nodesetval->nodeNr == 0) { + if (xPathObjectIsEmpty (xptype)) continue; /* no type attribute, skip it */ - } - assert (xptype->nodesetval->nodeTab[0]); -...
2014 Nov 24
3
[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()" 0 in *) (* Find the parent controller....
2013 Feb 28
7
[PATCH 0/7] Fix SELinux security contexts so we can access shared disks (RHBZ#912499).
https://bugzilla.redhat.com/show_bug.cgi?id=912499 (especially comments 7 & 10) This patch set is the final fix so that we can access disks in use by other guests when SELinux and sVirt are enabled. Previously such disks were inaccessible because sVirt labels the disks with a random SELinux label to prevent other instances of qemu from being able to read them. So naturally the libguestfs
2017 Oct 27
15
[PATCH v11 0/8] virt-builder-repository
Hi all, Here is the latest version of the series. Diffs to v10: * Make Index.arch a (string, string option) maybe and use it to guess arch at parse time * Compute the image size at parse time when the template flag is set and the value is missing. * Add virt-repository_main slow test * Other fixes from Richard's comments Cédric Bosdonnat (7): Ignore builder/*.out and *.img
2017 Mar 17
0
Re: [PATCH v2] v2v: -i libvirt: If <vcpu> is missing, calculate it from CPU topology.
...files changed, 17 insertions(+), 3 deletions(-) > > diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml > index 6032c31..2dee274 100644 > --- a/v2v/parse_libvirt_xml.ml > +++ b/v2v/parse_libvirt_xml.ml > @@ -50,7 +50,7 @@ let parse_libvirt_xml ?conn xml = > let xpathctx = Xml.xpath_new_context doc in > let xpath_string = xpath_string xpathctx > and xpath_int = xpath_int xpathctx > - and xpath_int_default = xpath_int_default xpathctx > + (*and xpath_int_default = xpath_int_default xpathctx*) > and xpath_int64_default = xpath_int64_default...
2017 Mar 16
2
[PATCH] v2v: -i libvirt: If <vcpu> is missing, calculate it from CPU topology.
...t_xml.ml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index 6032c31..fb895e4 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -50,7 +50,7 @@ let parse_libvirt_xml ?conn xml = let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx and xpath_int = xpath_int xpathctx - and xpath_int_default = xpath_int_default xpathctx + (*and xpath_int_default = xpath_int_default xpathctx*) and xpath_int64_default = xpath_int64_default xpathctx in let hype...
2013 Feb 28
5
[PATCH v2 0/5] Fix SELinux security contexts so we can access shared disks (RHBZ#912499).
Link to version 1: https://www.redhat.com/archives/libguestfs/2013-February/thread.html#00122 Changes since version 1: - I've pushed two (of the three) code refactoring patches. The third one proved rather hard to move. - selinuxnorelabel option is no more. Instead there is a second internal API (internal_set_libvirt_selinux_norelabel_disks). - fixed bogus commit message -