v2v: -i ova: Prefer pigz or pxz for uncompressing OVA files (RHBZ#1448739).

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.
This commit is contained in:
Richard W.M. Jones
2017-05-08 09:55:42 +01:00
parent 5e55a9cd4e
commit 0e63e59bf5

View File

@@ -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.