def _collect_logs(self, host): """Collect logs from a successfully repaired DUT.""" dirname = 'after_%s' % self.tag local_log_dir = crashcollect.get_crashinfo_dir(host, dirname) host.collect_logs('/var/log', local_log_dir, ignore_errors=True) # Collect crash info. crashcollect.get_crashinfo(host, None)
def repair(self, host): if not host.servo: raise hosts.AutoservRepairError('%s has no servo support.' % host.hostname) host.servo.get_power_state_controller().reset() if host.wait_up(host.BOOT_TIMEOUT): # Collect logs once we regain ssh access before clobbering them. local_log_dir = crashcollect.get_crashinfo_dir(host, 'after_reset') host.collect_logs('/var/log', local_log_dir, ignore_errors=True) # Collect crash info. crashcollect.get_crashinfo(host, None) return raise hosts.AutoservRepairError( '%s is still offline after servo reset.' % host.hostname)
class ServoSysRqRepair(hosts.RepairAction): """ Repair a Chrome device by sending a system request to the kernel. Sending 3 times the Alt+VolUp+x key combination (aka sysrq-x) will ask the kernel to panic itself and reboot while conserving the kernel logs in console ramoops. """ def repair(self, host): if not host.servo: raise hosts.AutoservRepairError('%s has no servo support.' % host.hostname) # Press 3 times Alt+VolUp+X # no checking DUT health between each press as # killing Chrome is not really likely to fix the DUT SSH. for _ in range(3): try: host.servo.sysrq_x() except error.TestFail, ex: raise hosts.AutoservRepairError('cannot press sysrq-x: %s.' % str(ex)) # less than 5 seconds between presses. time.sleep(2.0) if host.wait_up(host.BOOT_TIMEOUT): # Collect logs once we regain ssh access before clobbering them. local_log_dir = crashcollect.get_crashinfo_dir(host, 'after_sysrq') host.collect_logs('/var/log', local_log_dir, ignore_errors=True) # Collect crash info. crashcollect.get_crashinfo(host, None) return raise hosts.AutoservRepairError('%s is still offline after sysrq-x.' % host.hostname)
def log_collector_dut_worker(dut, job): """Worker function to collect logs from each DUT in the pool. The method called by multiprocessing worker pool for collecting DUT logs. This function is the function which is repeatedly scheduled for each DUT through the multiprocessing worker. This has to be defined outside the class because it needs to be pickleable. @param dut: DUTObject representing the DUT. @param job: Autotest job object. """ host = dut.host # Set the job on the host object for log collection. host.job = job logging.info("Collecting logs from: %s", host.hostname) crashcollect.get_crashinfo(host, 0)