p2v: Send ping packets every 5 minutes to sshd.

Also drop the connection if no response at all has been received after
30 minutes.

This action should prevent firewall timeouts from causing virt-p2v to
fail (see this thread:
https://www.redhat.com/archives/libguestfs/2017-February/msg00010.html).

Thanks: Tomáš Golembiovský
This commit is contained in:
Richard W.M. Jones
2017-02-04 14:30:29 +00:00
parent 27b64f8227
commit 2f97cd5517

View File

@@ -354,6 +354,10 @@ start_ssh (unsigned spawn_flags, struct config *config,
snprintf (connect_timeout_str, sizeof connect_timeout_str,
"ConnectTimeout=%d", SSH_TIMEOUT);
ADD_ARG (argv, i, connect_timeout_str);
ADD_ARG (argv, i, "-o"); /* Send ping packets every 5 mins to sshd. */
ADD_ARG (argv, i, "ServerAliveInterval=300");
ADD_ARG (argv, i, "-o");
ADD_ARG (argv, i, "ServerAliveCountMax=6");
if (using_password_auth) {
/* Only use password authentication. */
ADD_ARG (argv, i, "-o");