Ask Your Question

how does ml2 work specifically?

asked 2016-02-24 15:47:47 -0500

yby-developer gravatar image

I'm trying to understand how the ml2 works. I'm kinda new to openstack. I was reading/watching these:

Let's say we have 1 Network node, and 2 compute nodes. compute-1 node is running OVS and compute-2 linuxbridge.

From what I understand:

User instantiates a VM.
Nova finds the right compute host, let\'s say the one with the OVS (compute-1), and instructs Neutron-server accordingly.
Now, from what I understand, Neutron server has an ML2 plugin.
This plugin has to instruct the Neutron agent running on the compute host.
The Neutron agent is the one that generates the openflow/ovsdb rules on the compute host.
So the ML2 plugin on the Neutron-server is using a Mechanism driver. If it communicates with compute-1, it uses the openvswitch MechDriver.

Does this mean that the MechDriver is only relevant on a network node? The reason I ask is that I think I saw it was used on the compute host as well in the conf file. Or I did not understand anything, and the Mechdriver is relevant to the Neutron agent and not to the server??

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2016-03-07 04:41:43 -0500

dbaxps gravatar image

updated 2016-03-07 04:56:12 -0500

Neutron OVS agent is building configuration provided by in openvswitch_agent.ini at it's start-up
I also believe that OVS agent is responsible for Neutron/OVS work flow on Network and Compute Nodes via talking to Neutron Server , running on Controller ( along with Nova API Server).
See details here:-
See also :-
Per link above

An example for modular plugin would be the popular ML2 which implements v2 API. It delegates the calls to the different drivers. There are mechanism drivers and type drivers. Types are types of segmentation like VLAN, gre, vxlan. Mechanism drivers suppose to ensure that the type driver properly applied given the specific networking mechanisms that have been enabled.


In general L2 agent runs on hypervisor and and communicates with neutron server using RPC. Normally will be installed on the network and compute nodes. Its main job is to watch and notify when devices added or removed and to configure the network on the host accordingly.  It can handle linux bridges, OVS and  security group rules.
 Openvswitch L2 agent configured to work with OVS, using ovsdb.


One common example for its usage would be new created vm with single nic that must be connected to some network. The actual connection is done by L2 agent that makes sure it connected to the right network. It also handles  OVS flows, Linux bridges, VLAN tagging and security groups.
edit flag offensive delete link more

answered 2016-03-06 18:55:39 -0500

yby-developer gravatar image

updated 2016-03-06 19:14:35 -0500

Thanks, but I still don't undestand the answers to the questions that I asked. I have already read those posts, and many others. My question is simply to understand the flow of who against whom and where. So I will phrase it as questions:

Let's say I set up a simple openstack with 1 network node and 2 computes. I understand that the neutron service (API) is running on the network node. Now, say I add a simple tenant network, with some subnet. Neutron service (API) is notified that I would like to create such network, and Neutron talks to ML2 plugin. 1. Does ML2 talk directly to the mechanism driver? 2. Does that mean that the mechanism driver code is only relevant for the network node? 3. Who calls the neutron agent on the network node and on the compute node? Neutron service? Neutron ML2 plugin? Neutron ML2 mechanism driver? 4. Is the whole purpose of the agent to set rules in the vSwitch and set up ports locally? 5. Does the neutron agent ever initiate something, or only does as it is told? 6. Does it always act locally (i.e. changes things only on the server it's running on)?

edit flag offensive delete link more

answered 2016-03-03 05:03:51 -0500

Regarding you major concern see
Take a look also at this old link
Neutron Server is actually Neutron API Server to provide ML2 features to it's ovs agent running on Compute,
it should be first updated itself ( in old times) . In meantime Neutron Server comes ready to provide ML2 aware
API for neutron-openvswitch-agent

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2016-02-24 15:47:47 -0500

Seen: 404 times

Last updated: Mar 07 '16