1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 vi_base = "/var/lib/config-data/puppet-generated/vitrage"
13 if not os.path.isdir(vi_base):
15 vitrage_template_file = \
16 vi_base + '/etc/vitrage/templates/vitrage_host_down_scenarios.yaml'
20 name: host_down_scenarios
21 description: scenarios triggered by Doctor monitor 'compute.host.down' alarm
26 name: compute.host.down
27 template_id: host_down_alarm
32 template_id: instance_alarm
43 source: host_down_alarm
46 template_id : host_down_alarm_on_host
49 relationship_type: contains
51 template_id : host_contains_instance
53 source: instance_alarm
56 template_id : alarm_on_instance
59 condition: host_down_alarm_on_host
62 action_type: set_state
68 action_type: mark_down
72 condition: host_down_alarm_on_host and host_contains_instance
75 action_type: raise_alarm
79 alarm_name: Instance Down
82 condition: host_down_alarm_on_host and host_contains_instance and alarm_on_instance
85 action_type: add_causal_relationship
87 source: host_down_alarm
88 target: instance_alarm
90 action_type: mark_down
96 def set_vitrage_host_down_template():
97 if os.path.isfile(vitrage_template_file):
98 print('Vitrage host_down template file: %s already exists.'
99 % vitrage_template_file)
101 print('Create Vitrage host_down template file:%s.'
102 % vitrage_template_file)
103 with open(vitrage_template_file, 'w') as file: