Question

In Openstack, lets say for example, i'm entering the command and i start up an instance using the image myimage and use flavor 1.

nova boot --image myimage --flavor 1 server1 

How can i actually trace this command and get details like what functions are executed since the code is in python, which files it enters while executing the command etc.,

Sorry i'm a linux noob and i'm trying to find ways to trace few calls. Instead of doing this by going through all the files and doing this.

Is there a simple way to do this?

Was it helpful?

Solution

If you want to trace a regular Python program, take a look at the Python trace module.

However, I don't think you will find tracing useful to understand what OpenStack is doing in the example you provided:

nova boot --image myimage --flavor 1 server1 

OpenStack is not implemented as a single Python program. It is implemented as a collection of Python programs that run as Linux services in separate processes, and typically these processes are distributed across multiple machines.

The nova program is just a small client program that makes requests against an OpenStack endpoint over HTTP. When you do the request above, the following services are involved. Note that most of the OpenStack "Services" are actually implemented by multiple Linux "services" (aka daemons). These are the OpenStack Services and Linux services/daemons involved when you do a nova boot.

  • Identity Service (keystone)
    • keystone
  • Compute Service (nova)
    • nova-api
    • nova-scheduler
    • nova-compute
    • nova-network (if not using the new Network Service (quantum))
  • Image Service (glance)
    • glance-api
    • glance-registry

Note that if the new Network service (quantum) were involved, there would be even more services involved here.

OpenStack does inter-process communication using two mechanisms:

  • HTTP (using REST API) for communication across OpenStack project boundaries (e.g., communication between the Compute service and the Image service)
  • AMQP-based message queue (typically RabbitMQ, but could be Qpid or ZeroMQ) for communication across services within a single OpenStack project (e.g, communication between nova-api and nova-compute)

The services also share information via a database, but that isn't important if you're interested in tracing the thread of control.

For the example you gave with nova boot, note all of the interactions that occur across services:

  1. nova client makes a request over HTTP against the Identity service (keystone), passing username and password and getting a token
  2. nova client makes a request over HTTP against the Compute service (nova-api) to create a new server.
  3. nova-api makes a request over the message queue to nova-scheduler to run an instance.
  4. nova-scheduler selects a compute host and makes a request over the message queue to nova-compute on that host to boot a new virtual machine instance.
  5. nova-compute makes a request over the message queue to nova-network to do network configuration for the new instance.
  6. nova-compute makes a request over HTTP against the Image Service (glance-api) for the virtual machine image file.
  7. glance-api makes a request over HTTP against glance-registry to retrieve the file from the image backend.

    If you wanted to generate a trace that encompasses all of the OpenStack code involved, you would have to trace each service involved.

I'd recommend just reading the code rather than trying to do automated traces. You can also look at the log files, since they contain a lot of debug information. Take a look at the recently released OpenStack Operations Guide for some guidance on how to read the log files.

OTHER TIPS

In addition to what Lorin said you can run "nova --debug boot ... " to see the REST API calls that the nova CLI makes to keystone and the nova-api.

You can use strace if you can get the process ID.

Here is link that explains how:

http://www.cyberciti.biz/tips/linux-strace-command-examples.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top