zoukankan      html  css  js  c++  java
  • ovs-agent流程

    1. 代码流程分析

    复制代码
    neutron/plugins/openvswitch/agent/ovs_neutron_agent.py:main()  
        plugin = OVSNeutronAgent(**agent_config)  
            self.setup_integration_br() #创建br-int集成网桥并初始化流表
            self.setup_rpc()  #建立一些agent与server侧常用的rpc通道
                self.plugin_rpc = OVSPluginApi(topics.PLUGIN) #如get_device_details/update_device_down/update_device_up/tunnel_sync
    self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) #查询安全组信息 self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) #处理report_state self.connection = agent_rpc.create_consumers(...)
              #创建以下消费者们:port update/delete, tunnel update/delete, security_group update, dvr update, l2population update host heartbeat = loopingcall.FixedIntervalLoopingCall(self._report_state) #周期任务上报agent状态,如br-int上有多少device,agent当前时间等 self.setup_physical_bridges(bridge_mappings)
              #处理物理网桥与br-int的关联(采用veth对/path对),如果物理网桥不存在则直接退出agent,并初始化流表 self.setup_tunnel_br()/ self.reset_tunnel_br(tun_br)
              #创建br-tun,与br-int关联(采用patch对),并初始化流表
              #为啥要分开处理? self.setup_ancillary_bridges(integ_br, tun_br) # 识别出本host上除了br-int、br-tun和物理网桥之外的网桥,如br-ex self.sg_agent = OVSSecurityGroupAgent(...) # 用于处理安全组
    self.connection.consume_in_threads() # 对以上consume开启各个线程监听并处理 plugin.daemon_loop() self.rpc_loop()   tunnel_sync() #在agent首次启动或有异常发生时,会进行tunnel同步。
                  #上报本agent的tunnel ip到neutron server DB中,neutron server同时发送关于该tunnel ip的消息(tunnel_update)给其他agents
                  #如果没有开启l2pop,则在本agent上会在br-tun上创建tunnel port,其他agents也会创建相应的remote tunnel port,并创建相应流表
           port_info = self.scan_ports()  #周期检测br-int上的端口变化
    sync = self.process_network_ports(port_info) #处理增加或删除的port
    
    
    复制代码

     neutron-server和neutron-openvswitch-agent的消息队列如下:

    neutron-server可能会发生上述几种消息广播给neutron-openvswitch-agent。openvswitch agent会先看一下端口是否在本地,如果在本地则进行对应动作。

    2. nova与neutron-openvswitch-agent的交互

    首先boot虚机时,nova-compute发消息给neutron-server请求创建port。之后,在driver里面在br-int上建立port后,neutron-openvswitch-port循环检测br-int会发现新增端口,对其设定合适的openflow规则以及localvlan,最后将port状态设置为ACTIVE。

    附:ovs启动流程图(http://bingotree.cn/wp-content/uploads/2015/05/ovs-agent%E5%90%AF%E5%8A%A8%E6%B5%81%E7%A8%8B1.png

    http://www.cnblogs.com/xingyun/p/5024400.html

  • 相关阅读:
    前端面试题(转载)
    郝兽医
    声明,本博客文章均为转载,只为学习,不为其他用途。感谢技术大牛的技术分享,让我少走弯路。
    ajax登陆+验证码(转载)
    新手机号
    明天回家
    ERP的灵魂-业务过程
    那些父母要求我们做的事
    出租车上的糗事
    管人管到心
  • 原文地址:https://www.cnblogs.com/allcloud/p/5586464.html
Copyright © 2011-2022 走看看