Add 'repeat_actions' property for OS::Ceilometer::Alarm

The default value is maintained : repeat_actions=False
Require python-ceilometerclient>=1.0.3

Fixes bug #1223347

Change-Id: I010b6555311e9e34b095d9216cf1c5873e244cc4
This commit is contained in:
Swann Croiset 2013-09-16 11:55:43 +02:00
parent b1f05b688c
commit f9e94b18a2
3 changed files with 14 additions and 3 deletions

View File

@ -78,6 +78,15 @@ class CeilometerAlarm(resource.Resource):
'Default': 'true', 'Default': 'true',
'Description': _('True if alarm evaluation/actioning is enabled') 'Description': _('True if alarm evaluation/actioning is enabled')
}, },
'repeat_actions': {
'Type': 'Boolean',
'Default': 'false',
'Description': _('True to trigger actions each time the threshold '
'is reached. '
'By default, actions are called when : '
'the threshold is reached AND the alarm\'s state '
'have changed')
},
'matching_metadata': { 'matching_metadata': {
'Type': 'Map', 'Type': 'Map',
'Description': _('Counter should match this resource metadata ' 'Description': _('Counter should match this resource metadata '
@ -93,12 +102,13 @@ class CeilometerAlarm(resource.Resource):
'evaluation_periods', 'period', 'statistic', 'evaluation_periods', 'period', 'statistic',
'alarm_actions', 'ok_actions', 'alarm_actions', 'ok_actions',
'insufficient_data_actions', 'threshold', 'insufficient_data_actions', 'threshold',
'enabled') 'enabled', 'repeat_actions')
def _actions_to_urls(self, props): def _actions_to_urls(self, props):
kwargs = {} kwargs = {}
for k, v in iter(props.items()): for k, v in iter(props.items()):
if k.endswith('_actions') and v is not None: if k in ['alarm_actions', 'ok_actions',
'insufficient_data_actions'] and v is not None:
kwargs[k] = [] kwargs[k] = []
for act in v: for act in v:
# if the action is a resource name # if the action is a resource name

View File

@ -157,6 +157,7 @@ class CeilometerAlarmTest(HeatTestCase):
snippet['Properties']['evaluation_periods'] = '2' snippet['Properties']['evaluation_periods'] = '2'
snippet['Properties']['period'] = '90' snippet['Properties']['period'] = '90'
snippet['Properties']['enabled'] = 'true' snippet['Properties']['enabled'] = 'true'
snippet['Properties']['repeat_actions'] = True
snippet['Properties']['statistic'] = 'max' snippet['Properties']['statistic'] = 'max'
snippet['Properties']['threshold'] = '39' snippet['Properties']['threshold'] = '39'
snippet['Properties']['insufficient_data_actions'] = [] snippet['Properties']['insufficient_data_actions'] = []

View File

@ -18,7 +18,7 @@ WebOb>=1.2.3,<1.3
python-keystoneclient>=0.3.2 python-keystoneclient>=0.3.2
python-swiftclient>=1.2 python-swiftclient>=1.2
python-neutronclient>=2.3.0,<3 python-neutronclient>=2.3.0,<3
python-ceilometerclient>=1.0.2 python-ceilometerclient>=1.0.3
python-cinderclient>=1.0.4 python-cinderclient>=1.0.4
PyYAML>=3.1.0 PyYAML>=3.1.0
paramiko>=1.8.0 paramiko>=1.8.0