Commit df82a41
Combine SSHConnection._init_connection and Microvm.wait_for_ssh_up
We use `Microvm.wait_for_ssh_up` to wait for a booted guest's userland
to be initialized enough that it can process incoming SSH connections.
However, it turns out that we werent waiting the intended 10s, we were
waiting 3s. The reason for this is that before the `true` command in
`wait_for_ssh_up` is even sent to the guest, we go through the
`Microvm.ssh` property, which calls the `Microvm.ssh_face` function,
which constructs an `SSHConnection` object, whose construtor calls
`SSHConnection._init_connection`. And inside `_init_connection`, we
_already_ try to send a `true` command to the guest, to ascertain it is
up and running. However, here we do it in a retry loop (needed because
if port 22 is still closed, `ssh` exits with non-zero code and
"connection refuses") that does 20 retries at 0.15s intervals. Or tries
to 3 seconds. Most importantly, the retries in `_init_connection` are
done without timeouts, so even _if_ we actually hung during connection
establishment, `wait_for_ssh_up` wouldn't abort after 10 seconds,
because it would get stuck inside of `_init_connection`, which doesn't
know anything about a 10s timeout.
Fix all this up by merging `_init_connection` and `wait_for_ssh_up`.
Skip sending the `true` command in `wait_for_ssh_up`, and just call
`ssh_iface(0)` directly. Increment the retry time in `_init_connection`
to actually be 10s. And add a 10s timeout to the commands in
`_init_connection`.
Signed-off-by: Patrick Roy <[email protected]>1 parent 82eec3e commit df82a41
File tree
3 files changed
+13
-21
lines changed- tests
- framework
- host_tools
- integration_tests/functional
3 files changed
+13
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
1003 | 1002 | | |
1004 | 1003 | | |
1005 | 1004 | | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
| 1005 | + | |
| 1006 | + | |
1011 | 1007 | | |
1012 | | - | |
1013 | | - | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1014 | 1012 | | |
1015 | | - | |
| 1013 | + | |
1016 | 1014 | | |
1017 | 1015 | | |
1018 | 1016 | | |
1019 | 1017 | | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | 1018 | | |
1027 | 1019 | | |
1028 | 1020 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
0 commit comments