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. 20155306 2016-2017-2 《Java程序设计》第七周学习总结

    20155306 2016-2017-2 <Java程序设计>第七周学习总结 教材学习内容总结 第十三章 时间与日期 三种时间: 格林威治标准时间(GMT)的正午是太阳抵达天空最高点之时, ...

  2. 一个MMORPG的常规技能系统

    广义的的说,和战斗结算相关的内容都算技能系统,包括技能信息管理.技能调用接口.技能目标查找.技能表现.技能结算.技能创生体(buff/法术场/弹道)管理,此外还涉及的模块包括:AI模块(技能调用者). ...

  3. 50、多线程创建的三种方式之实现Runnable接口

    实现Runnable接口创建线程 使用Runnable创建线程步骤: package com.sutaoyu.Thread; //1.自定义一个类实现java.lang包下的Runnable接口 cl ...

  4. php strcmp()函数

    <? $str = "LAMP"; $str1 = "LAMPBrother"; $strc = strcmp($str,$str1); switch ( ...

  5. 【译】第三篇 Integration Services:增量加载-Adding Rows

    本篇文章是Integration Services系列的第三篇,详细内容请参考原文. 增量加载是什么增量加载仅加载与先前加载差异的.差异包括:->新增的行->更新的行->删除的行通过 ...

  6. python基础===一行 Python 代码实现并行(转)

    原文:https://medium.com/building-things-on-the-internet/40e9b2b36148 译文:https://segmentfault.com/a/119 ...

  7. 乐视mysql面试题【转】

    最近,朋友去乐视面试了mysql DBA,以下是我据整理的乐视mysql面试题答案,供大家参考 1. MYISAM和INNODB的不同?答:主要有以下几点区别:   a)构造上的区别     MyIS ...

  8. setInterval做定时器

    <script src="/js/jquery-1.8.3.min.js"></script> <script> $(function () { ...

  9. HttpClient使用

    1.HttpClient 是 Apache Jakarta Common 下的子项目,可以用来提供高效的.最新的.功能丰富的支持 HTTP 协议的客户端编程工具包 2.主要的功能 (1)实现了所有 H ...

  10. ArcMap2SLD使用

    1.首先打开ArcMap,加载一副mxd地图: 2.打开ArcGIS2SLD,如下图所示: 3.选择样式文件的保存形式,一副mxd地图可能有多个图层,选中In Separate Dateien/In ...