[Libguestfs] [PATCH 3/4] p2v: Send ping packets every 5 minutes to sshd.

Richard W.M. Jones rjones at redhat.com
Sat Feb 4 14:59:08 UTC 2017


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ý
---
 p2v/ssh.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/p2v/ssh.c b/p2v/ssh.c
index 817048c..4dd4c44 100644
--- a/p2v/ssh.c
+++ b/p2v/ssh.c
@@ -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");
-- 
2.10.2




More information about the Libguestfs mailing list