Thanks Melanie for the reply. I am able to use pdb successfully for the trace. But I am observing a strange behaviour with the python source files. Whenever I make any changes to the source files , for example, insert a pdb statement in servers.py, it is taking a minute or more for the changes to take effect. For example, after the change, if I run the uwsgi command at the terminal manually with --honour-stdin option, then immediately if I fire the nova list command, it is not taking effect. Only after a minute or so of making the change, it is taking effect. Somewhat strange. My next question is, inside the nova-api container, I am trying to trace how nova-api service starts. The systemd file has this content: --- ExecStart = /openstack/venvs/uwsgi-20.2.1-python3/bin/uwsgi --autoload --ini /etc/uwsgi/nova-api-os-compute.ini ---- So I have checked the file /etc/uwsgi/nova-api-os-compute.ini , which has the below content: --- wsgi-file = /openstack/venvs/nova-20.2.1/bin/nova-api-wsgi -- Is the above file '/openstack/venvs/nova-20.2.1/bin/nova-api-wsgi' the one from which the nova-api service starts at all ? Thanks Kumar On Wed, Nov 9, 2022 at 5:39 AM melanie witt <melwittt@gmail.com> wrote:
On Tue Nov 08 2022 03:03:18 GMT-0800 (Pacific Standard Time), Gk Gk <ygk.kmr@gmail.com> wrote:
Hi All,
I have a OSA setup. I am trying to trace the control flow of nova-api using pdb in the file
"/openstack/venvs/nova-20.2.1/lib/python3.6/site-packages/nova/objects/instance.py".
My goal is to trace the flow for "nova list --all" command. I am launching the nova-api service manually from the command line as
follows:
#/openstack/venvs/uwsgi-20.2.1-python3/bin/uwsgi --ini /etc/uwsgi/nova-api-os-compute.ini --workers 1
I am executing "nova list --all" command in another terminal. I have inserted pdb in instance.py as follows:
---- @base.remotable_classmethod def get_all(cls, context, expected_attrs=None): import pdb; pdb.set_trace() """Returns all instances on all nodes.""" db_instances = db.instance_get_all( context, columns_to_join=_expected_cols(expected_attrs)) return _make_instance_list(context, cls(), db_instances, expected_attrs) ---
But when I fire the nova list --all command, I see no pdb prompt being shown in the nova-api window. Can anyone help me how to use the pdb to trace the flow of control for "nova list --all" command ?
It looks like running nova-api that way is still running as a background process:
https://stackoverflow.com/questions/34914704/bdbquit-raised-when-debugging-p...
I got that result ^ when I tried it locally.
I was however able to get success with remote pdb:
https://docs.openstack.org/devstack/latest/systemd.html#using-remote-pdb
so maybe give that a try. Note that the code where you set the trace in nova/objects/instance.py is not actually hit when doing a server list. You may have instead meant:
https://github.com/openstack/nova/blob/c97507dfcd57cce9d76670d3b0d48538900c0...
Also note that as a community we're trying to get away from using the legacy 'nova' command and recommend using the openstackclient instead:
https://docs.openstack.org/python-openstackclient/latest/cli/command-objects...
The 'nova' CLI is no longer being maintained and we're adding to the novaclient python bindings only when necessary.
HTH, -melwitt