[Libguestfs] [PATCH 3/3] v2v: -i ova: Prefer pigz or pxz for uncompressing OVA files (RHBZ#1448739).

Richard W.M. Jones rjones at redhat.com
Mon May 8 09:07:08 UTC 2017


If the parallel tools pigz or pxz are available, prefer them for
uncompressing gz- and xz-compressed OVA files respectively.  If not
available then gzip or xz are used as normal.
---
 v2v/input_ova.ml | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index e21de35fb..b509326dd 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -40,9 +40,19 @@ let libvirt_supports_json_raw_driver () =
   else
     true
 
+let pigz_available =
+  let test = lazy (shell_command "pigz --help >/dev/null 2>&1" = 0) in
+  fun () -> Lazy.force test
+
+let pxz_available =
+  let test = lazy (shell_command "pxz --help >/dev/null 2>&1" = 0) in
+  fun () -> Lazy.force test
+
 let zcat_command_of_format = function
-  | `GZip -> "gzip -c -d"
-  | `XZ -> "xz -c -d"
+  | `GZip ->
+     if pigz_available () then "pigz -c -d" else "gzip -c -d"
+  | `XZ ->
+     if pxz_available () then "pxz -c -d" else "xz -c -d"
 
 (* Untar part or all files from tar archive. If [paths] is specified it is
  * a list of paths in the tar archive.
-- 
2.12.0




More information about the Libguestfs mailing list