On Friday, 4 November 2016 14:52:48 CET Tomáš Golembiovský wrote:
1) The obviously missing check whether QEMU installed in the system
supports the feature we need. Do we already have such (or similar)
checks in libguestfs? Should it be compile-time check or runtime
check?
- yes, we have version checks for qemu, but only internally in the
library (and it does not make sense to export)
- runtime check indeed -- for example something like the following
(taken & simplified from virt-sysprep in the rhel-6.x branches):
let qemu_img_version () =
let cmd = "qemu-img --version" in
let lines = external_command cmd in
match lines with
| [] -> error ("'qemu-img --version' returned no output")
| line :: _ ->
try
sscanf line "qemu-img version %d.%d" (
fun major minor ->
let minor = if minor > 9 then 9 else minor in
float major +. float minor /. 10.
)
with
Scan_failure msg ->
warning (f_"warning: failed to read qemu-img version\n line: %S\n
message: %s\n%!")
line msg;
0.9
2) Lots of 'tar' invocations that may not be easily
understandable.
Left some comments about them.
3) We need a check for sparse files in tar archive. There is a GNU
extension to tar format that allows space-efficient archiving of
sparse files. While the OVF standard does not allow the use of GNU
extensions we probably should not rely on that.
Is there a way to detect such kind of files in archives, falling back
to usual "extract everything" way as done currently.
To address points 2) and 3) I see two possible options. We can
either
use some OCaml module that understands tar. There is however a risk that
such module won't provide the necessary info to detect 3). The second
option is to use e.g. libarchive and write small set of C functions that
would implement the necessary magic and use those in OCaml code.
Richard, do you have any preferences or suggestions in this matter?
That's a workable way too, IMHO.
Thanks,
--
Pino Toscano