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"}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值