nova处理neutron发送过来的event事件。暂时追踪nova event部分代码

tail -f /var/log/nova/nova-api.log  下面就是一个事件  Creating event network-vif-plugged:

对代码不熟的话直接代码中的关键字

调用create方法

def create(self, req, body):

 if accepted_events:
'''
self.compute_api.external_instance_event 方法在这里===> /usr/lib/python2.7/site-packages/nova/compute/api.py 里面就是这个方法
def external_instance_event(self, context, instances, events):
'''
LOG.info(_LI(type(self.compute_api)))
self.compute_api.external_instance_event(
context, accepted_instances, accepted_events)
else:
msg = _('No instances found for any event')
raise webob.exc.HTTPNotFound(explanation=msg) # FIXME(cyeoh): This needs some infrastructure support so that
# we have a general way to do this
robj = wsgi.ResponseObject({'events': response_events})
robj._code = result
#LOG.info(_LI("=======>def create:"))
''' robj.obj对象中的内容,内容大概可以看出是跟某个vm有关的并且status字段是completed.
{'events': [{u'status': 'completed', u'tag': u'8e781f3d-1b9b-4e37-a699-ae7a122c89f0', u'name': u'network-vif-plugged', u'server_uuid': u'1013d789-735b-4047-878b-beda1809f6be', 'code': 200},
{u'status': 'completed', u'tag': u'd4e29058-4d6c-4a8a-9741-e59c8f986df2', u'name': u'network-vif-plugged', u'server_uuid': u'9cf6584f-2fa5-4aea-ac37-cc2bc152012a', 'code': 200}]}
'''
#LOG.info(_LI(":::::::>%s"%repr(robj.obj)))
return robj

改完后重启nova-api服务器,查看日志就能看出

继续上面代码self.compute_api.external_instance_event 去发送rpc调用

/usr/lib/python2.7/site-packages/nova/compute/api.py

for host in instances_by_host:
# TODO(salv-orlando): Handle exceptions raised by the rpc api layer
# in order to ensure that a failure in processing events on a host
# will not prevent processing events on other hosts #这里循环的host就是计算节点名字
LOG.info("host:%s"%repr(host)) '''
[InstanceExternalEvent(data=<?>,instance_uuid=327acc17-4495-4d30-94b4-7a3d5d2e0504,name='network-vif-plugged',status='completed',tag='7b03e150-be1e-4f19-89a9-534846abf955'), InstanceExternalEvent(data=<?>,instance_uuid=86cd3487-9664-4f5a-a3d7-30e2dfe7c3da,name='network-vif-plugged',status='completed',tag='9e1a2e3a-090e-405c-beca-de4baa18a02d'), InstanceExternalEvent(data=<?>,instance_uuid=5bf2966a-5323-4882-895e-da9bb0b61a03,name='network-vif-plugged',status='completed',tag='816ea553-e6bb-4975-bf44-1350f7737e34')]
状态完成
status='completed'
tag='816ea553-e6bb-4975-bf44-1350f7737e34' 计算节点上创建的虚拟机网卡名称如:tap816ea553-e6
'''
#打印内容是上面的注释,
LOG.info("events_by_host[host]:%s"%repr(events_by_host[host])) # compute_rpcapi ====> /usr/lib/python2.7/site-packages/nova/compute/rpcapi.py 下面有个external_instance_event方法
self.compute_rpcapi.external_instance_event(
context, instances_by_host[host], events_by_host[host],
host=host)

追踪self.compute_rpcapi.external_instance_event

 def external_instance_event(self, ctxt, instances, events, host=None):
LOG.info(_LI("external_instance_event::::::>rpcapi"))
#LOG.info(_LI("ctxt::%s"%repr(ctxt)))
#LOG.info("instances::%s"%repr(instances[0]))
#LOG.info(_LI("events::%s"%repr(events)))
#LOG.info(_LI("host::%s"%repr(host))) instance = instances[0]
cctxt = self.router.by_instance(ctxt, instance).prepare(
server=_compute_host(host, instance),
version='4.0') #ccxt.cast 异步方式,api调用的方法和传递的值
#self.compute_rpcapi.external_instance_event(
# context, instances_by_host[host], events_by_host[host],
# host=host) cctxt.cast(ctxt, 'external_instance_event', instances=instances,
events=events)

追踪到这里出现了一个问题这个方法  无法追踪下去了  external_instance_event  如果有大神看到指点小弟一下哈哈!!!

/usr/lib/python2.7/site-packages/nova/compute/manager.py  正常应该是这个文件下的

nova event的更多相关文章

  1. nova libvirt event

    nova中利用libvirt 事件来更新vm的DB中的power状态 https://wiki.openstack.org/wiki/ComputeDriverEvents Nova compute ...

  2. openstack-lanch an instance and nova compute log analysis

    1. how to launch an instance: [root@localhost ~(keystone_admin)]# nova flavor-list+----+-----------+ ...

  3. Openstack Ice-House 版本号说明--之中的一个 NOVA

    OpenStack Icehouse在4.17正式公布,看了下release note,发现改变不小,说明openstack还是在高速发展中,有不少新的特性增加,也有些小的剔除.以下就我所关注的项目做 ...

  4. nova相关操作的Request_Id的获取

    在分析nova的众多log文件时,如nova-api,nova-scheduler,nova-compute等,其中的request id是串联起整个flow的关键词. 而通过nova instanc ...

  5. nova状态同步

    服务初始化阶段 nova-compute服务启动时调用manager中的host初始化函数 self.manager.init_host() 在host初始化函数中完成如下操作: #初始化libvir ...

  6. thread.event说明

    Python中的threading.Event()操控多线程的过程有: - 定义事件:man_talk_event = threading.Event() - 创建线程,传入对应事件:t1 = thr ...

  7. nova network-vif-plugged 事件分析1

    在创建虚机过程中,nova-compute会调用wait_for_instance_event函数(nova/compute/manage.py)进行network-vif-plugged的事件等待, ...

  8. nova notification

    1 compute.instance.update类型的消息 需要配置notify_on_state_change参数,可以为空,或者vm_state,或者vm_and_task_state, 当虚拟 ...

  9. Nova中的系统状态分析

    系统状态 作者 孔令贤 Nova提供这么几个资源状态的查询. Service Nova中的service有两类,一类是所谓的control service,一类就是compute service.要想 ...

随机推荐

  1. hadoop启动步骤

    一.ssh的启动 ssh localhost二.hadoop的HDFS的格式化 bin/hadoop namenode -format三.hadoop的start-all.sh的启动 bin/tart ...

  2. 【leetcode 简单】 第一百零八题 找到所有数组中消失的数字

    给定一个范围在  1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次. 找到所有在 [1, n] 范围之间没有出现在数组中的数字. 您能在不 ...

  3. EOJ Monthly 2019.2 (based on February Selection) F.方差

    题目链接: https://acm.ecnu.edu.cn/contest/140/problem/F/ 题目: 思路: 因为方差是用来评估数据的离散程度的,因此最优的m个数一定是排序后连续的,所以我 ...

  4. hive笔记之row_number、rank、dense_rank

    hive中有三个与分组排序相关的分析函数(我起初也认为是窗口函数,后来看到手册里是把他们划到了Analytics functions下),row_number.rank.dense_rank,我一直傻 ...

  5. 事件,继承EventArgs带有参数的委托

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  6. Python之内建函数Map,Filter和Reduce

    Python进阶 map,filter, reduce是python常用的built-in function. 且常与lambda表达式一起用. 其中: map 形式:map(function_to_ ...

  7. ibm x3550m4 开启cpu高性能模式

    1.必须进bios里调整,和调整超线程一样,重启服务器按F1进bios界面,选择system settings 2.选择最大性能模式:Operating Modes>Choose Operati ...

  8. MongoDB中多表关联查询(

    1.使用aggregate 查看表数据 db.getCollection('reports').aggregate([ { $lookup: { from: "process", ...

  9. POJ 2195 Going Home(KM算法模板)

    题目链接:http://poj.org/problem?id=2195 题目大意: 给定一个N*M的地图,地图上有若干个man和house,且man与house的数量一致. man每移动一格需花费$1 ...

  10. hihoCoder #1190 : 连通性·四(点的双连通分量模板)

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho从约翰家回到学校时,网络所的老师又找到了小Hi和小Ho. 老师告诉小Hi和小Ho:之前的分组出了点问题,当服 ...