neutron openvswitch agent

来源:互联网 发布:福州淘宝美工在哪里学 编辑:程序博客网 时间:2024/05/21 06:45

在openstack中目前用的比较多的L2层agent应该就是openvswitch agent了。本文大致分析了一下openvswithc agent做了哪些事。


看一下openvswitch agent的启动:

neutron/plugins/openvswitch/agent/ovs_neutron_agent.py:main()plugin = OVSNeutronAgent(**agent_config)self.setup_rpc()self.plugin_rpc = OVSPluginApi(topics.PLUGIN)self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)self.connection = agent_rpc.create_consumers(...)heartbeat = loopingcall.FixedIntervalLoopingCall(self._report_state)self.setup_integration_br()self.setup_physical_bridges(bridge_mappings)self.sg_agent = OVSSecurityGroupAgent(...)plugin.daemon_loop()self.rpc_loop()                port_info = self.update_ports(ports)                sync = self.process_network_ports(port_info)

启动时做了以下工作:

1. 设置plugin_rpc,这是用来与neutron-server通信的。

2. 设置state_rpc,用于agent状态信息上报。

3. 设置connection,用于接收neutron-server的消息。

4. 启动状态周期上报。

5. 设置br-int。

6. 设置bridge_mapping对应的网桥。

7. 初始化sg_agent,用于处理security group。

8. 周期检测br-int上的端口变化,调用process_network_ports处理添加/删除端口。


neutron-server和neutron-openvswitch-agent的消息队列如下:



neutron-server可能会发生上述四种消息广播给neutron-openvswitch-agent。openvswitch agent会先看一下端口是否在本地,如果在本地则进行对应动作。


最后看下nova与neutron-openvswitch-agent的交互,这张图片来源于GongYongSheng在香港峰会的PPT:


首先boot虚机时,nova-compute发消息给neutron-server请求创建port。之后,在driver里面在br-int上建立port后,neutron-openvswitch-port循环检测br-int会发现新增端口,对其设定合适的openflow规则以及localvlan,最后将port状态设置为ACTIVE。

1 0
原创粉丝点击