网站开发与支付宝端口连接,网站底部固定代码,微博官网入口,电子商务网站建设考题Service是OpenStack中非常重要的一个概念#xff0c;各个服务的组件都以Service类的方式来进行交互。 Neutron中的Service类继承自rpc中的Service#xff0c;总体的继承关系为 neutron.openstack.common.service.Service类--neutron.common.rpc.Service类--neutron.s… Service是OpenStack中非常重要的一个概念各个服务的组件都以Service类的方式来进行交互。 Neutron中的Service类继承自rpc中的Service总体的继承关系为 neutron.openstack.common.service.Service类--neutron.common.rpc.Service类--neutron.service.Service类。 当中neutron.openstack.common.service.Service类定义了简单的reset()、start()、stop()和wait()方法。该类初始化后会维护一个线程组。 neutron.common.rpc.Service类中进一步丰富了start()和stop()方法并在初始化中引入了host、topic、manager和serializer參数。 start()添加创建了Connection对象之后创建了三个consumer分别监听主题为參数传入的topicfanout分别为True和False以及主题为topic.host。然后调用manager的初始化。最后作为server启动全部的consumer。 neutron.service.Service类的初始化中更进一步的添加了binary、report_interval、periodic_interval、periodic_fuzzy_delay等參数。除丰富了start()、stop()和wait()方法外还添加了create()类方法、kill()、periodic_tasks()和report_state()。 start()添加了周期性运行report_state()和periodic_tasks()而且调用manager的init_host()和after_start()方法。 create()方法是类方法它依据传入的參数binary參数获取真实的程序名并在未给定參数的情况下尝试从配置文件里解析manager和report_interval、periodic_interval、periodic_fuzzy_delay等參数。最后是返回生成的Service类对象。 report_state()方法仅定义了接口。 periodic_tasks()则首先获取admin的上下文然后调用manager的periodic_tasks()方法运行。 很多其它详细内容请參考https://github.com/yeasy/tech_writing/blob/master/OpenStack/OpenStack%20Neutron%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%90.pdf 转载于:https://www.cnblogs.com/yxwkf/p/3870102.html