Home > openstack > Code flow in python novaclient (part1)

Code flow in python novaclient (part1)

In an earlier post, I discussed what python novaclient is and what ‘nova’ command does. In this post, I would like to note what happens (which methods are being invoked in which files) when we issue a nova command (for example ‘nova list’).

In order to understand the flow, we should know certain information:

1. directory structure (and files) of python nova client. In a default devstack installation, it is ‘/opt/stack/python-novaclient’.

2. novaclient (exiting_path/python-novaclient/novaclient/) contains the files that are called by the ‘nova’ command. So, when I mention “novaclient/”, I mean “exiting_path/python-novaclient/novaclient/”


lets start with the command ‘nova list’ which shows a list of VM on the server side. Woth to mention, In this command “nova list”, ‘nova’ is the actual command and ‘list’ is the subcommand. In the command “nova show <ID>” show is the subcommand and <ID> is an argument which is the Id of the VM we are interested.

First issue “$ which nova” which gives the actual script which is called with nova command. In my case that is  /usr/local/bin/nova which infact calls subsequent methods until it sends the REST Request to the nova server and finish printing the result. For clarity, I would show these calls as a table. Only calls that I found important  are mentioned here.

File —————————————————————-ClassName ——————————————–Method() ——— Comment

1. /usr/local/bin/nova —————-None ————————-None —  The Actual script invoked with ‘nova’ command

2. novaclient/Shell.py  —————-              OpenStackComputeShell        —- main() —–  Entry point for all nova command

3. novaclient/v1_1/shell.py           ———-None ———————-do_list()  — do_list corresponds to subcommand list in ‘nova list’

4. novaclient/v1_1/servers.py                —-None ————-list() — this list() method contains correponding callable in server side.

5. novaclient/client.py &         ——— many classes ————— many methods…… These classes and methods are responsible for

novaclient/v1_1/client.py                                                                                                   creating HTTP Request & Reply message.


These method are specific to the subcommand list with ‘nova list’ command. The flow changes if we issue another nova command like “nova show <ID>”

In an another post, I would specify how to find the call flow steps.


Categories: openstack
  1. Andy Powell
    October 10, 2013 at 11:37 pm

    Thanks Prosun for your blog. This was really great. Would you please post how to ” find the call flow steps” like you said in your blog. It will really help to understand the code base and the information is nowhere in the net.

  2. prosun
    October 11, 2013 at 3:40 am

    Thanks Andy Powell. Good to know someone really looks for this stuffs. I gonna write other parts soon.

  3. Bharath
    March 18, 2014 at 6:40 am

    Request you to please explain the code flow for nova show command.

  1. October 11, 2013 at 5:05 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: