search for: parse_memory

Displaying 20 results from an estimated 50 matches for "parse_memory".

2017 Feb 10
0
[PATCH v3 03/10] mllib: add Xml.parse_file helper
...function rather than having callers read the file and then parse the string. --- mllib/xml.ml | 4 ++++ mllib/xml.mli | 3 +++ 2 files changed, 7 insertions(+) diff --git a/mllib/xml.ml b/mllib/xml.ml index e67245188..78e75b8f2 100644 --- a/mllib/xml.ml +++ b/mllib/xml.ml @@ -67,6 +67,10 @@ let parse_memory xml = Gc.finalise free_docptr docptr; docptr +let parse_file file = + let xml = Common_utils.read_whole_file file in + parse_memory xml + external _copy_doc : docptr -> recursive:bool -> docptr = "mllib_xml_copy_doc" let copy_doc docptr ~recursive = let copy = _copy_d...
2020 Jan 17
1
[v2v PATCH] -i ova: use Xml.parse_file for the OVF
...ff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml index 27761d23..5acf7070 100644 --- a/v2v/parse_ovf_from_ova.ml +++ b/v2v/parse_ovf_from_ova.ml @@ -36,8 +36,7 @@ type ovf_disk = { } let xpathctx_of_ovf ovf_filename = - let xml = read_whole_file ovf_filename in - let doc = Xml.parse_memory xml in + let doc = Xml.parse_file ovf_filename in (* Handle namespaces. *) let xpathctx = Xml.xpath_new_context doc in -- 2.24.1
2020 Jan 17
1
[v2v PATCH] -o libvirt: read pool name from object
...*) - let xml = - let pool = Libvirt_utils.get_pool self#conn output_pool in - Libvirt.Pool.get_xml_desc (Libvirt.Pool.const pool) in + let pool = Libvirt_utils.get_pool self#conn output_pool in + let xml = Libvirt.Pool.get_xml_desc (Libvirt.Pool.const pool) in let doc = Xml.parse_memory xml in let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx in @@ -125,12 +124,7 @@ object (self) (* Get the name of the pool, since we have to use that * (and not the UUID) in the XML of the guest. *) - let name = - match xpath_str...
2017 Jan 03
0
[PATCH 4/5] mllib: add libosinfo DB reading helpers
...et distro_path = os_path // distro in + let os_files = Array.to_list (Sys.readdir distro_path) in + List.map ( + fun os_file -> + let file_path = distro_path // os_file in + let xml = read_whole_file file_path in + let doc = Xml.parse_memory xml in + let xpathctx = Xml.xpath_new_context doc in + filter xpathctx + ) os_files + ) distros + ) + ) + +let osinfo_db_read_flat os_path filter = + let os_files = Array.to_list (Sys.readdir os_path) in + remove_duplicates ( + List.map ( + fun...
2017 Feb 07
0
[PATCH v2 2/7] Move xml and xpath_helpers OCAML code to mllib
...custom_operations = { }; value -v2v_xml_free_xpathobjptr (value xpathobjv) +mllib_xml_free_xpathobjptr (value xpathobjv) { CAMLparam1 (xpathobjv); xmlXPathObjectPtr xpathobj = xpathobjptr_val (xpathobjv); @@ -106,7 +107,7 @@ v2v_xml_free_xpathobjptr (value xpathobjv) } value -v2v_xml_parse_memory (value xmlv) +mllib_xml_parse_memory (value xmlv) { CAMLparam1 (xmlv); CAMLlocal1 (docv); @@ -128,7 +129,7 @@ v2v_xml_parse_memory (value xmlv) } value -v2v_xml_copy_doc (value docv, value recursivev) +mllib_xml_copy_doc (value docv, value recursivev) { CAMLparam2 (docv, recursivev);...
2016 May 19
2
[PATCH] v2v: handle subfolders in ova files
...diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index 1aba662..b0d9357 100644 --- a/v2v/input_ova.ml +++ b/v2v/input_ova.ml @@ -165,6 +165,7 @@ object ) 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 @@ -265,7 +266,7 @@ object | Some s -> s in (* Does the file exist and is it readable? *) - let filename = exploded // filename in + let filename = ovf_folder // filename in Unix.access filename [Unix.R_OK]; (* The spec...
2019 Apr 08
0
[PATCH v4 4/7] v2v: -o libvirt: use a Lazy for the connection
...utput_libvirt oc output_pool = object * and dump out its XML. *) let xml = - let pool = Libvirt_utils.get_pool conn output_pool in + let pool = Libvirt_utils.get_pool self#conn output_pool in Libvirt.Pool.get_xml_desc (Libvirt.Pool.const pool) in let doc = Xml.parse_memory xml in let xpathctx = Xml.xpath_new_context doc in -- 2.20.1
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
2016 May 19
0
Re: [PATCH] v2v: handle subfolders in ova files
...> index 1aba662..b0d9357 100644 > --- a/v2v/input_ova.ml > +++ b/v2v/input_ova.ml > @@ -165,6 +165,7 @@ object > ) 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 > > @@ -265,7 +266,7 @@ object > | Some s -> s in > > (* Does the file exist and is it readable? *) > - let filename = exploded // filename in > + let filename = ovf_folder // filename in > Unix.access filena...
2015 Jun 25
0
[PATCH v2] v2v: Free XML objects in the correct order.
...@@ static struct custom_operations xpathobj_custom_operations = { }; value +v2v_xml_free_xpathobj_ptr (value xpathobjv) +{ + CAMLparam1 (xpathobjv); + xmlXPathObjectPtr xpathobj = Xpathobj_ptr_val (xpathobjv); + + xmlXPathFreeObject (xpathobj); + CAMLreturn (Val_unit); +} + +value v2v_xml_parse_memory (value xmlv) { CAMLparam1 (xmlv); @@ -159,7 +162,7 @@ v2v_xml_to_string (value docv, value formatv) } value -v2v_xml_xpath_new_context (value docv) +v2v_xml_xpath_new_context_ptr (value docv) { CAMLparam1 (docv); CAMLlocal1 (xpathctxv); @@ -171,21 +174,21 @@ v2v_xml_xpath_new_context...
2015 Jun 25
0
[PATCH] v2v: Free XML objects in the correct order.
...tic struct custom_operations xpathobj_custom_operations = { }; value +v2v_xml_xpathobj_ptr_free_object (value xpathobjv) +{ + CAMLparam1 (xpathobjv); + xmlXPathObjectPtr xpathobj = Xpathobj_ptr_val (xpathobjv); + + xmlXPathFreeObject (xpathobj); + CAMLreturn (Val_unit); +} + +value v2v_xml_parse_memory (value xmlv) { CAMLparam1 (xmlv); @@ -159,7 +162,7 @@ v2v_xml_to_string (value docv, value formatv) } value -v2v_xml_xpath_new_context (value docv) +v2v_xml_xpath_new_context_ptr (value docv) { CAMLparam1 (docv); CAMLlocal1 (xpathctxv); @@ -171,21 +174,21 @@ v2v_xml_xpath_new_context...
2017 Jun 29
0
[PATCH] v2v: Allow -i libvirtxml to open network disks over http or https.
...;file.sslverify", JSON.String "off"; XXX *) + ] in + + (* Turn the JSON parameters into a 'json:' protocol string. *) + "json: " ^ JSON.string_of_doc json_params + let parse_libvirt_xml ?conn xml = debug "libvirt xml is:\n%s" xml; let doc = Xml.parse_memory xml in let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx + and xpath_string_default = xpath_string_default xpathctx and xpath_int = xpath_int xpathctx (*and xpath_int_default = xpath_int_default xpathctx*) and xpath_int64_default = xpath_int64_defa...
2017 Oct 08
0
[PATCH v2 4/4] common/mltools: xpath_helpers: Get rid of xpath_*_default functions.
...h") in (* Parse the disks. *) let get_disks, add_disk = diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index 2f90bee0c..421175373 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -77,10 +77,8 @@ let parse_libvirt_xml ?conn xml = let doc = Xml.parse_memory xml in let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx - and xpath_string_default = xpath_string_default xpathctx and xpath_int = xpath_int xpathctx - (*and xpath_int_default = xpath_int_default xpathctx*) - and xpath_int64_default = xpath_int64_defa...
2014 Aug 26
3
Segmentation fault when trying to add binding
...hctx); + + CAMLreturn (retval); +} + +value v2v_xml_xpath_eval_expression (value xpathctxv, value exprv) { CAMLparam2 (xpathctxv, exprv); diff --git a/v2v/xml.ml b/v2v/xml.ml index 78cb022..2e4d222 100644 --- a/v2v/xml.ml +++ b/v2v/xml.ml @@ -31,6 +31,7 @@ type node = doc * node_ptr external parse_memory : string -> doc = "v2v_xml_parse_memory" external xpath_new_context : doc -> xpathctx = "v2v_xml_xpath_new_context" external xpath_eval_expression : xpathctx -> string -> xpathobj = "v2v_xml_xpath_eval_expression" +external xpath_register_ns : string -&gt...
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 Sep 08
2
[PATCH] RFC: v2v: add and use libvirt connection objects
...output_libvirt oc output_pool = object (* Connect to output libvirt instance and check that the pool exists * and dump out its XML. *) - let xml = Libvirt_utils.pool_dumpxml ?conn:oc output_pool in + let xml = Libvirt_utils.pool_dumpxml conn output_pool in let doc = Xml.parse_memory xml in let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx in diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index c71707000..e3260c429 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -71,7 +71,7 @@ let create_curl...
2014 Oct 31
0
[PATCH] v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
...md in + let xml = String.concat "\n" xml in + + if verbose then printf "libvirt capabilities XML:\n%s\n%!" xml; + + (* This just checks that the capabilities XML is well-formed, + * early so that we catch parsing errors before conversion. + *) + let doc = Xml.parse_memory xml in + + (* Stash the capabilities XML, since we cannot get the bits we + * need from it until we know the guest architecture, which happens + * after conversion. + *) + capabilities_doc <- Some doc; + (* Connect to output libvirt instance and check that the pool exists...
2017 Mar 13
0
[PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
...o parse line from manifest file: %S") line; loop () 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...
2019 Apr 08
0
[PATCH v4 3/7] v2v: switch to ocaml-libvirt
...stance and check that the pool exists * and dump out its XML. *) - let xml = Libvirt_utils.pool_dumpxml ?conn:oc output_pool in + let xml = + let pool = Libvirt_utils.get_pool conn output_pool in + Libvirt.Pool.get_xml_desc (Libvirt.Pool.const pool) in let doc = Xml.parse_memory xml in let xpathctx = Xml.xpath_new_context doc in let xpath_string = xpath_string xpathctx in diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index d5d78d367..8f620331c 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -74,6 +74,17 @@ let create_cur...
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.