]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/services/cluster.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / services / cluster.py
index a057f24381f78a406979c88de03651aa39fb473f..fbb00bc7370703c5a3095aa0b470e98fc79fd0e9 100644 (file)
@@ -1,9 +1,16 @@
 # -*- coding: utf-8 -*-
 from enum import Enum
+from typing import NamedTuple
 
 from .. import mgr
 
 
+class ClusterCapacity(NamedTuple):
+    total_avail_bytes: int
+    total_bytes: int
+    total_used_raw_bytes: int
+
+
 class ClusterModel:
 
     class Status(Enum):
@@ -33,3 +40,10 @@ class ClusterModel:
         If the status is not set, assume it is already fully functional.
         """
         return cls(status=mgr.get_store('cluster/status', cls.Status.POST_INSTALLED.name))
+
+    @classmethod
+    def get_capacity(cls) -> ClusterCapacity:
+        df = mgr.get('df')
+        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()