Where's the code of adding port to OVS when creating vm?

Asked by Alex Wu

ENV: ubuntu 12.04, devstack with quantum, single node

I'm looking for the add-port code which should be called when I create vm on web UI.

I set pdb.set_trace in almost any possible code(like add_port, create_port etc.) but I couldn't find the one that add the port to OpenvSwitch.

The architecture says the agent adds the port to ovs, but I killed the agent and the ovs port could be added as before.

And then I killed dhcp/l3/agent threads, left quantum-server only. But the ovs port could be added on the web(while created vm) as before???? And it assigned the ip as before.. The behaviour of the thread was very confusing.

So what's the code that adds the port to ovs?

Question information

Language:
English Edit question
Status:
Solved
For:
neutron Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene Nikanorov
Solved:
Last query:
Last reply:
Revision history for this message
Best Eugene Nikanorov (enikanorov) said :
#1

If you're talking about nova, look at nova/virt/libvift/vif.py
There is a code responsible for creating a port for different L2 implementations (ovs, linuxbridge)

Revision history for this message
Alex Wu (alexapollo0) said :
#2

what...? r u saying that quantum doesn't do the add-port operation itself?
FML.. i debug the quantum and read quantum's all code for 3 days....

But why quantum add port to ovs when init the bridge?
And is the class OVSInterfaceDriver useless when adding a port?

Thanks a lot!

Revision history for this message
Eugene Nikanorov (enikanorov) said :
#3

OVSInterfaceDriver and similar drivers are used by dhcp/l3 agents that to do similar things as nova vif drivers.

Revision history for this message
yong sheng gong (gongysh) said :
#4

vif add port into br-int because the kvm needs them to bring up VM.

then the ovs-agent will config the vlan tag or something.

Revision history for this message
Alex Wu (alexapollo0) said :
#5

@Eugene Nikanorov (enikanorov)
    As I mentioned before, the dhcp service still works even after dhcp-agent is killed.
    Is nova-progress a alternative scheme?
    Could u plz show me a sequence chart?
@yong sheng gong (gongysh)
    Many thanks! now i understand why nova do it instead of quantum.

Revision history for this message
Eugene Nikanorov (enikanorov) said :
#6

dhcp server for a tenant is dnsmasq process running on the host within a tenant network and is managed by dhcp agent.
If you kill dhcp agent it won't cause automatic shutdown of dnsmasq.

By saying that OVSInterfaceDriver acts similarly as nova's ovs vif driver I meant that they both create ovs ports and attach interfaces to these ports

Revision history for this message
Alex Wu (alexapollo0) said :
#7

Thanks Eugene Nikanorov, that solved my question.