Download - Open stack nova reverse engineer
![Page 1: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/1.jpg)
OpenStack Nova ‘Reverse Engineer’
2016 May 07Hieu LE Vietnam OpenStack Community OrganizerFujitsu Vietnam - PODC
Copyright 2016 Fujitsu Vietnam Limited
![Page 2: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/2.jpg)
Starting Point (1)
1 Copyright 2016 Fujitsu Vietnam Limited
Video Tutorial: how to setup remote debugging environment for OpenStack Nova,
request from some community members.
Ref: https://youtu.be/Z0PmKyeZjjA
![Page 3: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/3.jpg)
Starting Point (2)
@NamNH (Fujitsu) contribute to documentation: “Debugging OpenStack Neutron”
Ref: https://vietstack.wordpress.com/2016/04/12/how-to-remote-debugging-openstack-neutron/
Hope that he will present at next
technical meetup about Neutron ;)
2 Copyright 2016 Fujitsu Vietnam Limited
![Page 4: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/4.jpg)
Agenda
Copyright 2016 Fujitsu Vietnam Limited
1. Architecture overview
2. Data Flows
3. Nova Code Structure Components
4. Conclusion
3
![Page 5: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/5.jpg)
“to provide massively scalable, on demand,
self service access to compute resources”
OpenStack Nova mission
http://docs.openstack.org/developer/nova/project_scope.html
4 Copyright 2016 Fujitsu Vietnam Limited
![Page 6: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/6.jpg)
“to provide massively scalable, on demand,
self service access to compute resources”
OpenStack Nova mission
http://docs.openstack.org/developer/nova/project_scope.html
5 Copyright 2016 Fujitsu Vietnam Limited
Virtual Servers Containers Bare Metal Servers Driver Parity
![Page 7: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/7.jpg)
Agenda
Copyright 2016 Fujitsu Vietnam Limited
1. Architecture overview
2. Data Flows
3. Nova Code Structure Components
4. Conclusion
6
![Page 8: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/8.jpg)
Architecture overview
Model:
Nova Network
Neutron
Cells (v1, 2)
Core components
DB: sql database for data storage.
API: receive HTTP requests, converts commands and communicates with other components via the oslo.messaging queue or HTTP
Scheduler: decides which host gets each instance
Compute: manages communication with hypervisor and virtual machines.
Conductor: handles requests that need coordination(build/resize), acts as a database proxy, or handles object conversions.
Cells: used by some large deployments to partition compute nodes into smaller groups, coupled with a database and queue. DEFAULT FROM MITAKA WITH CELLS V2
7 Copyright 2016 Fujitsu Vietnam Limited
![Page 9: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/9.jpg)
Architecture overview
Other nova components
Network: manages ip forwarding, bridges, and vlans
Metadata: serves metadata for instances
Cert: serves X509 certificates, using for euca-bundle-image and only needed for EC2 API
Console auth and proxies: noVNC, SPICE, XVP, RDP.. for remote console purpose toward instances
EC2: *DEPRECATED AND MOVE TO NEW EC2-API PROJECT FROM MITAKA* using EC2 API with nova services.
8 Copyright 2016 Fujitsu Vietnam Limited
![Page 10: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/10.jpg)
Architecture overview (1)
9 Copyright 2016 Fujitsu Vietnam Limited
1
2 3 45
7
6
Ref:
http://docs.openstack.org/developer/nova/architecture.html
![Page 11: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/11.jpg)
Architecture overview (2)
10 Copyright 2016 Fujitsu Vietnam Limited
1
2 3 45
7
6
Ref:
http://docs.openstack.org/developer/nova/architecture.html
![Page 12: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/12.jpg)
Architecture overview (2)
Normal Workflow
11 Copyright 2016 Fujitsu Vietnam Limited
MQ and DB is under heavy-load.
Cells
There are Austin summit video about Nova scheduler performance.
https://www.openstack.org/videos/video/dive-into-nova-scheduler-performance-where-is-the-bottleneck
https://docs.google.com/presentation/d/1UG1HkEWyxPVMXseLwJ44ZDm-
ek_MPc4M65H8EiwZnWs/edit?ts=571fcdd5#slide=id.g12d2cf15cd_2_84
![Page 13: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/13.jpg)
Architecture overview (3)
12 Copyright 2016 Fujitsu Vietnam Limited
Ref: OpenStack Japan User Group
![Page 14: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/14.jpg)
Architecture overview (3)
13 Copyright 2016 Fujitsu Vietnam Limited
API DB
Compute DB
![Page 15: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/15.jpg)
Architecture overview (3)
Cells: aim for easily scaling and providing fault tolerance by partition compute nodes into smaller groups with separate database and queue, instead of legacy deployment model with single logical database and message queue.
Cells v1:
Optional
Not all features supported
Sync instance between DBs
Cells v2:
Default deployment model is one v2 cell
New API database
Tools to migrate from cells v1 **NOT IMPLEMENTED IN MITAKA, PLAN IS IN NEWTON**
14 Copyright 2016 Fujitsu Vietnam Limited
![Page 16: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/16.jpg)
Agenda
Copyright 2016 Fujitsu Vietnam Limited
1. Architecture overview
2. Data Flows
3. Nova code structure
4. Conclusion
15
![Page 17: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/17.jpg)
Façade
16 Copyright 2016 Fujitsu Vietnam Limited
WSGIService
oslo_service lib
Paste filters
Paste/Paste.Deploy lib via api-paste.ini
WebOb lib for WSGI req/res wrapper
1. RESTful req 2. WSGI Req
APIRouter
RoutesMiddleware
3. Filtered req
Routes lib
Extension
Controller:index/show/delete/
create..
Extension
Controller:index/show/delete/
create..
Extension
Controller:index/show/delete/
create..
4. Req dispatching
stevedore lib for managing ext, ctrl
Expose via pbr entrypoint
oslo_conf
Façade/Decorator pattern
oslo_message
RPC
![Page 18: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/18.jpg)
Façade design pattern
Nova-compute API (nova/nova/compute/api.py): API, HostAPI, InstanceActionAPI, KeypairAPI…
17 Copyright 2016 Fujitsu Vietnam Limited
Ref: Wikipedia/façade_pattern
![Page 19: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/19.jpg)
OpenStack Oslo common lib
oslo.cache: a library for caching based on dogpile
oslo.concurrency: a project with helpers managing external processes and task synchronization. E.g: check host resources.
oslo.config: an extensive library for parsing configuration files and command line arguments.
oslo.log: a logging configuration library.
oslo.service: helper library that provides functionality for running OpenStack services. nova-api service
oslo.messaging: a library that provides a messaging API which supports RPC and notifications over a number of different messaging transports.
oslo.serialization
Ref: https://wiki.openstack.org/wiki/Oslo
18 Copyright 2016 Fujitsu Vietnam Limited
![Page 20: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/20.jpg)
pbr
Python Build Reasonableness: using setuptools to deploy your code and expose via entry points.
setup.cfg
policy.json: will be checked each time an API is called
Can be modified for reasonable purpose
19 Copyright 2016 Fujitsu Vietnam Limited
![Page 21: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/21.jpg)
WSGI – PEP 0333
nova/wsgi.py
WSGI Application
Python callable passed two arg (WebOb)
• Env
• Start_response function callback function
WSGI Server
Call the application
WSGI Middleware (Paste)
Both a server and application
Use to wrap request
Paste Deploy will automatically find and config WSGIapplications and servers
20 Copyright 2016 Fujitsu Vietnam Limited
Ref: WSGI – Aseries of Tubes by Ian Bickings (The
Open Planning Project)
![Page 22: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/22.jpg)
21 Copyright 2016 Fujitsu Vietnam Limited
![Page 23: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/23.jpg)
Paste
http://pythonpaste.org/
Check api-paste.ini file below and see DEMO
22 Copyright 2016 Fujitsu Vietnam Limited
Middleware filter Apps
Filter flow
![Page 24: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/24.jpg)
Stevedore (1)
Extension manager library
https://github.com/openstack/stevedore
http://docs.openstack.org/developer/stevedore/
23 Copyright 2016 Fujitsu Vietnam Limited
![Page 25: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/25.jpg)
Stevedore (2)
Check nova/api/openstack/compute/disk_config.py
Easier to write new API
Easier to write new plugin
24 Copyright 2016 Fujitsu Vietnam Limited
![Page 26: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/26.jpg)
Stevedore (3)
Where is extension manager ?
nova/api/openstack/__init__.py – ApiRouterv21 class
nova/compute/monitors/__init.py__
and more …
25 Copyright 2016 Fujitsu Vietnam Limited
![Page 27: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/27.jpg)
Routes
Mapping URLs to controllers+actions. URLs are mapped to ‘action’ methods on ‘controller’ classes in nova/api/openstack/__init__.py, class ApiRouter._init_ and ApiRouterv21.__init__
26 Copyright 2016 Fujitsu Vietnam Limited
Stevedore ext mgr
Map URL from alias
/v2.1/{tenant_id}/os-aggregates
Ref: api-ref site OpenStack
![Page 28: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/28.jpg)
Agenda
Copyright 2016 Fujitsu Vietnam Limited
1. Architecture overview
2. Data Flows
3. Nova Code Structure Components
4. Conclusion
27
![Page 29: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/29.jpg)
Nova code structure
28 Copyright 2016 Fujitsu Vietnam Limited
documentation
For packaging, deploying and testing (using tox)
Source Codes
For setup with devstack
Configuration files
XenServer plugin for using with nova
![Page 30: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/30.jpg)
Nova code structure
Configuration files
29 Copyright 2016 Fujitsu Vietnam Limited
Rootwrap.d conf: allow a service-specific
unprivileged user to run a number of actions as
the root user, in the safest manner possible.
https://wiki.openstack.org/wiki/Rootwrap
Nova API config (paste + policy)
Nova Cells config samplehttp://docs.openstack.org/mitaka/config-reference/compute/cells.html
Docs
Logging sample config file
Nova config generator file. Using oslo-config-generator
tool or tox –egenconfig for a sample of nova.conf file.
Nova.conf sample file will list all nova config options
and default value of each option.
![Page 31: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/31.jpg)
Nova code structure
Configuration files
30 Copyright 2016 Fujitsu Vietnam Limited
Rootwrap.d conf: allow a service-specific
unprivileged user to run a number of actions as
the root user, in the safest manner possible.
https://wiki.openstack.org/wiki/Rootwrap
Nova API config (paste + policy)
Nova Cells config samplehttp://docs.openstack.org/mitaka/config-reference/compute/cells.html
Docs
Logging sample config file
Nova config generator file. Using oslo-config-generator
tool or tox –egenconfig for a sample of nova.conf file.
Nova.conf sample file will list all nova config options
and default value of each option. (~810 option)
![Page 32: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/32.jpg)
Nova source code
31 Copyright 2016 Fujitsu Vietnam Limited
Executable system script, bundle and expose via pbr.
e.g.: nova-api, nova-compute..
Centralize configuration options for all nova subcomponents
(WIP Newton version)
Nova compute virt (virtualization) driver driver parity approach
![Page 33: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/33.jpg)
Nova source code
32 Copyright 2016 Fujitsu Vietnam Limited
Executable system script, bundle and expose via pbr.
e.g.: nova-api, nova-compute..
Centralize configuration options for all nova subcomponents
(WIP Newton version)
Nova compute virt (virtualization) driver driver parity approach
HANDS-ON DEMO
![Page 34: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/34.jpg)
Agenda
Copyright 2016 Fujitsu Vietnam Limited
1. Architecture overview
2. Nova Code Structure Components
3. Data Flows
4. Conclusion
33
![Page 35: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/35.jpg)
Conclusion
34 Copyright 2016 Fujitsu Vietnam Limited
WSGIService
oslo_service lib
Paste filters
Paste/Paste.Deploy lib via api-paste.ini
WebOb lib for WSGI req/res wrapper
1. RESTful req 2. WSGI Req
APIRouter
RoutesMiddleware
3. Filtered req
Routes lib
Extension
Controller:index/show/delete/
create..
Extension
Controller:index/show/delete/
create..
Extension
Controller:index/show/delete/
create..
4. Req dispatching
stevedore lib for managing ext, ctrl
Expose via pbr entrypoint
oslo_conf
Façade/Decorator pattern
oslo_message
RPC
![Page 36: Open stack nova reverse engineer](https://reader031.vdocuments.site/reader031/viewer/2022021922/58824fd61a28ab37158b67ab/html5/thumbnails/36.jpg)
THANK YOU!
Copyright 2016 Fujitsu Vietnam Limited35