Browse code

worlddump: request Guru Mediation reports for neutron agents

Those reports may be helpful when debugging neutron gate issues.

pgrep is backwards compatible with old Solaris tools, which means it
does not match with commands that are longer than 15 characters. To
avoid that for neutron agent names which are longer than that, we need
to pass -f argument to match against the full cmdline.

Also killall instead of kill + pgrep in a subshell.

Change-Id: I9b3801e927c0e80443ed76e38cd8e3618e888e49

Ihar Hrachyshka authored on 2016/02/11 21:54:48
Showing 1 changed files
... ...
@@ -27,6 +27,16 @@ import subprocess
27 27
 import sys
28 28
 
29 29
 
30
+GMR_PROCESSES = (
31
+    'nova-compute',
32
+    'neutron-dhcp-agent',
33
+    'neutron-l3-agent',
34
+    'neutron-linuxbridge-agent',
35
+    'neutron-metadata-agent',
36
+    'neutron-openvswitch-agent',
37
+)
38
+
39
+
30 40
 def get_options():
31 41
     parser = argparse.ArgumentParser(
32 42
         description='Dump world state for debugging')
... ...
@@ -191,17 +201,18 @@ def compute_consoles():
191 191
             _dump_cmd("sudo cat %s" % fullpath)
192 192
 
193 193
 
194
-def guru_meditation_report():
195
-    _header("nova-compute Guru Meditation Report")
194
+def guru_meditation_reports():
195
+    for service in GMR_PROCESSES:
196
+        _header("%s Guru Meditation Report" % service)
196 197
 
197
-    try:
198
-        subprocess.check_call(["pgrep","nova-compute"])
199
-    except subprocess.CalledProcessError:
200
-        print("Skipping as nova-compute does not appear to be running")
201
-        return
198
+        try:
199
+            subprocess.check_call(['pgrep', '-f', service])
200
+        except subprocess.CalledProcessError:
201
+            print("Skipping as %s does not appear to be running" % service)
202
+            continue
202 203
 
203
-    _dump_cmd("kill -s USR2 `pgrep nova-compute`")
204
-    print("guru meditation report in nova-compute log")
204
+        _dump_cmd("killall -e -USR2 %s" % service)
205
+        print("guru meditation report in %s log" % service)
205 206
 
206 207
 
207 208
 def main():
... ...
@@ -218,7 +229,7 @@ def main():
218 218
         iptables_dump()
219 219
         ebtables_dump()
220 220
         compute_consoles()
221
-        guru_meditation_report()
221
+        guru_meditation_reports()
222 222
 
223 223
 
224 224
 if __name__ == '__main__':