From 979113593920d4af34e57b61ddd428678da38c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Albert?= Date: Wed, 13 May 2015 23:29:19 +0200 Subject: [PATCH] Changed network bandwidth from B to MB Change-Id: I97fcfe6f0f5a9a7a7859058eae93b926579f3328 --- cloudkitty/collector/ceilometer.py | 5 +- contrib/ci/csv_writer.py | 144 ++++++++++++++--------------- 2 files changed, 75 insertions(+), 74 deletions(-) diff --git a/cloudkitty/collector/ceilometer.py b/cloudkitty/collector/ceilometer.py index 6bf2e642..b538717b 100644 --- a/cloudkitty/collector/ceilometer.py +++ b/cloudkitty/collector/ceilometer.py @@ -273,9 +273,10 @@ class CeilometerCollector(collector.BaseCollector): tap) tap = self._cacher.get_resource_detail('network.tap', tap_id) + tap_bw_mb = tap_stat.max / 1048576.0 bw_data.append(self.t_cloudkitty.format_item(tap, - 'B', - tap_stat.max)) + 'MB', + tap_bw_mb)) ck_res_name = 'network.bw.{}'.format(direction) if not bw_data: raise collector.NoDataCollected(self.collector_name, diff --git a/contrib/ci/csv_writer.py b/contrib/ci/csv_writer.py index e13619bf..88caa8ac 100755 --- a/contrib/ci/csv_writer.py +++ b/contrib/ci/csv_writer.py @@ -108,8 +108,8 @@ NETWORK_BW_OUT = { "type": "network.bw.out", "desc": {}, "vol": { - "qty": 4546.0, - "unit": "B"}} + "qty": 50.0, + "unit": "MB"}} NETWORK_BW_RESOURCE = { 'instance_id': 'eef9673d-5d24-43fd-89f5-2929acc7e193', @@ -411,88 +411,88 @@ class VolumeGenerator(BaseGenerator): class NetBWVolMapper(VolumeVariationMapper): var_map = { 'mon': { - 'default': 1073741824, - 12: 2147483648, - 13: 3221225472, - 14: 2147483648, - 18: 2147483648, - 19: 3221225472, - 20: 4294967296, - 21: 4294967296, - 22: 3221225472, - 23: 2147483648, + 'default': 1024, + 12: 2048, + 13: 3072, + 14: 2048, + 18: 2048, + 19: 3072, + 20: 4096, + 21: 4096, + 22: 3072, + 23: 2048, }, 'tue': { - 'default': 1073741824, - 12: 2147483648, - 13: 3221225472, - 14: 2147483648, - 18: 2147483648, - 19: 3221225472, - 20: 4294967296, - 21: 4294967296, - 22: 3221225472, - 23: 2147483648, + 'default': 1024, + 12: 2048, + 13: 3072, + 14: 2048, + 18: 2048, + 19: 3072, + 20: 4096, + 21: 4096, + 22: 3072, + 23: 2048, }, 'wed': { - 'default': 1073741824, - 12: 2147483648, - 13: 3221225472, - 14: 2147483648, - 18: 2147483648, - 19: 3221225472, - 20: 4294967296, - 21: 4294967296, - 22: 3221225472, - 23: 2147483648, + 'default': 1024, + 12: 2048, + 13: 3072, + 14: 2048, + 18: 2048, + 19: 3072, + 20: 4096, + 21: 4096, + 22: 3072, + 23: 2048, }, 'thu': { - 'default': 1073741824, - 12: 2147483648, - 13: 3221225472, - 14: 2147483648, - 18: 2147483648, - 19: 3221225472, - 20: 4294967296, - 21: 4294967296, - 22: 3221225472, - 23: 2147483648, + 'default': 1024, + 12: 2048, + 13: 3072, + 14: 2048, + 18: 2048, + 19: 3072, + 20: 4096, + 21: 4096, + 22: 3072, + 23: 2048, }, 'fri': { - 'default': 1073741824, - 12: 2147483648, - 13: 3221225472, - 14: 2147483648, - 18: 2147483648, - 19: 3221225472, - 20: 4294967296, - 21: 4294967296, - 22: 3221225472, - 23: 2147483648, + 'default': 1024, + 12: 2048, + 13: 3072, + 14: 2048, + 18: 2048, + 19: 3072, + 20: 4096, + 21: 4096, + 22: 3072, + 23: 2048, }, 'sat': { - 'default': 2147483648, - 12: 3221225472, - 13: 4294967296, - 14: 3221225472, - 18: 3221225472, - 19: 4294967296, - 20: 4294967296, - 21: 4294967296, - 22: 4294967296, - 23: 3221225472, + 'default': 2048, + 12: 3072, + 13: 4096, + 14: 3072, + 18: 3072, + 19: 4096, + 20: 4096, + 21: 4096, + 22: 4096, + 23: 3072, }, 'sun': { - 'default': 2147483648, - 12: 3221225472, - 13: 4294967296, - 14: 3221225472, - 18: 3221225472, - 19: 4294967296, - 20: 4294967296, - 21: 4294967296, - 22: 4294967296, - 23: 3221225472, + 'default': 2048, + 12: 3072, + 13: 4096, + 14: 3072, + 18: 3072, + 19: 4096, + 20: 4096, + 21: 4096, + 22: 4096, + 23: 3072, }}