Make sure Servo is initialized before checking the USB stick state.
One of the verification steps for Servo is to confirm that the
USB stick isn't wedged as for crbug.com/225932. The check
pre-supposed standard initialization, which unplugs the USB stick,
but the initialization didn't happen until after the check. This
made it possible for units to fail incorrectly in some cases.
This change re-orders the code to insure initialization prior to
the USB check.
BUG=chromium:409292
TEST=trigger repair in local instance with a plugged-in, corrupted USB stick
Change-Id: I8c8099742cfc32fcd1f7f3f3669d801924011dac
Reviewed-on: https://chromium-review.googlesource.com/215698
Reviewed-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
diff --git a/server/hosts/servo_host.py b/server/hosts/servo_host.py
index 2aa8b5b..5a6d7cf 100644
--- a/server/hosts/servo_host.py
+++ b/server/hosts/servo_host.py
@@ -318,19 +318,21 @@
def _check_servo_host_usb(self):
"""A sanity check of the USB device.
- Sometimes the usb gets wedged due to a kernel bug on the beaglebone.
- A symptom is the presence of /dev/sda without /dev/sda1. The check
- here ensures that if /dev/sda exists, /dev/sda1 must also exist.
- See crbug.com/225932.
+ Test that the USB stick has been properly unplugged. An old
+ kernel bug sometimes allowed the USB stick block device node
+ to be wedged such that it couldn't be unplugged.
- @raises ServoHostVerifyFailure if /dev/sda exists without /dev/sda1 on
- the beaglebone.
+ Servo initialization unplugs the stick, so as a prophylactic
+ against a regression, we check that the USB stick is
+ actually unplugged. (For reference, see crbug.com/225932.)
+
+ @raises ServoHostVerifyFailure if /dev/sda exists
"""
try:
# The following test exits with a non-zero code
# and raises AutoserverRunError if error is detected.
- self.run('test ! -b /dev/sda -o -b /dev/sda1')
+ self.run('test ! -b /dev/sda')
except (error.AutoservRunError, error.AutoservSSHTimeout) as e:
raise ServoHostVerifyFailure(
'USB sanity check on %s failed: %s' % (self.hostname, e))
@@ -499,17 +501,9 @@
"""
logging.info('Applying an update to the servo host, if necessary.')
self._update_image()
-
- logging.info('Verifying if servo config file exists.')
self._check_servo_config()
-
- logging.info('Verifying if servod is running.')
self._check_servod_status()
- logging.info('Verifying servo host %s with sanity checks.',
- self.hostname)
- self._check_servo_host_usb()
-
# If servo is already initialized, we don't need to do it again, call
# _check_servod should be enough.
if self._servo:
@@ -522,6 +516,7 @@
if timeout:
raise ServoHostVerifyFailure('Servo initialize timed out.')
+ self._check_servo_host_usb()
logging.info('Sanity checks pass on servo host %s', self.hostname)