Fix 400 on /v1/storage/dataframes

Change-Id: I3bd072964d293ab36410691e840998e31a98da10
Task: 14322
Story: 2001868
This commit is contained in:
Luka Peschke
2018-04-17 14:49:34 +02:00
committed by Martin CAMEY
parent f21c49cf4b
commit cda666d04c

View File

@@ -18,30 +18,26 @@
import decimal import decimal
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log
from wsme import types as wtypes from wsme import types as wtypes
from cloudkitty.api.v1 import types as cktypes from cloudkitty.api.v1 import types as cktypes
from cloudkitty import utils as ck_utils from cloudkitty import utils as ck_utils
LOG = log.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF
METRICS_CONF = ck_utils.get_metrics_conf(CONF.collect.metrics_conf) METRICS_CONF = ck_utils.get_metrics_conf(CONF.collect.metrics_conf)
try: try:
services_names = list(METRICS_CONF['services_objects'].keys()) SERVICE_NAMES = list(METRICS_CONF['metrics'].keys())
except Exception: except KeyError:
# TODO(mc): remove this hack once rated dataframes are based on metrics. LOG.error("No metrics specified in YAML configuration, "
services_names = [ "CloudKitty won't work as expected")
'compute', SERVICE_NAMES = ['compute', 'image']
'volume',
'image',
'network.bw.in',
'network.bw.out',
'network.floating',
'radosgw.usage',
]
CLOUDKITTY_SERVICES = wtypes.Enum(wtypes.text, *services_names) CLOUDKITTY_SERVICES = wtypes.Enum(wtypes.text, *SERVICE_NAMES)
class CloudkittyResource(wtypes.Base): class CloudkittyResource(wtypes.Base):