Rename counter_name to meter_name in alarm

In the newest ceilometer alarm version counter_name property was renamed to
meter_name. Right now heat uses old ceilometer client which still support
counter_name but newest ceilometer backend does not.

Change-Id: Ie7876119dc9b2a80d862f10de5f7265ad2a059f0
Closes-Bug: #1222830
This commit is contained in:
Bartosz Górski 2013-09-16 08:24:38 -07:00 committed by Gerrit Code Review
parent 637181bf3c
commit 7afd1f4285
5 changed files with 14 additions and 14 deletions

View File

@ -63,7 +63,7 @@ Resources:
Properties:
description:
Ref: AlarmDescription
counter_name:
meter_name:
Ref: MetricName
period:
Ref: Period

View File

@ -33,10 +33,10 @@ class CeilometerAlarm(resource.Resource):
'Required': True,
'Description': _('Number of periods to evaluate over')
},
'counter_name': {
'meter_name': {
'Type': 'String',
'Required': True,
'Description': _('Counter name watched by the alarm')
'Description': _('Meter name watched by the alarm')
},
'period': {
'Type': 'String',
@ -47,7 +47,7 @@ class CeilometerAlarm(resource.Resource):
'Type': 'String',
'Required': True,
'AllowedValues': ['count', 'avg', 'sum', 'min', 'max'],
'Description': _('Counter statistic to evaluate')
'Description': _('Meter statistic to evaluate')
},
'threshold': {
'Type': 'String',
@ -89,8 +89,8 @@ class CeilometerAlarm(resource.Resource):
},
'matching_metadata': {
'Type': 'Map',
'Description': _('Counter should match this resource metadata '
'(key=value) additionally to the counter_name')
'Description': _('Meter should match this resource metadata '
'(key=value) additionally to the meter_name')
}
}

View File

@ -268,14 +268,14 @@ class WatchRule(object):
from heat.engine import clients
clients = clients.Clients(self.context)
sample = {}
sample['counter_type'] = 'gauge'
sample['meter_type'] = 'gauge'
for k, d in iter(data.items()):
if k == 'Namespace':
continue
sample['counter_name'] = k
sample['counter_volume'] = d['Value']
sample['counter_unit'] = d['Unit']
sample['meter_name'] = k
sample['sample_volume'] = d['Value']
sample['meter_unit'] = d['Unit']
dims = d.get('Dimensions', {})
if isinstance(dims, list):
dims = dims[0]
@ -357,7 +357,7 @@ def rule_can_use_sample(wr, stats_data):
if wr.state == WatchRule.SUSPENDED:
return False
if wr.state == WatchRule.CEILOMETER_CONTROLLED:
metric = wr.rule['counter_name']
metric = wr.rule['meter_name']
rule_dims = {}
for k, v in iter(wr.rule.get('matching_metadata', {}).items()):
name = k.split('.')[-1]

View File

@ -46,7 +46,7 @@ alarm_template = '''
"Type": "OS::Ceilometer::Alarm",
"Properties": {
"description": "Scale-up if MEM > 50% for 1 minute",
"counter_name": "MemoryUtilization",
"meter_name": "MemoryUtilization",
"statistic": "avg",
"period": "60",
"evaluation_periods": "1",
@ -187,7 +187,7 @@ class CeilometerAlarmTest(HeatTestCase):
rsrc = self.stack['MEMAlarmHigh']
snippet = copy.deepcopy(rsrc.parsed_template())
snippet['Properties']['counter_name'] = 'temp'
snippet['Properties']['meter_name'] = 'temp'
updater = scheduler.TaskRunner(rsrc.update, snippet)
self.assertRaises(resource.UpdateReplace, updater)

View File

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