[openstack-dev] [neutron] Creating database model and agent

Maciej Nabożny mn at mnabozny.pl
Fri Aug 1 10:14:13 UTC 2014


Hello,
some days ago I was asking you about creating extension and service 
plugin for Neutron. Now, I am trying to find how to create database 
model for this plugin and agent :)

Could you check if I am understanding this issues properly?

The database model for new plugin should be created in neutron/db 
directory. The model classes should inherit:
1. neutron.db.model_base.BASEV2, which is related to NeutronBaseV2 class
2. if model should contain id or relation to tenant, it should inherit 
also HasTenant and HasId from module neutron.db.models_v2
3. All other fields should be defined according to sqlalchemy orm.
I have also question - how Neutron knows (or sqlalchemy) which 
models/tables should be created in database? At this moment I cannot 
find any code, which initializes the database. The only thing which I 
found is declarative.declarative_base in db.model_base


And one question about creating new agents - is it just thread/process, 
which is managed by Neutron? I was analysing lbaas code and it is just 
python script in /usr/bin/, which executes class. Do I have to create 
anything additional like with database or service plugin to create new 
agent? Or scripts like in LBAAS will be enough + init script?


I also found great diagram, which describes in a nut shell how Neutron 
service plugins are organised internal:
https://wiki.openstack.org/wiki/Neutron/LBaaS/Architecture
Maybe it would be good idea to put diagram like this to official dev 
wiki? Of corse after some modifications. Now wiki points to the 
SecurityGroups code, which is not very helpful for beginners like me :)

regards!
Maciej



More information about the OpenStack-dev mailing list