[servod]: Enable verifiers with servod container.
Change-Id: I279a043660ac5b5373ac7962d8a25ac7b767bc5a
.
Change-Id: Ia67e2f48cec9b3b883e2bd0042041519bbebf41c
Bug: b:199796364
Test: Manually run deploy and repair tasks
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/labpack/+/3200557
Commit-Queue: Prasad Vuppalapu <prasadv@chromium.org>
Tested-by: Prasad Vuppalapu <prasadv@chromium.org>
Reviewed-by: Otabek Kasimov <otabek@google.com>
diff --git a/server/hosts/servo_host.py b/server/hosts/servo_host.py
index 7af0b8b..6365592 100644
--- a/server/hosts/servo_host.py
+++ b/server/hosts/servo_host.py
@@ -1623,15 +1623,12 @@
def is_servo_topology_supported(self):
"""Check if servo_topology is supported."""
- if self.is_containerized_servod():
- # TODO(otabek@): revisit after stabilize container.
- logging.info('Servod-container is not supported for now.')
- return False
if not self.is_up_fast():
logging.info('Servo-Host is not reachable.')
return False
- if not self.is_labstation():
- logging.info('Servo-topology supported only for labstation.')
+ if not (self.is_labstation() or self.is_containerized_servod()):
+ logging.info('Servo-topology supported only for labstation '
+ 'or servod containers')
return False
if not self.servo_serial:
logging.info('Servo-topology required a servo serial.')
@@ -1870,8 +1867,8 @@
if newhost.is_containerized_servod():
# TODO(otabek@): Update for servod-manager.
# Servod docker is not available for access.
- pass
- elif newhost.use_icmp and not newhost.is_up_fast(count=3):
+ newhost.start_containerized_servod()
+ if newhost.use_icmp and not newhost.is_up_fast(count=3):
# ServoHost has internal check to wait if servo-host is in reboot
# process. If servo-host still is not available this check will stop
# further attempts as we do not have any option to recover servo_host.
@@ -1879,11 +1876,7 @@
# Reset or reboot servo device only during AdminRepair tasks.
if try_servo_repair:
- if newhost.is_containerized_servod():
- # TODO(otabek@): Update for servod-manager.
- # Servod docker is not available for access.
- pass
- elif newhost._is_locked:
+ if newhost._is_locked:
# Print available servos on the host for debuging.
newhost.print_all_servo_of_host()
# Reset servo if the servo is locked, as we check if the servohost
@@ -1903,8 +1896,7 @@
newhost.set_dut_host_info(dut_host_info)
if dut_run:
newhost.dut_run = dut_run
- if (not newhost.is_containerized_servod() and dut_health_profile
- and (try_lab_servo or try_servo_repair)):
+ if (dut_health_profile and (try_lab_servo or try_servo_repair)):
try:
if newhost.is_localhost():
logging.info('Servohost is a localhost, skip device'
diff --git a/server/hosts/servo_repair.py b/server/hosts/servo_repair.py
index f2cfb6e..f5607ba 100644
--- a/server/hosts/servo_repair.py
+++ b/server/hosts/servo_repair.py
@@ -91,12 +91,8 @@
sys.exc_info()[2])
def _is_applicable(self, host):
- if host.is_containerized_servod():
- # TODO(otabek@): revisit after stabilize container.
- logging.info('Servod is running within a container.')
- return False
# Run only for servo_v3 host.
- if host.is_labstation():
+ if host.is_labstation() or host.is_containerized_servod():
return False
# Only run if the host is in the physical lab.
return host.is_in_lab()
@@ -126,12 +122,6 @@
def description(self):
return 'Initial servod start'
- def _is_applicable(self, host):
- if host.is_containerized_servod():
- # Servod started on container by default.
- return False
- return True
-
class _RootServoPresentVerifier(hosts.Verifier):
"""Verifier that first servo is present."""
@@ -144,11 +134,17 @@
try:
device = topology.get_root_servo()
except Exception as e:
- host.request_reboot()
- logging.info('Reboot labstation requested, it will be handled'
- ' by labstation AdminRepair task.'
- ' Unable to detect root servo info from topology.')
- logging.debug('(Not critical) %s', e)
+ if host.is_containerized_servod():
+ host.restart_servod()
+ logging.debug('Restarting servod container (Not critical) %s',
+ e)
+ else:
+ host.request_reboot()
+ logging.info(
+ 'Reboot labstation requested, it will be handled'
+ ' by labstation AdminRepair task.'
+ ' Unable to detect root servo info from topology.')
+ logging.debug('(Not critical) %s', e)
if device:
logging.info('Root servo is present')
return
@@ -164,12 +160,8 @@
raise hosts.AutoservVerifyError('Root servo not found!')
def _is_applicable(self, host):
- if host.is_containerized_servod():
- # TODO(otabek@): revisit after stabilize container.
- logging.info('Servod is running within a container.')
- return False
# Run only for servos under labstations.
- if not host.is_labstation():
+ if not (host.is_labstation() or host.is_containerized_servod()):
return False
# Only run if the host is in the physical lab.
return host.is_in_lab()
@@ -229,12 +221,8 @@
)
def _is_applicable(self, host):
- if host.is_containerized_servod():
- # TODO(otabek@): revisit after stabilize container.
- logging.info('Servod is running within a container.')
- return False
# Run only for servos under labstations.
- if not host.is_labstation():
+ if not (host.is_labstation() or host.is_containerized_servod()):
return False
# Only run if the host is in the physical lab.
return host.is_in_lab()
@@ -440,12 +428,6 @@
def description(self):
return 'Servod is running and responsive to dut-control run.'
- def _is_applicable(self, host):
- if host.is_containerized_servod():
- logging.info('Servod is running within a container.')
- return False
- return True
-
class _DiskSpaceVerifier(hosts.Verifier):
"""
@@ -1105,12 +1087,6 @@
def description(self):
return 'Start servod with the proper config settings.'
- def _is_applicable(self, host):
- if host.is_containerized_servod():
- logging.info('Servod is running within a container.')
- return False
- return True
-
class _ServoRebootRepair(repair_utils.RebootRepair):
"""Try repair servo by reboot servohost.
@@ -1331,14 +1307,10 @@
logging.debug("Kill servod processes: %s", r)
def _is_applicable(self, host):
- if host.is_containerized_servod():
- # TODO(otabek@): revisit after stabilize container.
- logging.info('Servod is running within a container.')
- return False
if not host.servo_serial:
logging.info('servo_serial is not presented.')
return False
- return host.is_labstation()
+ return host.is_labstation() or host.is_containerized_servod()
@property
def description(self):