summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/services/cluster.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pybind/mgr/dashboard/services/cluster.py')
-rw-r--r--src/pybind/mgr/dashboard/services/cluster.py33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/pybind/mgr/dashboard/services/cluster.py b/src/pybind/mgr/dashboard/services/cluster.py
index 9caaf196336..3d7c21ac9ae 100644
--- a/src/pybind/mgr/dashboard/services/cluster.py
+++ b/src/pybind/mgr/dashboard/services/cluster.py
@@ -9,9 +9,6 @@ class ClusterCapacity(NamedTuple):
total_avail_bytes: int
total_bytes: int
total_used_raw_bytes: int
- total_objects: int
- total_pool_bytes_used: int
- average_object_size: int
class ClusterModel:
@@ -47,33 +44,9 @@ class ClusterModel:
@classmethod
def get_capacity(cls) -> ClusterCapacity:
df = mgr.get('df')
- total_pool_bytes_used = 0
- average_object_size = 0
- total_data_pool_objects = 0
- total_data_pool_bytes_used = 0
- rgw_pools_data = cls.get_rgw_pools()
-
- for pool in df['pools']:
- pool_name = str(pool['name'])
- if pool_name in rgw_pools_data:
- if pool_name.endswith('.data'):
- objects = pool['stats']['objects']
- pool_bytes_used = pool['stats']['bytes_used']
- total_pool_bytes_used += pool_bytes_used
- total_data_pool_objects += objects
- replica = rgw_pools_data[pool_name]
- total_data_pool_bytes_used += pool_bytes_used / replica
-
- average_object_size = total_data_pool_bytes_used / total_data_pool_objects if total_data_pool_objects != 0 else 0 # noqa E501 #pylint: disable=line-too-long
-
- return ClusterCapacity(
- total_avail_bytes=df['stats']['total_avail_bytes'],
- total_bytes=df['stats']['total_bytes'],
- total_used_raw_bytes=df['stats']['total_used_raw_bytes'],
- total_objects=total_data_pool_objects,
- total_pool_bytes_used=total_pool_bytes_used,
- average_object_size=average_object_size
- )._asdict()
+ return ClusterCapacity(total_avail_bytes=df['stats']['total_avail_bytes'],
+ total_bytes=df['stats']['total_bytes'],
+ total_used_raw_bytes=df['stats']['total_used_raw_bytes'])._asdict()
@classmethod
def get_rgw_pools(cls):