neutron dhcp agent

Neutron dhcp agent 主要負責在openstack中提供dhcp服務。在openstack的H版本中,neutron dhcp agent是支持multi host部署的。



dhcp agent 通過Message Queue與Neutron-Server通信。主要用到3個消息隊列,q-plugin是從agent發送消息到neutron-server所用的隊列。
dhcp agent啓動時,會將自己的信息上報給neutron-server, neutron-server將這些信息存儲在DB中,以便之後創建網絡將網絡綁定到agent做決策時使用。
dhcp agent信息會存放在neutron數據庫的agents表中,如下例:
| c341d3c4-15a8-45bf-bffe-36cef5488928 | DHCP agent | neutron-dhcp-agent | dhcp_agent | ci91szcmp001.webex.com | 1 | 2014-02-11 08:30:03 | 2014-02-11 09:32:03 | 2014-02-20 05:44:42 | NULL | {"subnets": 2, "use_namespaces": true, "dhcp_lease_duration": 86400, "dhcp_driver": "neutron.agent.linux.dhcp.Dnsmasq", "networks": 2, "ports": 26} |
| 9bdcbaf8-43fa-44b1-a7df-ea1c86bd6cd1 | DHCP agent | neutron-dhcp-agent | dhcp_agent | ci91szcmp002.webex.com | 1 | 2014-02-11 08:26:34 | 2014-02-11 09:32:28 | 2014-02-20 05:44:39 | NULL | {"subnets": 2, "use_namespaces": true, "dhcp_lease_duration": 86400, "dhcp_driver": "neutron.agent.linux.dhcp.Dnsmasq", "networks": 2, "ports": 26} |


dhcp agent啓動時還會主動sync狀態,會通過q-plugin隊列發送消息給neutron-server獲取所有的綁定到本agent的network/subnet/port信息,並根據這些信息配置正確的namespace,dhcp server接口和dnsmasq 。


agent和network綁定關係被存儲在networkdhcpagentbindings中:
mysql> select * from networkdhcpagentbindings;
+--------------------------------------+--------------------------------------+
| network_id                           | dhcp_agent_id                        |
+--------------------------------------+--------------------------------------+
| 218203a4-bc92-4c0e-a245-654e0e3ccefe | 9bdcbaf8-43fa-44b1-a7df-ea1c86bd6cd1 |
| 52aba766-fdba-4776-ac09-462bf6da40d5 | 9bdcbaf8-43fa-44b1-a7df-ea1c86bd6cd1 |
| 218203a4-bc92-4c0e-a245-654e0e3ccefe | c341d3c4-15a8-45bf-bffe-36cef5488928 |
| 52aba766-fdba-4776-ac09-462bf6da40d5 | c341d3c4-15a8-45bf-bffe-36cef5488928 |
+--------------------------------------+--------------------------------------+
4 rows in set (0.00 sec)


網絡,子網和端口信息分別存儲在數據庫的networks,subnets和ports表中。dhcp agent需要獲取這些信息生成dnsmasq的配置信息,並將這些信息存儲在/var/lib/neutron/dhcp/目錄下。

當neutron-server有需要添加/修改/刪除dhcp相關配置時,會將消息發送到隊列dhcp_agent.hostname或dhcp_agent_fanout_id,dhcp agent收到消息後進行相應dhcp的配置。

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