[Libguestfs] [PATCH v3 2/6] v2v: ova: don't detect compressed disks, read the OVF instead
Pino Toscano
ptoscano at redhat.com
Fri Dec 9 13:01:40 UTC 2016
On Wednesday, 7 December 2016 17:13:06 CET Tomáš Golembiovský wrote:
> The information whether the disk is gzip compressed or not is stored
> in the OVF. There is no reason to do the detection.
>
> Signed-off-by: Tomáš Golembiovský <tgolembi at redhat.com>
> ---
> v2v/input_ova.ml | 28 +++++++++++++++++-----------
> v2v/test-v2v-i-ova-gz.ovf | 2 +-
> 2 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
> index b283629..61930f0 100644
> --- a/v2v/input_ova.ml
> +++ b/v2v/input_ova.ml
> @@ -275,6 +275,13 @@ object
> | None -> error (f_"no href in ovf:File (id=%s)") file_ref
> | Some s -> s in
>
> + let expr = sprintf "/ovf:Envelope/ovf:References/ovf:File[@ovf:id='%s']/@ovf:compression" file_ref in
> + let compressed =
> + match xpath_string expr with
> + | None | Some "identity" -> false
> + | Some "gzip" -> true
> + | Some s -> error (f_"unsupported compression in OVF: %s") s in
I'd still do the detection when no ovf:compression attribute is found
(that is, the None case above).
After all, right now we do the detection for any ova already, so a
"broken ova" (with no compression attribute in the ovf but with a
compressed image) is already handled by the current code.
It could look something like this:
let compressed =
match xpath_string expr with
| None -> None
| Some "identity" -> Some false
| Some "gzip" -> Some true
| Some s -> error (f_"unsupported compression in OVF: %s") s in
let compressed =
match compressed with
| None -> (* do detection *)
| Some c -> c in
Thanks,
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20161209/6e837754/attachment.sig>
More information about the Libguestfs
mailing list