From ef219bfcafb69970b83db8b503d5947ced9eca16 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 11 Feb 2016 13:54:48 +0100 Subject: [PATCH] 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 --- tools/worlddump.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tools/worlddump.py b/tools/worlddump.py index 8c053e038f..238a23dab8 100755 --- a/tools/worlddump.py +++ b/tools/worlddump.py @@ -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__':