Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cosug 2012-lzy


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Cosug 2012-lzy

  1. 1. Hacking onOpenStack’sNova Source Code2012-01-08Luo,
  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 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 and get your mail. I’ll tell nova-network to run ”associate_floating_ip”. Ok, my casting is done. DB I got a message! 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 Join mailing lists Documents More info 18
  19. 19. Conclusion Structure of code and components of Nova An example How to get involved 19