Hacking on OpenStack\'s Nova source code


Published on

Understanding the source code of an open source project is essential not only to developers, but also to operators.
Nova, being the main project of OpenStack, covers the core functionality in which OpenStack provides.
Therefore understanding the inner structure of Nova should be beneficial to people related in all aspects.
This talk is about the structure of Nova\'s source code with an example to help you to understand the overall process scheme of OpenStack.
At the end, I briefly introduce how you can contribute to the OpenStack community.

1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Hacking on OpenStack\'s Nova source code

  1. 1. Hacking onOpenStack’sNova Source Code2012-01-08Luo, Zhongyuezhongyue@staff.sina.com.cn
  2. 2. TODO Intro The source code structure of Nova File structure Component architecture An example Contributing Conclusion 2
  3. 3. Intro What is OpenStack? and Nova? WHY shoud I listen to this? Can we actually hack the code in 30min? Why should I trust this guy? 3
  4. 4. Source code structure of Nova Macro vs Micro(DIY) File structure Component architecture File structure ↔ Component architecture 4
  5. 5. But first...terminologies Service Topic Nova component → Service.create(Topic) Manager (abst) ⊂ Nova component Drivers (impl) ⊂ Manager ex) lvm, qemu, xen, hyperV Lazy plugging → Value based module loading AMQP → Advanced Message Queue Protocol API → REST & Inner 5
  6. 6. File structure ”start” ”configs” ”helpers” ”REST” ”is a topic” ”is a topic” ”is a topic” ”is a topic” 6
  7. 7. Component architecture Tenant http://nova.openstack.org/nova.concepts.html 7
  8. 8. Component architecture ”/etc/nova/nova.conf” ”ec2”, ”osapi” 8
  9. 9. ”network”?? 9
  10. 10. Component structure ”network” Network service Periodic Topic: network task Manager Driver: linux_net Reads message from Queue Returns results back to DB or queue Calls inner APIs Network API Looks up DB Sends message to Service via queue - Cast: Send and forget - Call: Send and wait 10
  11. 11. Component architecture revisited DB API API Queue API API WSGI 11
  12. 12. An exampleLet’s allocate afloating-ip to aninstance with a fixed-ip DB ”compute API” API 1 API Queue API Allocate to a-fake-uuid? API Do you have permission? WSGI I wonder if a-fake-uuid exists... I’ll ask compute API.POST /v2/a-fake-tenant/servers/a-fake-uuid/action 12
  13. 13. An example Yup, a-fake-uuid is valid.Oh, and its fixed-ip is Take it from here network API! 2 DB ”compute API” API 3 API Queue ”network API” API API WSGI 13
  14. 14. An example ”nova-network”So translate to Go check your mail. I’ll tell nova-network to run ”associate_floating_ip”. Ok, my casting is done. DB I got a message! It says... Dear manager, ”compute API” ”associate_floating_ip” API 5 API 4 Queue ”network API” API API WSGI 14
  15. 15. An example ”nova network” 7 iptables 6 DB ↔ DB update...Done.”compute API” Running iptables-save...Done. API API Queue ”network API” API API WSGI 15
  16. 16. An example ”nova network”Did the allocation a-fake-uuid: ↔ 2 DB ”compute API” API 3 1 API Queue ”network API” API Here’s the details of a-fake-uuid. 4 API You want to see if the allocation was a success? WSGI I’ll check with compute API...GET /v2/a-fake-tenant/servers/a-fake-uuid 16
  17. 17. OpenStack Nova architecture ”nova network” ”nova volume” ”nova compute” DB ”compute API” API API ”scheduler API” Queue ”network API” API ”nova scheduler” API WSGI ”volume API” 17
  18. 18. Contributing LaunchPad http://launchpad.net/~openstack Join mailing lists Documents http://docs.openstack.org/ More info http://wiki.openstack.org/HowToContribute 18
  19. 19. Conclusion Structure of code and components of Nova An example How to get involved http://github.com/lzyeval/talk-COSUG-2012 http://launchpad.net/~lzyeval 19