metadata:
 name: host_high_cpu_load_to_instance_cpu_suboptimal
definitions:
 entities:
  - entity:
     category: ALARM
     name: HOST_HIGH_CPU_LOAD
     template_id: alarm1
  - entity:
     category: ALARM
     name: VM_CPU_SUBOPTIMAL_PERFORMANCE
     template_id: alarm2
  - entity:
     category: RESOURCE
     type: nova.host
     template_id: host
  - entity:
     category: RESOURCE
     type: nova.instance
     template_id: instance
 relationships:
  - relationship:
     source: alarm1
     target: host
     relationship_type: on
     template_id : alarm_on_host
  - relationship:
     source: alarm2
     target: instance
     relationship_type: on
     template_id : alarm_on_instance
  - relationship:
     source: host
     target: instance
     relationship_type: contains
     template_id : host_contains_instance
scenarios:
 - scenario:
    condition: alarm_on_host and host_contains_instance
    actions:
     - action:
        action_type: raise_alarm
        properties:
         alarm_name: VM_CPU_SUBOPTIMAL_PERFORMANCE
         severity: critical
        action_target:
         target: instance
     - action:
        action_type: set_state
        properties:
         state: SUBOPTIMAL
        action_target:
         target: instance
 - scenario:
    condition: alarm_on_host and alarm_on_instance and host_contains_instance
    actions:
     - action:
        action_type: add_causal_relationship
        action_target:
         source: alarm1
         target: alarm2
