5. devstack
● build your development environment.
● mini config:
ADMIN_PASSWORD=secrete
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=a682f596-76f3-11e3-b3b2-e716f9080d50
SCREEN_LOGDIR=$DEST/logs/screen
6. Component
● keystone -- auth and service catalog
● nova -- VM
● glance -- image service
● cinder -- block storage service
● swift -- object storage service
● neutron -- network
7. glance service:
● privide image
● support backend:
○ s3
○ swift
○ file system
cinder service:
● for instance
swift:
● object storage
8. other interesting project
● Trove -- database as a service
● Sahara -- provision a Hadoop cluster on top
of OpenStack
● taskflow
● oslo messaging
10. Threading Model
● green thread model(implemented through
using the Python eventlet and greenlet
libraries.
Python
VM
Openstack
thread
model
VM
M thread
M kernel
thread
M thread M thread
1 kernel
thread N kernel
thread
kernel layer
application layer
12. api.py: wsgi server(API or Controller)
rpcapi.py < = > manager.py
api.py
request for
RESTful api
python
call
rpcapi
.py
oslo.
messagi
ng
mana
ger.py
15. 有什麼問題,
中間加一層就
對了
● Mediates interactions between nova-
compute and the database.
● Security
○ nova-compute never access database directly.
● Ease of Upgrade
● Performance
○ Queries to the MySQL database will block the main
thread of a service.
○ scales horizontally
nova-conductor
28. Entry point
1. 由下而上(由樹見林)
a. traceback.extract_stack.
b. use debugger to show traceback.
2. 由上而下(由林見樹)
a. call_seq.
29. call_seq
● written by me.
● pip install git+https://github.
com/ya790206/call_seq
● trace you program how to run and generate
a report with json format.
30. from call_seq import CallSeq
trail = CallSeq()
trail.set_trace()
# the code you want to trace.
trail.unset_trace()
trail.dump_to_file('output.json')
33. Test Code
● 看看 function test 和 unit test
https://github.com.openstack.nova.blob.
master.nova.tests.test_flavors.py
https://github.com.openstack.cinder.blob.
master.cinder.tests.test_volume.py
34. 總結
● openstack: build you own cloud.
● communication:
○ REST api
○ oslo.messaging
● Trace Code Tip