vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

Added config.ssh.retries and config.ssh.retry_interval to allow for SSH retries

Open nmaludy opened this issue 3 years ago • 4 comments

Closes #10776

When provisioning RHEL VMs, i noticed that the hosts become pingable before the SSH daemon is available. Watching the vagrant logs with --debug i noticed that the SSH connection was not being retried properly. Digging into the code, i also discovered that even with a properly setup retry counter, the retries were happening as fast as possible, not allowing time for the SSH daemon to become available.

To mitigate these problems, i added config.ssh.retries to allow for multiple SSH connection retry attempts before failing (default=5). I also added config.ssh.retry_interval to insert a sleep time (seconds) between each connection attempt, allowing time for the SSH daemon to come up.

This is my first PR to Vagrant. I tried to do the right things, but i'm sure i'm missing some stuff. If you all could help guide me through the contribution process, i would very much appreciate it!

nmaludy avatar Jan 05 '23 19:01 nmaludy

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Jan 05 '23 19:01 hashicorp-cla

Worth noting that the current implementation has no retries at all due to this line (it is always 1 and counter isn't reset), probably you'll be keen to address this quite old observation in your work. Cheers!

https://github.com/hashicorp/vagrant/blob/v2.4.1/plugins/communicators/ssh/communicator.rb#L90

avoidik avatar Jan 17 '23 20:01 avoidik

Hi @nmaludy! I've just merged in https://github.com/hashicorp/vagrant/pull/13048, which modified 120 MDX files and added a new workflow that would be good to have run on this PR. Since this is from a fork, I'm not sure I have permissions to rebase on main for you, so I wanted to send this quick message to let you know to update with main. Thanks!

ashleemboyer avatar Jan 20 '23 22:01 ashleemboyer

hello all,

could you please suggest what can we do to finally close this issue?

avoidik avatar Jan 28 '24 15:01 avoidik