个人blog:http://www.sskywatcher.com/blog
由sskywatcher翻译,转载请注明出处
目录
模块nova.notifications.objects.base
概述
与 OpenStack 的其他服务模块类似,Nova 使用 oslo.messaging 模块提供的 Notifier 类 项消息总线发出通知消息。 从一个通知消息的消费者角度来看,一个通知消息(notification) 包含两个部分:一个由 oslo.messaging 定义好的有固定结构格式的消息封皮(envelope )部分、 一个由通知消息的发出者服务定义的负载(payload)。消息封皮的格式如下所示:
{ "priority": <string, selected from a predefined list by the sender>, "event_type": <string, defined by the sender>, "timestamp": <string, the isotime of when the notification emitted>, "publisher_id": <string, defined by the sender>, "message_id": <uuid, generated by oslo>, "payload": <json serialized dict, defined by the sender> }
在本地环境中配置 nova 配置文件的一下部分,可以完全关闭 Notification 功能 :
[oslo_messaging_notifications] driver = noop
Nova 中有两种不同类型的通知 : 负载消息没有版本之分的经典的通知消息、支持多版本负载消息的通知消息。
不支持多版本的经典通知
Nova 的代码使用 nova.rpc.get_notifier 来获取已经配置好的 oslo.messaging Notifier 对象, 使用olso组件提供的Notifier 的成员方法来发送通知。 get_notifier 调用的参数以及 o