neutron openvswitch agent

在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。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章