[Libguestfs] [PATCH] v2v: -i vmx: Use scp -T option if available to unbreak scp (RHBZ#1733168).

Pino Toscano ptoscano at redhat.com
Thu Aug 1 15:56:37 UTC 2019


On Thursday, 25 July 2019 16:01:59 CEST Richard W.M. Jones wrote:
> Tested using:
> 
> cd v2v
> LIBGUESTFS_BACKEND=direct ../run virt-v2v -i vmx -it ssh "ssh://localhost/$PWD/test-v2v-i-vmx-1.vmx" -o null -v -x
> 
> and manually examining the debug output.
> 
> Thanks: Ming Xie, Jakub Jelen.
> ---

This (the issue, and the solution) is rather ugly, although I do not
see an easier solution than either
a) switch to the sftp(1) utility (and thus switch from scp to sftp)
b) use a ssh library (libssh) for fetching the vmx file

So for now I'd say to go with this, with the following fixes:

> +let scp_supports_T_option = lazy (
> +  let cmd = "LANG=C scp -T |& grep \"unknown option\"" in
> +  if verbose () then
> +    eprintf "%s\n%!" cmd;
> +  Sys.command cmd <> 0

There is already Tools_utils.shell_command that does the 3 lines above.

Also, the Lazy is not needed here, as the vmx file is downloaded using
scp_from_remote_to_temporary only once.  So I'd move the
scp_supports_T_option helper within scp_from_remote_to_temporary.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190801/d4d67d63/attachment.sig>


More information about the Libguestfs mailing list