1 compute.instance.update类型的消息

需要配置notify_on_state_change参数,可以为空,或者vm_state,或者vm_and_task_state,

当虚拟机的状态或者task状态发送变化时发送消息:
    cfg.StrOpt('notify_on_state_change',
        help='If set, send
compute.instance.update notifications on instance '
             'state
changes.  Valid values are None for no notifications, '
            
'"vm_state" for notifications on VM state changes, or '
            
'"vm_and_task_state" for notifications on VM and task state '
            
'changes.'),

默认为空,即不发送。

发送函数为:notification.send_update:

def send_update(context, old_instance, new_instance, service="compute",host=None):

    """Send compute.instance.update notification to report any changes occurred

    in that instance

"""

主要用在nova/object/instance.py的save函数中,当instance发送改变需要写入DB时调用。

在nova/compute/api.py 的_provision_instances中在创建instance时也会调用send_update_with_states发送。

  • 发送函数最后都是调用

    def _send_instance_update_notification中的
    rpc.get_notifier(service, host).info(context,
    'compute.instance.update', payload)

消息格式:

tenant_id: Tenant ID that owns the this instance (string)

user_id: User ID that owns this instance (string)
instance_id: Nova instance ID of this instance (string)
instance_type: Name of the instance type ('flavor') of this instance. (string)
instance_type_id: Nova ID for instance type ('flavor') of this instance. (string)
display_name: User selected display name for instance.
created_at: Timestamp for when this instance's record was created in Nova (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
launched_at: Timestamp for when this instance was last launched by hypervisor. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
image_ref_url: Image URL (from Glance) that this instance was created from. (string)
image_metadata: array of key-value pairs representing the metadata from the image from which the instance was built (array)
audit_period_begining: Timestamp of beginning of audit period. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
audit_period_ending: Timestamp of end of audit period. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
bandwidth: Hash listing bandwidth used for each network this instance is connected to. Keys will be network labels, values will be hashes containing the keys 'bw_in', and 'bw_out', listing the incoming, and outgoing bandwith, respectively, used by that instance, on that network, for that audit period. Bandwith is reported in bytes.
old_state: Prior state of instance. (string, such as 'active' or 'deleted')
state: Current state of instance. (string, such as 'active' or 'deleted')
state_description: Additional human readable description of current state of instance.
fixed_ips: list of ip addresses formatted like [{"floating_ips": [], "meta": {}, "type": "fixed", "version": 4, "address": "10.0.0.9", "label": "public"}] assigned to instance.
memory_mb: memory allocation for this instance (in mb)
disk_gb: disk allocation for this instance (in gb)

2. api_faults

需要配置notify_api_faults,默认为False。

cfg.BoolOpt('notify_api_faults', default=False,
        help='If set, send api.fault
notifications on caught exceptions '
             'in
the API service.'),

当api调用失败,在异常处理中发送。
用在send_api_fault
    rpc.get_notifier('api').error(common_context.get_current()
or
                                 
nova.context.get_admin_context(),
                                 
'api.fault',
                                 
payload)
publish ID:'api'
类型:'api.fault'

用在nova/api/openstack/__init__.py:作为一个FaultWrapper的中间件
配置在etc/nova/api-paste.ini:paste.filter_factory
= nova.api.openstack:FaultWrapper.factory
3. compute.instance*

nova/compute/utils.py
发送函数:def notify_about_instance_usage
method(context, 'compute.instance.%s' % event_suffix, usage_info)
param event_suffix: Event type like "delete.start" or "exists

被waper在:    
def _notify_about_instance_usage(self, context, instance, event_suffix,
                                    
network_info=None, system_metadata=None,
                                    
extra_usage_info=None, fault=None):
       
compute_utils.notify_about_instance_usage(
           
self.notifier, context, instance, event_suffix,
           
network_info=network_info,
           
system_metadata=system_metadata,
           
extra_usage_info=extra_usage_info, fault=fault)
主要用在nova/compute/manager.py,还有def _build_and_run_instance:
self._notify_about_instance_usage(context, instance, 'create.start',
比如:event_type':
u'compute.instance.reboot.start
compute.instance.create.start
compute.instance.exists
compute.instance.create.end

格式为:

compute.instance.rebuild.start/.end:

Usage notification upon rebuild of instance.
tenant_id: Tenant ID that owns the this instance (string)
user_id: User ID that owns this instance (string)
instance_id: Nova instance ID of this instance (string)
instance_type: Name of the instance type ('flavor') of this instance. (string)
instance_type_id: Nova ID for instance type ('flavor') of this instance. (string)
display_name: User selected display name for instance.
created_at: Timestamp for when this instance's record was created in Nova (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
launched_at: Timestamp for when this instance was last launched by hypervisor. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
image_ref_url: Image URL (from Glance) that this instance is being rebuilt from. (string)
state: Current state of instance. (string, such as 'active' or 'deleted')
state_description: Additional human readable description of current state of instance.
fixed_ips: list of ip addresses formatted like [{"floating_ips": [], "meta": {}, "type": "fixed", "version": 4, "address": "10.0.0.9", "label": "public"}] assigned to instance.
memory_mb: memory allocation for this instance (in mb)
disk_gb: disk allocation for this instance (in gb)

其中compute.instance.exists用来做audit

https://wiki.openstack.org/wiki/NotificationEventExamples

格式为:

compute.instance.exists:

There is no .start/.end event for this activity ... just the 'compute.instance.exists' event.

Periodic usage notification generated by the instance-usage-audit cron job. These usages are generated for each instance that was active during the specified audit period.
tenant_id: Tenant ID that owns the this instance (string)
user_id: User ID that owns this instance (string)
instance_id: Nova instance ID of this instance (string)
instance_type: Name of the instance type ('flavor') of this instance. (string)
instance_type_id: Nova ID for instance type ('flavor') of this instance. (string)
display_name: User selected display name for instance.
created_at: Timestamp for when this instance's record was created in Nova (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
launched_at: Timestamp for when this instance was last launched by hypervisor. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
image_ref_url: Image URL (from Glance) that this instance was created from. (string)
image_meta: Dictionary of key-value pairs representing metadata from the image the instance was built from.
audit_period_begining: Timestamp of beginning of audit period. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
audit_period_ending: Timestamp of end of audit period. (string, formatted "YYYY-MM-DD hh:mm:ss.ssssss")
bandwidth: Hash listing bandwidth used for each network this instance is connected to. Keys will be network labels, values will be hashes containing the keys 'bw_in', and 'bw_out', listing the incoming, and outgoing bandwith, respectively, used by that instance, on that network, for that audit period. Bandwith is reported in bytes.
state: Current state of instance. (string, such as 'active' or 'deleted')
state_description: Additional human readable description of current state of instance.
fixed_ips: list of ip addresses formatted like [{"floating_ips": [], "meta": {}, "type": "fixed", "version": 4, "address": "10.0.0.9", "label": "public"}] assigned to instance.
memory_mb: memory allocation for this instance (in mb)
disk_gb: disk allocation for this instance (in gb) 

https://wiki.openstack.org/wiki/SystemUsageData

https://review.openstack.org/#/c/224755/

nova notification的更多相关文章

  1. Neutron 理解(5):Neutron 是如何向 Nova 虚机分配固定IP地址的 (How Neutron Allocates Fixed IPs to Nova Instance)

    学习 Neutron 系列文章: (1)Neutron 所实现的虚拟化网络 (2)Neutron OpenvSwitch + VLAN 虚拟网络 (3)Neutron OpenvSwitch + GR ...

  2. Android Notification 详解(一)——基本操作

    Android Notification 详解(一)--基本操作 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:AndroidDemo/Notification 文中如有纰 ...

  3. Android Notification 详解——基本操作

    Android Notification 详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 前几天项目中有用到 Android 通知相关的内容,索性把 Android Notificatio ...

  4. android Notification介绍

    如果要添加一个Notification,可以按照以下几个步骤 1:获取NotificationManager: NotificationManager m_NotificationManager=(N ...

  5. Android种使用Notification实现通知管理以及自定义通知栏(Notification示例四)

    示例一:实现通知栏管理 当针对相同类型的事件多次发出通知,作为开发者,应该避免使用全新的通知,这时就应该考虑更新之前通知栏的一些值来达到提醒用户的目的.例如我们手机的短信系统,当不断有新消息传来时,我 ...

  6. Missing Push Notification Entitlement 问题

    最近打包上传是遇到一个问题: 描述: Missing Push Notification Entitlement - Your app includes an API for Apple's Push ...

  7. 笔记:Memory Notification: Library Cache Object loaded into SGA

    笔记:Memory Notification: Library Cache Object loaded into SGA在警告日志中发现一些这样的警告信息:Mon Nov 21 14:24:22 20 ...

  8. Nova PhoneGap框架 第一章 前言

    Nova PhoneGap Framework诞生于2012年11月,从第一个版本的发布到现在,这个框架经历了多个项目的考验.一直以来我们也持续更新这个框架,使其不断完善.到现在,这个框架已比较稳定了 ...

  9. Nova PhoneGap框架 总结

    Nova PhoneGap Framework 是完全针对PhoneGap应用程序量身定做的,在这个框架下开发的应用程序很容易实现高质量的代码,很容易让程序拥有很好的性能和用户体验. 在经历了多个项目 ...

随机推荐

  1. EasyNVR智能云终端硬件与EasyNVR解决方案软件综合对比

    背景分析 互联网视频直播越来越成为当前视频直播的大势,对于传统的安防监控,一般都是局限于内网,无法成批量上云台.传统的海康和大华的平台虽然可以通过自身私有协议上云平台 集总管控,但是往往只是支持自身的 ...

  2. (转)IOS崩溃 异常处理(NSSetUncaughtExceptionHandler)

    iOS已发布应用中对异常信息捕获和处理 代码下载地址:http://download.csdn.net/detail/daiyelang/6740205 iOS开发中我们会遇到程序抛出异常退出的情况, ...

  3. 关于:before :after

    首先要明白一种思想:结构和样式分离. 结构和样式分离,就意味着:没有样式表,HTML文档也是一个完整的文档:没有样式表,也能正常阅读用HTML表达的所有内容.明白这种思想就能很好理解样式表中使用--- ...

  4. 基础篇-java开发

    开局必知 1.变量 在java中,以{}为作用域,所以就存在成员变量和局部变量之说 由于java是强类型语言,所以在申明变量的时候,必须指定类型 java里,一个变量有声明过程和初始化过程(也就是赋值 ...

  5. linux下安装mysql问题总结(一)mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql.pid ended

    linux下安装mysql数据库 linux版本:CentOS release 6.8 (Final) mysql版本:mysql-5.7.16-linux-glibc2.5-x86_64.tar.g ...

  6. /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15"" not found

    解决错误 呈现该错误的原因是当前的GCC版本中,没有GLIBCXX_3.4.15,须要安装更高版本. 我们可以输入:strings /usr/lib/libstdc++.so.6 | grep GLI ...

  7. Python API:openstack

    OpenStack 是一个越来越流行的.用于部署基础架构即服务 (IaaS) 云的开源解决方案.OpenStack 附带了一个仪表板 Web 应用程序,非常适合执行手动任务,比如启动单个虚拟机 (VM ...

  8. 常用MS-SQL写法整理

    这里整理日常会用到的一些写法,一些常规的group by,系统函数等用法不在这里做记录了,大家有什么好的写法也可以分享下 1 sql操作xml内容(sp_xml_preparedocument和ope ...

  9. offsetLeft与style.left的区别

    参考:http://www.cnblogs.com/woshilee/articles/1951457.html offsetLeft 获取的是相对于父对象的左边距 left 获取或设置相对于 具有定 ...

  10. Loadrunder脚本篇——Run-time Settings之Preferences

    打开Preferences设置对话框,这里提供了对运行时的参数选择设置 Enable Image and Text Check 开启图片和文本检查.允许用户在回放期间通过web_find(文本检测)或 ...