OLD | NEW |
1 import os, time, pickle, logging, shutil | 1 import os, time, pickle, logging, shutil |
2 | 2 |
3 from autotest_lib.server import utils | 3 from autotest_lib.server import utils |
4 | 4 |
5 | 5 |
6 # import any site hooks for the crashdump and crashinfo collection | 6 # import any site hooks for the crashdump and crashinfo collection |
7 get_site_crashdumps = utils.import_site_function( | 7 get_site_crashdumps = utils.import_site_function( |
8 __file__, "autotest_lib.server.site_crashcollect", "get_site_crashdumps", | 8 __file__, "autotest_lib.server.site_crashcollect", "get_site_crashdumps", |
9 lambda host, test_start_time: None) | 9 lambda host, test_start_time: None) |
10 get_site_crashinfo = utils.import_site_function( | 10 get_site_crashinfo = utils.import_site_function( |
(...skipping 28 matching lines...) Expand all Loading... |
39 @param host: A RemoteHost instance to wait on | 39 @param host: A RemoteHost instance to wait on |
40 @param hours_to_wait: Number of hours to wait before giving up | 40 @param hours_to_wait: Number of hours to wait before giving up |
41 | 41 |
42 @returns: True if the machine comes back up, False otherwise | 42 @returns: True if the machine comes back up, False otherwise |
43 """ | 43 """ |
44 current_time = time.strftime("%b %d %H:%M:%S", time.localtime()) | 44 current_time = time.strftime("%b %d %H:%M:%S", time.localtime()) |
45 if host.is_up(): | 45 if host.is_up(): |
46 logging.info("%s already up, collecting crash info", host.hostname) | 46 logging.info("%s already up, collecting crash info", host.hostname) |
47 return True | 47 return True |
48 | 48 |
49 logging.info("Waiting four hours for %s to come up (%s)", | 49 logging.info("Waiting %s hours for %s to come up (%s)", |
50 host.hostname, current_time) | 50 hours_to_wait, host.hostname, current_time) |
51 if not host.wait_up(timeout=hours_to_wait * 3600): | 51 if not host.wait_up(timeout=hours_to_wait * 3600): |
52 logging.warning("%s down, unable to collect crash info", | 52 logging.warning("%s down, unable to collect crash info", |
53 host.hostname) | 53 host.hostname) |
54 return False | 54 return False |
55 else: | 55 else: |
56 logging.info("%s is back up, collecting crash info", host.hostname) | 56 logging.info("%s is back up, collecting crash info", host.hostname) |
57 return True | 57 return True |
58 | 58 |
59 | 59 |
60 def get_crashinfo_dir(host): | 60 def get_crashinfo_dir(host): |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 shutil.copyfileobj(raw_messages_file, messages_file) | 178 shutil.copyfileobj(raw_messages_file, messages_file) |
179 raw_messages_file.close() | 179 raw_messages_file.close() |
180 messages_file.close() | 180 messages_file.close() |
181 | 181 |
182 # get rid of the "raw" versions of messages | 182 # get rid of the "raw" versions of messages |
183 os.remove(messages_raw) | 183 os.remove(messages_raw) |
184 if os.path.exists(messages_at_start): | 184 if os.path.exists(messages_at_start): |
185 os.remove(messages_at_start) | 185 os.remove(messages_at_start) |
186 except Exception, e: | 186 except Exception, e: |
187 logging.warning("Error while collecting /var/log/messages: %s", e) | 187 logging.warning("Error while collecting /var/log/messages: %s", e) |
OLD | NEW |