RPC在neutron中的应用
来源:互联网 发布:诲女知之乎的语气 编辑:程序博客网 时间:2024/06/04 20:12
neutron-plugin中的RPC
主要对ML2Plugin进行分析,包括两个类:RpcCallbacks和AgentNotifierApi。
RpcCallbacks:负责当agent往plugin发出rpc请求时候,plugin实现请求的相关动作,除了继承自父类(dhcp rpc、dvr rpc、sg_db rpc和tunnel rpc)中的方法,还包括get_port_from_device、get_device_details、get_devices_details_list、update_device_down、update_device_up、get_dvr_mac_address_by_host、get_compute_ports_on_host_by_subnet、get_subnet_for_dvr等方法。
AgentNotifierApi:负责当plugin往agent发出rpc请求(plugin通知agent)的时候,plugin端的方法。
def start_rpc_listeners(self): """RpcCallbacks中实现的方法:Start the RPC loop to let the plugin communicate with agents.""" self._setup_rpc() self.topic = topics.PLUGIN self.conn = n_rpc.create_connection(new=True) self.conn.create_consumer(self.topic, self.endpoints, fanout=False) return self.conn.consume_in_threads()
创建一个通知rpc的客户端,用于向OVS的agent发出通知。所有plugin都需要有这样一个发出通知消息的客户端,创建了一个OVS agent的通知rpc客户端。之后,创建两个跟service agent相关的consumer,分别监听topics.PLUGIN
ovs_neutron_agent也会创建RPC的consumer,用来监听topics.UPDATE、topics.DELETE等操作。
def setup_rpc(self): self.agent_id = 'ovs-agent-%s' % self.conf.host self.topic = topics.AGENT self.plugin_rpc = OVSPluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) self.dvr_plugin_rpc = dvr_rpc.DVRServerRpcApi(topics.PLUGIN) self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) # RPC network init self.context = context.get_admin_context_without_session() # Handle updates from service self.endpoints = [self] # Define the listening consumers for the agent consumers = [[topics.PORT, topics.UPDATE], [topics.PORT, topics.DELETE], [constants.TUNNEL, topics.UPDATE], [constants.TUNNEL, topics.DELETE], [topics.SECURITY_GROUP, topics.UPDATE], [topics.DVR, topics.UPDATE], [topics.NETWORK, topics.UPDATE]]
0 0
- RPC在neutron中的应用
- RPC在neutron中的应用,比较详细的介绍了如何使用
- 理解动态代理及动态代理在RPC中的应用
- 反射与动态代理的应用(一):在RPC中的使用
- VLAN Trunk在OpenStack Neutron及SDN中的实现
- Neutron-server初始化 — RPC服务初始化
- Neutron中的iptables
- Neutron中的Service类
- neutron中的网络
- Neutron中的数据包路径
- Neutron中的Quota
- 深入理解Java Proxy机制 应用在 Hadoop RPC 框架
- Java基础:动态代理在RPC框架中应用
- Openstack源码分析 Neutron源码分析(二)-------------rpc篇
- 一张图表示neutron用法及rpc和restful区别
- Juno Neutron中的新feature
- Neutron中的dhcp过程分析
- UE4 RPC在C++中的使用简例
- Error configuring application listener of class org.springframework.web.context.ContextLoaderListene
- 卡牌游戏(queue的基础应用)
- linux命令详解之rpm命令参数使用方法
- SGU 110 Dungeon(计算几何)
- __weak 与__strong的理解与应用
- RPC在neutron中的应用
- Mysql存储过程使用多个游标的处理
- 如何将centos7中的网卡名字改为eth格式
- 选择排序
- iOS开发之友盟推送配置教程
- 字节序
- 【Android界面实现】ActionBar使用的若干细节整理
- jQuery的deferred对象详解
- Service和Thread的关系和区别