crostestutils: Make recover_duts reboot via powerd.

Update the recover_duts check_ethernet hook to first make a
RequestRestart D-Bus call to powerd before calling "reboot"
directly. The former makes it easier to see why we're
rebooting (since powerd logs the reason to its log).

BUG=chromium:805051
TEST=ran the subshell command with and without powerd and
     checked that the system reboots in both cases

Change-Id: I9a83cda6ced34690f1ecffa3e1d91678b33cd905
Reviewed-on: https://chromium-review.googlesource.com/894853
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
diff --git a/recover_duts/hooks/check_ethernet.hook b/recover_duts/hooks/check_ethernet.hook
index b0a869e..885e3cb 100755
--- a/recover_duts/hooks/check_ethernet.hook
+++ b/recover_duts/hooks/check_ethernet.hook
@@ -268,7 +268,16 @@
 
   critical_msg "All ethernet recovery methods have failed. Rebooting."
   sync
-  (sleep 5 && reboot) &
+
+  # Give powerd a chance to reboot via the standard path (and log messages that
+  # are helpful for debugging) before calling 'reboot' directly.
+  (sleep 5;
+   dbus-send --system --type=method_call --dest=org.chromium.PowerManager \
+      /org/chromium/PowerManager org.chromium.PowerManager.RequestRestart \
+      int32:2 string:'recover_duts check_ethernet hook failed';
+   sleep 30;
+   reboot) &
+
   return 1
 }