neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py
def __init__(self, topic=topics.L3_AGENT):
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
对于指定 host 上的 l3 agent 发送通知或调用
- 调用
l3_router_nat.get_hosts_to_notify
根据 router_id 获取所有需要通知的 l3 agent - 针对所有的 l3 agent 发送通知
广播通知所有的 l3 agent 有关 arp 的数据
def _notification(self, context, method, router_ids, operation, shuffle_agents, schedule_routers=True)
- 若是支持
l3_agent_scheduler
extension,则只通知拥有该 router 的 l3 agent - 若是不支持
l3_agent_scheduler
则广播通知所有的 l3 agent
广播通知所有的 l3 agent
想特定的 Host 上发送 RPC 消息。
发送 RPC 广播消息(某个 router 被删除)。
def routers_updated(self, context, router_ids, operation=None, data=None, shuffle_agents=False, schedule_routers=True)
发送 router 更新的消息
发送增加 arp 记录的 RPC 消息
发送删除 arp 记录的 RPC 消息
删除 fip namespace 的 RPC 消息
发送 router 移除的 RPC 消息
发送在某个 agent 上增加 router 的 RPC 消息
发送某个 agent 上 router 更新的 RPC 消息
在 L3AgentNotifyAPI
的基础上发送 RPC 消息
def __new__(cls):
L3RpcNotifierMixin._subscribe_callbacks()
return object.__new__(cls)
- 通过 neutron 的 callback 系统订阅感兴趣资源的消息:
- PORT: AFTER_DELETE: _notify_routers_callback
- SUBNET_GATEWAY: AFTER_UPDATE: _notify_subnet_gateway_ip_update
- SUBNETPOOL_ADDRESS_SCOPE: AFTER_UPDATE: _notify_subnetpool_address_scope_update
属性方法,返回 L3AgentNotifyAPI
的实例
发送单个 router 更新的 RPC 消息
发送多个 router 更新的 RPC 消息
发送 router 删除的 RPC 消息
当有 port 资源删除的时候,会触发此方法,进一步发送 router 更新的 RPC 消息。(L3_NAT_db_mixin.notify_routers_updated
)
当某一子网的网关 ip 发生变化时,发送 router 更新的 RPC 消息。(L3RpcNotifierMixin.notify_router_updated
)
当某一子网的地址范围发生变化时,发送 router 更新的 RPC 消息。(L3_NAT_db_mixin.notify_routers_updated
)