How to debug OpenStack and EC2 APIs
1)
Find "nova-api" process and copy the command
#ps -aux | grep nova-api
2)
Stop "nova-api"
#sudo /etc/init.d/nova-api stop
3)
Add debug statements
a)
Debug EC2 API
Goto:
nova/api/ec2/cloud.py
Add pdb in "run_instances" method:
def run_instances:
import pdb; pdb.set_trace()
b)
Debug OpenStack API
Goto:
nova/api/openstack/compute/servers.py
Add pdb in "create" method:
def create(self, req, body):
import pdb; pdb.set_trace()
4)
Start "nova-api" using the command you copied
#sudo /usr/bin/nova-api --config-file=/etc/nova/nova.conf
5)
Fire an EC2 or OpenStack API call and start debugging
1)
Find "nova-api" process and copy the command
#ps -aux | grep nova-api
2)
Stop "nova-api"
#sudo /etc/init.d/nova-api stop
3)
Add debug statements
a)
Debug EC2 API
Goto:
nova/api/ec2/cloud.py
Add pdb in "run_instances" method:
def run_instances:
import pdb; pdb.set_trace()
b)
Debug OpenStack API
Goto:
nova/api/openstack/compute/servers.py
Add pdb in "create" method:
def create(self, req, body):
import pdb; pdb.set_trace()
4)
Start "nova-api" using the command you copied
#sudo /usr/bin/nova-api --config-file=/etc/nova/nova.conf
5)
Fire an EC2 or OpenStack API call and start debugging
Find patch of nova-api source code
ReplyDelete>>> import nova
>>> nova.__file__
'/usr/lib/python2.7/dist-packages/nova/__init__.pyc'
>>>
#cd /usr/lib/python2.7/dist-packages/nova
#ls
api ....