我是靠谱客的博主 大力鱼,最近开发中收集的这篇文章主要介绍OpenStack Notification System介绍,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

补充一个OpenStack Wiki中的架构图


    OpenStack给用户提供了一个通用的接口,Nova可以通过多种途径将instance变化的消息在用户或者管理员操作的时候发送出来或者记录到log中,并且从rabbitMQ中可以利用特定的topic来过滤想要的消息。

具体的配置如下:

1.修改 nova/openstack/common/notifier/api.py中的'notification_driver'的属性'nova.openstack.common.notifier'
    公有以下几种属性
    no_op_notifier 不做任何操作
    log_notifier 记录到日志中
    rabbit_notifier 发送到rabbitMQ的notification队列中
2.修改 nova/notification.py
    对于通知的内容,openstack提供了几种选择以适应不同用户的需求,其中有vm_state(instance运行状态)、vm_and_task_state(instance及task运行状态)、all(所有关于instance变化的信息)
    具体说明如下:
notify_state_opt = cfg.StrOpt('notify_on_state_change', default="vm_and_task_state",
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.')
notify_any_opt = cfg.BoolOpt('notify_on_any_change', default=False,
help='If set, send compute.instance.update notifications on instance '
'state changes. Valid values are False for no notifications, '
'True for notifications on any instance changes.')
3.以下是所有关于instance的notification信息
compute.instance.create.start/.end:
compute.instance.delete.start/.end:
compute.instance.rebuild.start/.end:
compute.instance.resize.prep.start/.end:
compute.instance.resize.confirm.start/.end:
compute.instance.resize.revert.start/.end:
compute.instance.exists:
compute.instance.update:
compute.instance.shutdown.start/.end
compute.instance.power_off.start/.end
compute.instance.power_on.start/.end
compute.instance.snapshot.start/.end
compute.instance.resize.start/.end
compute.instance.finish_resize.start/.end
    这里有一个compute.instance.delete.end json notification 信息,是从rabbitMQ的queue里面获得的。
{
"_context_roles": [
"admin"
],
……
"timestamp": "2012-08-28 16:32:07.952953",
"_context_auth_token": "5de0c5c684114c54a489e9ddd61c24ce",
"_context_instance_lock_checked": true,
"_context_user_id": "ef06d77b48174683be8a5bd0101b88db",
"payload": {
"state_description": "",
"availability_zone": null,
"ephemeral_gb": 0,
"instance_type_id": 3,
"deleted_at": "2012-08-28 16:32:07.785963",
"reservation_id": "r-0n0p0dmd",
"instance_id": "9452fa86-e244-4455-a484-62fd036e3851",
"user_id": "ef06d77b48174683be8a5bd0101b88db",
"state": "deleted",
"launched_at": "",
"ramdisk_id": "",
"access_ip_v6": null,
"disk_gb": 80,
"access_ip_v4": null,
"kernel_id": "",
"host": "ubuntu",
"display_name": "12312312312321312",
"image_ref_url": "http://127.0.0.1:9292/images/556626ed-8a16-4dab-8043-01ec1de1a1c0",
"root_gb": 80,
"tenant_id": "a4778aa43f6d43c28774fb801657467a",
"created_at": "2012-08-28 16:24:10",
"memory_mb": 8192,
"instance_type": "m1.large",
"vcpus": 4,
"image_meta": {},
"architecture": null,
"os_type": null
},
"_context_project_name": "admin",
"_context_read_deleted": "no",
"priority": "INFO",
"_context_is_admin": true,
"_context_project_id": "a4778aa43f6d43c28774fb801657467a",
"_context_timestamp": "2012-08-28T16:32:06.348763",
"_context_user_name": "admin",
"publisher_id": "compute.ubuntu",
"message_id": "2969e38a-af19-472b-a895-d024b12883a4",
"_context_remote_address": "127.0.0.1"}

最后

以上就是大力鱼为你收集整理的OpenStack Notification System介绍的全部内容,希望文章能够帮你解决OpenStack Notification System介绍所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部