Lines Matching full:host
32 """Context manager for temporary directory on remote host."""
34 def __init__(self, host): argument
35 self.host = host
39 return '<{cls} host={this.host!r}, tmpdir={this.tmpdir!r}>'.format(
43 self.tmpdir = (self.host
49 self.host.run('rm -rf %s' % (pipes.quote(self.tmpdir),))
52 def _collect_log_file_with_summary(host, source_path, dest_path): argument
55 @param host: The RemoteHost to collect logs from.
60 summary_created = result_tools_runner.run_on_client(host, source_path)
64 host.get_file(source_path, dest_path, preserve_perm=False)
76 host, source_path, dest_path,
80 def collect_log_file(host, log_path, dest_path, use_tmp=False, clean=False, argument
94 @param host: The RemoteHost to collect logs from
98 on the host and download logs from there.
106 if not host.check_cached_up_status():
107 logging.warning('Host %s did not answer to ping, skip collecting log '
108 'file %s.', host.hostname, log_path)
111 file_stats = _get_file_stats(host, log_path)
123 _collect_log_file_with_tmpdir(host, log_path, dest_path)
125 _collect_log_file_with_summary(host, log_path, dest_path)
135 host.run('rm -rf %s' % path_to_delete, ignore_status=True)
142 def _collect_log_file_with_tmpdir(host, log_path, dest_path): argument
143 """Collect log file from host through a temp directory on the host.
145 @param host: The RemoteHost to collect logs from.
150 with _RemoteTempDir(host) as tmpdir:
151 host.run('cp -rp %s %s' % (pipes.quote(log_path), pipes.quote(tmpdir)))
154 _collect_log_file_with_summary(host, source_path, dest_path)
157 def _get_file_stats(host, path): argument
158 """Get the stats of a file from host.
160 @param host: Instance of Host subclass with run().
168 output = host.run(cmd).stdout
170 logging.warning('Getting size of file %r on host %r failed: %s. '
171 'Default its size to 0', path, host, e)
176 logging.warning('Failed to convert size string "%s" for %s on host %r. '
177 'File may not exist.', output, path, host)
190 lambda host, test_start_time: None)
193 lambda host, test_start_time: None)
196 lambda host: None)
199 lambda host, host_resultdir: None)
202 lambda host: None)
207 def get_crashdumps(host, test_start_time): argument
208 get_site_crashdumps(host, test_start_time)
213 def get_crashinfo(host, test_start_time): argument
221 get_crashdumps(host, test_start_time)
223 if wait_for_machine_to_recover(host):
225 get_site_crashinfo(host, test_start_time)
227 crashinfo_dir = get_crashinfo_dir(host, 'crashinfo')
228 collect_messages(host)
229 collect_command(host, "dmesg", os.path.join(crashinfo_dir, "dmesg"))
230 collect_uncollected_logs(host)
235 collect_log_file(host, constants.LOG_DIR, log_path)
241 collect_log_file(host, pstore_dir, log_path, use_tmp=True,
248 collect_log_file(host, constants.LOG_I915_ERROR_STATE,
257 def wait_for_machine_to_recover(host, hours_to_wait=HOURS_TO_WAIT): argument
260 @param host: A RemoteHost instance to wait on
266 if host.is_up():
267 logging.info("%s already up, collecting crash info", host.hostname)
271 hours_to_wait, host.hostname, current_time)
272 if not host.wait_up(timeout=hours_to_wait * 3600):
276 host.hostname)
279 logging.info("%s is back up, collecting crash info", host.hostname)
283 def get_crashinfo_dir(host, dir_prefix): argument
286 @param host: The RemoteHost object that crashinfo will be collected from
291 host_resultdir = getattr(getattr(host, "job", None), "resultdir", None)
296 infodir = os.path.join(infodir, "%s.%s" % (dir_prefix, host.hostname))
302 def collect_command(host, command, dest_path): argument
309 @param host: The RemoteHost to collect from
316 result = host.run(command, stdout_tee=None).stdout
322 def collect_uncollected_logs(host): argument
325 @param host: The RemoteHost to collect from
327 if host.job:
329 logs = host.job.get_client_logs()
331 if hostname == host.hostname:
334 collect_log_file(host, remote_path + '/', local_path + '/')
340 def collect_messages(host): argument
343 If host.VAR_LOG_MESSAGE_COPY_PATH is on the remote machine, collects
345 are already present in host.VAR_LOG_MESSAGE_COPY_PATH. If it is not
348 @param host: The RemoteHost to collect from
350 crashinfo_dir = get_crashinfo_dir(host, 'crashinfo')
358 # grab the files from the remote host
359 collect_log_file(host, host.VAR_LOG_MESSAGES_COPY_PATH,
361 collect_log_file(host, "/var/log/messages", messages_raw)