支持事件触发告警和基于告警类型策略的VDU自动修复¶
本提案旨在支持通过VDU状态变更事件触发VDU自动修复。
问题描述¶
目前Tacker支持通过监控(例如ping)触发VDU自动修复。然而,有些系统需要通过资源状态变更等事件触发修复。一个用例是由于硬件故障导致的修复,故障管理场景在NFV中有所讨论。(例如:OPNFV doctor的故障管理场景 [1])
在这种情况下,应该由VDU状态变更触发修复,但当前Tacker无法实现。
提议的变更¶
我们的计划是添加一个新的策略 tosca.policies.tacker.EventAlarming 并通过事件告警触发启用VDU自动修复。新的策略定义监控资源状态以评估资源的事件并调用操作。
总体工作流程如下
+----------------------------+ +---------------------------------------+
| Aodh | | Tosca_alarm_template.yaml |
| | | (tosca.policies.tacker.EventAlarming) |
| +------------------+ | (Create +--------------+------------------------+
| | | | EvantAlarm) |
| | Alarm API |<---|------------+ |
| | | | | +---------------------v-------------------------+
| +------------------+ | | | Tacker |
| | | | |
| | | | +---------------------------------------+ |
| +------------------+ | | | | VNFM | |
| | | | | | | | |
| | Alarm | | | | | +---------------+ | |
| | Evaluator | | +--|---|------------| | | |
| | / Notifier | | | | | Alarm Monitor | | |
| | |----|---------------|---|----------->| | | |
| +------^-^----^----+ | | | +---------------+ | |
| | | | | | | | |
| | | | | | | | |
| | | | | | +---------------------------------------+ |
+----------------------------+ +-----------------------------------------------+
| | |
| | |
+------------------------------------------------+
| Notification bus |
+------------------------------------------------+
| | |
| | | (Event Norification)
| | |
+------------------------------------------------+
| OpenStack Services |
| (Nova, Neutron, Cinder, ...) |
| |
+-----------^-^----^-----------------------------+
| | |
| | |
| | |
| | +-----------------------------------+
| +-------------------+ |
| | |
| | |
+-----------v------------------------------------------------------------------------------+
| | NFVI | |
| +--------------------------------------------------------------------------------------+ |
| | | VNF | | |
| | +-----------------------------v---------+ +-------v-------------------------------+ | |
| | | VDU | | VDU | | |
| | | | | | | |
| | +---------------------------------------+ +---------------------------------------+ | |
| +--------------------------------------------------------------------------------------+ |
+------------------------------------------------------------------------------------------+
添加策略
tosca.policies.tacker.EventAlarming
将一个新的告警监控策略 tosca.policies.tacker.EventAlarming 添加到VNFD定义中。该策略被转换为事件告警定义,用于在HOT中监控资源的事件并触发操作。
TOSCA 方案可以定义如下
tosca.policies.tacker.EventAlarming
tosca.policies.tacker.EventAlarming:
derived_from: tosca.policies.Monitoring
triggers:
aodh_event:
event_type:
type: map
entry_schema:
type: string
required: true
condition:
type: map
entry_schema:
type: string
required: false
action:
type: list
entry_schema:
type: string
required: true
metadata:
type: string
required: true
以及示例TOSCA模板策略
description: Demo example
metadata:
template_name: sample-tosca-vnfd
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.VDU.Tacker
capabilities:
nfv_compute:
properties:
disk_size: 1 GB
mem_size: 256 MB
num_cpus: 1
properties:
image: cirros-0.4.0-x86_64-disk
mgmt_driver: noop
availability_zone: nova
metadata: {metering.server_group: VDU1}
CP1:
type: tosca.nodes.nfv.CP.Tacker
properties:
management: true
anti_spoofing_protection: false
requirements:
- virtualLink:
node: VL1
- virtualBinding:
node: VDU1
VL1:
type: tosca.nodes.nfv.VL
properties:
network_name: net_mgmt
vendor: Tacker
policies:
- vdu1_event_monitoring_policy:
type: tosca.policies.tacker.EventAlarming
triggers:
vdu1_event_healing:
description: VM delete
event_type:
type: compute.instance.delete.end
implementation: ceilometer
condition:
resource_type: instance
metadata: VDU1
action: [vdu_autoheal]
事件告警监控资源的HOT模板
description: 'Demo example'
heat_template_version: '2013-05-23'
outputs:
mgmt_ip-VDU1:
value:
get_attr:
- CP1
- fixed_ips
- 0
- ip_address
parameters: {}
resources:
CP1:
properties:
network: net_mgmt
port_security_enabled: false
type: OS::Neutron::Port
VDU1:
properties:
availability_zone: nova
config_drive: false
flavor:
get_resource: VDU1_flavor
image: cirros-0.4.0-x86_64-disk
metadata:
metering.server_group: VDU1-08aa3827-0
networks:
- port:
get_resource: CP1
user_data_format: SOFTWARE_CONFIG
type: OS::Nova::Server
vdu1_event_healing:
properties:
alarm_actions:
- http://{tacker domain url}:9890/v1.0/vnfs/{vnf id}/vdu1_event_healing/vdu_autoheal/hc4vg2c0
description: VM delete
event_type: compute.instance.delete.end
query:
- field: traits.instance_id
op: eq
value:
get_resource: VDU1
repeat_actions: true
type: OS::Aodh::EventAlarm
此外,只有当event_type为compute.instance.update时,才能在TOSCA模板上定义condition的状态。
这是当event_type为compute.instance.update且状态已定义时的示例TOSCA模板。
policies:
- vdu1_event_monitoring_policy:
type: tosca.policies.tacker.EventAlarming
triggers:
vdu1_event_error_healing:
description: VM state is updated to error
event_type:
type: compute.instance.update
implementation: ceilometer
condition:
resource_type: instance
state: error
metadata: VDU1
action: [vdu_autoheal]
此TOSCA模板更改为以下HOT
vdu1_event_error_healing:
properties:
alarm_actions:
- http://{tacker domain url}:9890/v1.0/vnfs/{vnf id}/vdu1_event_error_healing/vdu_autoheal/hc4vg2c0
description: VM state is updated to error
event_type: compute.instance.update
query:
- field: traits.instance_id
op: eq
value:
get_resource: VDU1
- field: traits.state
op: eq
value: error
repeat_actions: true
type: OS::Aodh::EventAlarm
通过告警监控和事件监控启用VDU自动修复
通过告警监控和事件告警监控启用VDU自动修复。此计划将VDU自动修复添加到默认告警操作中。该操作VDU自动修复需要修复目标的名称(例如VDU1)。修复目标通过告警监控策略的触发器的元数据 [2] 获取。
备选方案¶
无
数据模型影响¶
无
REST API 影响¶
无
安全影响¶
无
通知影响¶
无
其他最终用户影响¶
无
性能影响¶
无
其他部署者影响¶
无
开发人员影响¶
无
实现¶
负责人¶
工作项¶
Tosca元素模型监控事件到Heat ceilometer监控元素转换
创建一个示例TOSCA模板
添加 tosca.policies.tacker.EventAlarming 策略以监控特定事件。
在默认告警监控操作中添加VDU自动修复
从tosca模板获取VDU名称以使用vdu_autoheal
单元测试
功能测试
Update documentation
依赖项¶
无
测试¶
单元和功能测试足以测试 tosca.policies.tacker.EventAlarming 策略。
单元和功能测试足以测试通过告警监控策略的 vdu_autohealing 操作。
文档影响¶
在samples目录下添加VNFD tosca-template,以展示如何配置
tosca.policies.tacker.EventAlarming策略。在Tacker告警监控框架中添加一个新的策略
tosca.policies.tacker.EventAlarming[3]。