Need assistance

melanie witt melwittt at gmail.com
Wed Nov 9 00:09:06 UTC 2022


On Tue Nov 08 2022 03:03:18 GMT-0800 (Pacific Standard Time), Gk Gk 
<ygk.kmr at 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-python-with-pdb

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/c97507dfcd57cce9d76670d3b0d48538900c00e9/nova/compute/api.py#L2991

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/server.html#server-list

The 'nova' CLI is no longer being maintained and we're adding to the 
novaclient python bindings only when necessary.

HTH,
-melwitt






More information about the openstack-discuss mailing list