Pino Toscano
2020-Jan-17 16:09 UTC
[Libguestfs] [v2v PATCH] -i ova: use Xml.parse_file for the OVF
No need to read the whole OVF file in memory and parse that -- let
libxml2 parse it directly.
---
v2v/parse_ovf_from_ova.ml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --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
Richard W.M. Jones
2020-Jan-17 21:49 UTC
Re: [Libguestfs] [v2v PATCH] -i ova: use Xml.parse_file for the OVF
On Fri, Jan 17, 2020 at 05:09:20PM +0100, Pino Toscano wrote:> No need to read the whole OVF file in memory and parse that -- let > libxml2 parse it directly. > --- > v2v/parse_ovf_from_ova.ml | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --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 inObvious fix, ACK, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Apparently Analagous Threads
- [PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
- [PATCH] v2v: -i ova: parse MAC address from <rasd:Address> (RHBZ#1506572)
- [PATCH 4/4] v2v: Pass CPU vendor, model and topology from source to target.
- [PATCH] v2v: Fix parsing of OVA files and documentation for --network and --bridge (RHBZ#1559027).
- [PATCH] v2v: rework handling of CPU topology