check_ethernet.hook: Refactor and enhance recovery

This CL splits up the recovery steps in check_ethernet.hook so
that less disruptive remidation steps are run before more
disruptive ones.  For example, restarting the connection manager
is likely to disrupt any running network connectivity test that
uses the connection manager.  To mitigate the possibility that
the connection manager is really at fault, we first check to see
if the connection manager is stopped.

Additionally, this change adds a new recovery step that uses
the "reload_network_device" script to virtually unplug and replug
USB Ethernet devices, in most cases performing a power cycle on
the peripheral.  This should hopefully work around failures with
some problematic USB-Etherent devices.

BUG=chromium:445705
TEST=Manual: run with Ethernet disconnected, the driver unloaded,
the connnection manager stopped

Change-Id: I3f213f60f441207a539118ce75e3872040d136bc
Reviewed-on: https://chromium-review.googlesource.com/242583
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
(cherry picked from commit 45b0bf6b2b2942c52775efd224d837e2915a991c)
Reviewed-on: https://chromium-review.googlesource.com/243326
Reviewed-by: Paul Stewart <pstew@chromium.org>
1 file changed