[Openstack] [Cinder] Debugging Cinder Volume Code

Tushar Tyagi ttml at fastmail.com
Mon Nov 5 12:15:38 UTC 2018


Hello,

I have some requirement wherein I need to change the way Cinder creates volumes. Along with code changes I want to debug and understand the code flow. 

So far I've been able to debug the `cinderclient` package using the Python debugger `pdb` by following these steps: 
- Add pdb.set_trace() statements in the python files
- Run the "cinder create" CLI command 
- Step through the code.

My understanding is that the requests end up going to the Cinder api exposed the "$HOST/volumes" http endpoint. For my debugging purposes, this is not deep enough (I want to understand the interaction between `cinder` and some of the NVMe volumes that I have). 

For debugging the core `cinder` package, I've tried using the same `pdb` approach but I've not been able to make it work. Mostly because I've not been able to find the entry point where I can add the trace statements and start the service.  

Another approach that I've tried is to attach debugger on the running python process and add a file+function breakpoint. Again, I've not been able to make this work. I believe gdb is mostly looking for C files and even if I give the complete path of the file and function, it doesn't break. Moreover, there are 3 instances of `cinder-volume` running on my machine and I've tried attaching gdb to all three of them but nothing happens.

So my question is how do I debug the core Cinder process? Is there any documentation I can refer to? Or some other practice that is involved in doing so?

Thanks

-- 
  Tushar Tyagi
  ttml at fastmail.com



More information about the Openstack mailing list