Browse code

Fix worlddump log collection

All credit for figuring this out goes to frickler (and that was the hard
bit so thank you!). The worlddump files were not being collected because
they weren't in our log collection list. Add worlddump to this list
so that we collect these files.

One thing that makes this slightly complicated is the worlddump files
are named with a timestamp and we can't have globs in our collection
list. To address this we create a copy of the file with a -latest.txt
suffix. This gives us a deterministic file name for log collection
without using globs.

Note we do not use a symlink here because some jobs gzip their log files
(breaking symlinks) and others do not. This makes it painful to always
have a valid link. Not having a valid link can break log collection.

Hardlinks may be another option but simply making a copy is easier to
manage as you don't have to worry about links preexisting and the
dumpfiles are not that large.

Change-Id: I96ae5f5290546ad25ca434c1106c01354d2d053c

Jens Harbott authored on 2019/09/05 17:51:33
Showing 2 changed files
... ...
@@ -233,6 +233,7 @@
233 233
         '{{ devstack_log_dir }}/devstacklog.txt': logs
234 234
         '{{ devstack_log_dir }}/devstacklog.txt.summary': logs
235 235
         '{{ devstack_log_dir }}/tcpdump.pcap': logs
236
+        '{{ devstack_log_dir }}/worlddump-latest.txt': logs
236 237
         '{{ devstack_full_log}}': logs
237 238
         '{{ stage_dir }}/verify_tempest_conf.log': logs
238 239
         '{{ stage_dir }}/apache': logs
... ...
@@ -25,6 +25,7 @@ from distutils import spawn
25 25
 import fnmatch
26 26
 import os
27 27
 import os.path
28
+import shutil
28 29
 import subprocess
29 30
 import sys
30 31
 
... ...
@@ -248,6 +249,14 @@ def main():
248 248
         compute_consoles()
249 249
         guru_meditation_reports()
250 250
         var_core()
251
+    # Singular name for ease of log retrieval
252
+    copyname = os.path.join(opts.dir, 'worlddump')
253
+    if opts.name:
254
+        copyname += '-' + opts.name
255
+    copyname += '-latest.txt'
256
+    # We make a full copy to deal with jobs that may or may not
257
+    # gzip logs breaking symlinks.
258
+    shutil.copyfile(fname, copyname)
251 259
 
252 260
 
253 261
 if __name__ == '__main__':