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
This commit is contained in:
Ihar Hrachyshka 2016-02-11 13:54:48 +01:00
parent 406b45b81a
commit ef219bfcaf

View File

@ -27,6 +27,16 @@ import subprocess
import sys
GMR_PROCESSES = (
'nova-compute',
'neutron-dhcp-agent',
'neutron-l3-agent',
'neutron-linuxbridge-agent',
'neutron-metadata-agent',
'neutron-openvswitch-agent',
)
def get_options():
parser = argparse.ArgumentParser(
description='Dump world state for debugging')
@ -191,17 +201,18 @@ def compute_consoles():
_dump_cmd("sudo cat %s" % fullpath)
def guru_meditation_report():
_header("nova-compute Guru Meditation Report")
def guru_meditation_reports():
for service in GMR_PROCESSES:
_header("%s Guru Meditation Report" % service)
try:
subprocess.check_call(["pgrep","nova-compute"])
except subprocess.CalledProcessError:
print("Skipping as nova-compute does not appear to be running")
return
try:
subprocess.check_call(['pgrep', '-f', service])
except subprocess.CalledProcessError:
print("Skipping as %s does not appear to be running" % service)
continue
_dump_cmd("kill -s USR2 `pgrep nova-compute`")
print("guru meditation report in nova-compute log")
_dump_cmd("killall -e -USR2 %s" % service)
print("guru meditation report in %s log" % service)
def main():
@ -218,7 +229,7 @@ def main():
iptables_dump()
ebtables_dump()
compute_consoles()
guru_meditation_report()
guru_meditation_reports()
if __name__ == '__main__':