neutron/agent/l3/dvr.py
class AgentMixin(object):
def __init__(self, host):
# dvr data
self._fip_namespaces = weakref.WeakValueDictionary()
super(AgentMixin, self).__init__(host)
- 根据 external network id,判断当前的 l3 agent 是否已经存在其 fip- namespace,若有则直接返回
- 若没有,则构造一个
FipNamespace
实例
通过 RPC 获取该 subnet 上的 port
def add_arp_entry(self, context, payload):
"""Add arp entry into router namespace. Called from RPC."""
self._update_arp_entry(context, payload, 'add')
def del_arp_entry(self, context, payload):
"""Delete arp entry from router namespace. Called from RPC."""
self._update_arp_entry(context, payload, 'delete')
调用 router info 的 _update_arp_entry
完成 arp 记录的更新
[root@node1 ~]# ip netns exec qrouter-61eaacf9-d4e0-4202-bac9-321da0ceaa69 arp -n
当 external network 从该 host 被移除(没有与之相关的 port)时,则删除其 fip- namespace