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

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to