From 12fcd619302556d98a8b8191a97c914bd014bb3f Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Thu, 7 Sep 2017 13:36:00 -0500 Subject: [PATCH] doc: How to pdb under systemd Add a section to the systemd doc describing how to use regular pdb in a systemd environment. Change-Id: Ib1f616f407eccc087de1c60624fa74e2555971c2 --- doc/source/systemd.rst | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/source/systemd.rst b/doc/source/systemd.rst index 60a7719262..f9971abf5a 100644 --- a/doc/source/systemd.rst +++ b/doc/source/systemd.rst @@ -98,8 +98,7 @@ Follow logs for a specific service:: Following logs for multiple services simultaneously:: - journalctl -f --unit devstack@n-cpu.service --unit - devstack@n-cond.service + journalctl -f --unit devstack@n-cpu.service --unit devstack@n-cond.service or you can even do wild cards to follow all the nova services:: @@ -121,6 +120,29 @@ left/right arrow keys. See ``man 1 journalctl`` for more. +Debugging with pdb +================== + +In order to break into a regular pdb session on a systemd-controlled +service, you need to invoke the process manually - that is, take it out +of systemd's control. + +Discover the command systemd is using to run the service:: + + systemctl show devstack@n-sch.service -p ExecStart --no-pager + +Stop the systemd service:: + + sudo systemctl stop devstack@n-sch.service + +Inject your breakpoint in the source, e.g.:: + + import pdb; pdb.set_trace() + +Invoke the command manually:: + + /usr/local/bin/nova-scheduler --config-file /etc/nova/nova.conf + Known Issues ============