Enumerate the meter type in the API Meter class

This uses the counter definitions as this is how the db
is populated and thus will be consistent.

Change-Id: I145600822cb89e65dd515e5d2075f1c44cc0b087
This commit is contained in:
Angus Salkeld
2013-05-01 11:36:54 +10:00
parent 7dfd84690c
commit 4fb76509b1
2 changed files with 5 additions and 4 deletions

View File

@@ -40,9 +40,9 @@ from wsme import types as wtypes
from ceilometer.openstack.common import log
from ceilometer.openstack.common import timeutils
from ceilometer import counter
from ceilometer import storage
LOG = log.getLogger(__name__)
@@ -421,8 +421,9 @@ class Meter(_Base):
name = wtypes.text
"The unique name for the meter"
# FIXME(dhellmann): Make this an enum?
type = wtypes.text
type = wtypes.Enum(str, counter.TYPE_GAUGE,
counter.TYPE_CUMULATIVE,
counter.TYPE_DELTA)
"The meter type (see :ref:`measurements`)"
unit = wtypes.text

View File

@@ -97,7 +97,7 @@ class TestPipeline(base.TestCase):
self.test_counter = counter.Counter(
name='a',
type='test_type',
type=counter.TYPE_GAUGE,
volume=1,
unit='B',
user_id="test_user",