From 6e2f315a44b9a72322f8e59bbf228f79d73566ba Mon Sep 17 00:00:00 2001 From: Eoghan Glynn Date: Fri, 9 Aug 2013 09:42:53 +0000 Subject: [PATCH] Tolerance for modified ceilometer alarm notification Changes to the ceilometer alarm notification payload are proposed here: https://review.openstack.org/40955 https://review.openstack.org/41056 i.e. field names in the JSON payload are changed with: s/state/current/ s/alarm/alarm_id/ Tolerance is added to the autoscaling logic for the new field names. Change-Id: I19f36d9331b6f28a3195fb5012ea0b9ee274ade3 --- heat/engine/resources/autoscaling.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/heat/engine/resources/autoscaling.py b/heat/engine/resources/autoscaling.py index 54b15e05..270d27bd 100644 --- a/heat/engine/resources/autoscaling.py +++ b/heat/engine/resources/autoscaling.py @@ -396,7 +396,8 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin): def handle_signal(self, details=None): # ceilometer sends details like this: - # {u'state': u'alarm', u'reason': u'...'}) + # {u'alarm_id': ID, u'previous': u'ok', u'current': u'alarm', + # u'reason': u'...'}) # in this policy we currently assume that this gets called # only when there is an alarm. But the template writer can # put the policy in all the alarm notifiers (nodata, and ok). @@ -405,7 +406,8 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin): if details is None: alarm_state = 'alarm' else: - alarm_state = details.get('state', 'alarm').lower() + alarm_state = details.get('current', + details.get('state', 'alarm')).lower() logger.info('%s Alarm, new state %s' % (self.name, alarm_state)) -- 2.45.2