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:
parent
637181bf3c
commit
7afd1f4285
|
@ -63,7 +63,7 @@ Resources:
|
||||||
Properties:
|
Properties:
|
||||||
description:
|
description:
|
||||||
Ref: AlarmDescription
|
Ref: AlarmDescription
|
||||||
counter_name:
|
meter_name:
|
||||||
Ref: MetricName
|
Ref: MetricName
|
||||||
period:
|
period:
|
||||||
Ref: Period
|
Ref: Period
|
||||||
|
|
|
@ -33,10 +33,10 @@ class CeilometerAlarm(resource.Resource):
|
||||||
'Required': True,
|
'Required': True,
|
||||||
'Description': _('Number of periods to evaluate over')
|
'Description': _('Number of periods to evaluate over')
|
||||||
},
|
},
|
||||||
'counter_name': {
|
'meter_name': {
|
||||||
'Type': 'String',
|
'Type': 'String',
|
||||||
'Required': True,
|
'Required': True,
|
||||||
'Description': _('Counter name watched by the alarm')
|
'Description': _('Meter name watched by the alarm')
|
||||||
},
|
},
|
||||||
'period': {
|
'period': {
|
||||||
'Type': 'String',
|
'Type': 'String',
|
||||||
|
@ -47,7 +47,7 @@ class CeilometerAlarm(resource.Resource):
|
||||||
'Type': 'String',
|
'Type': 'String',
|
||||||
'Required': True,
|
'Required': True,
|
||||||
'AllowedValues': ['count', 'avg', 'sum', 'min', 'max'],
|
'AllowedValues': ['count', 'avg', 'sum', 'min', 'max'],
|
||||||
'Description': _('Counter statistic to evaluate')
|
'Description': _('Meter statistic to evaluate')
|
||||||
},
|
},
|
||||||
'threshold': {
|
'threshold': {
|
||||||
'Type': 'String',
|
'Type': 'String',
|
||||||
|
@ -89,8 +89,8 @@ class CeilometerAlarm(resource.Resource):
|
||||||
},
|
},
|
||||||
'matching_metadata': {
|
'matching_metadata': {
|
||||||
'Type': 'Map',
|
'Type': 'Map',
|
||||||
'Description': _('Counter should match this resource metadata '
|
'Description': _('Meter should match this resource metadata '
|
||||||
'(key=value) additionally to the counter_name')
|
'(key=value) additionally to the meter_name')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,14 +268,14 @@ class WatchRule(object):
|
||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
clients = clients.Clients(self.context)
|
clients = clients.Clients(self.context)
|
||||||
sample = {}
|
sample = {}
|
||||||
sample['counter_type'] = 'gauge'
|
sample['meter_type'] = 'gauge'
|
||||||
|
|
||||||
for k, d in iter(data.items()):
|
for k, d in iter(data.items()):
|
||||||
if k == 'Namespace':
|
if k == 'Namespace':
|
||||||
continue
|
continue
|
||||||
sample['counter_name'] = k
|
sample['meter_name'] = k
|
||||||
sample['counter_volume'] = d['Value']
|
sample['sample_volume'] = d['Value']
|
||||||
sample['counter_unit'] = d['Unit']
|
sample['meter_unit'] = d['Unit']
|
||||||
dims = d.get('Dimensions', {})
|
dims = d.get('Dimensions', {})
|
||||||
if isinstance(dims, list):
|
if isinstance(dims, list):
|
||||||
dims = dims[0]
|
dims = dims[0]
|
||||||
|
@ -357,7 +357,7 @@ def rule_can_use_sample(wr, stats_data):
|
||||||
if wr.state == WatchRule.SUSPENDED:
|
if wr.state == WatchRule.SUSPENDED:
|
||||||
return False
|
return False
|
||||||
if wr.state == WatchRule.CEILOMETER_CONTROLLED:
|
if wr.state == WatchRule.CEILOMETER_CONTROLLED:
|
||||||
metric = wr.rule['counter_name']
|
metric = wr.rule['meter_name']
|
||||||
rule_dims = {}
|
rule_dims = {}
|
||||||
for k, v in iter(wr.rule.get('matching_metadata', {}).items()):
|
for k, v in iter(wr.rule.get('matching_metadata', {}).items()):
|
||||||
name = k.split('.')[-1]
|
name = k.split('.')[-1]
|
||||||
|
|
|
@ -46,7 +46,7 @@ alarm_template = '''
|
||||||
"Type": "OS::Ceilometer::Alarm",
|
"Type": "OS::Ceilometer::Alarm",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"description": "Scale-up if MEM > 50% for 1 minute",
|
"description": "Scale-up if MEM > 50% for 1 minute",
|
||||||
"counter_name": "MemoryUtilization",
|
"meter_name": "MemoryUtilization",
|
||||||
"statistic": "avg",
|
"statistic": "avg",
|
||||||
"period": "60",
|
"period": "60",
|
||||||
"evaluation_periods": "1",
|
"evaluation_periods": "1",
|
||||||
|
@ -187,7 +187,7 @@ class CeilometerAlarmTest(HeatTestCase):
|
||||||
rsrc = self.stack['MEMAlarmHigh']
|
rsrc = self.stack['MEMAlarmHigh']
|
||||||
|
|
||||||
snippet = copy.deepcopy(rsrc.parsed_template())
|
snippet = copy.deepcopy(rsrc.parsed_template())
|
||||||
snippet['Properties']['counter_name'] = 'temp'
|
snippet['Properties']['meter_name'] = 'temp'
|
||||||
|
|
||||||
updater = scheduler.TaskRunner(rsrc.update, snippet)
|
updater = scheduler.TaskRunner(rsrc.update, snippet)
|
||||||
self.assertRaises(resource.UpdateReplace, updater)
|
self.assertRaises(resource.UpdateReplace, updater)
|
||||||
|
|
|
@ -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.3
|
python-ceilometerclient>=1.0.5
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue