From 593810e53e36c89a2aafd1307700478feb00b356 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 1 Dec 2020 03:39:26 -0500 Subject: [PATCH] Add volume_count to pool API data --- api-daemon/pvcapid/flaskapi.py | 3 +++ daemon-common/ceph.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index 4896c3dc..0e5aa1a5 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -3316,6 +3316,9 @@ class API_Storage_Ceph_Pool_Root(Resource): name: type: string description: The name of the pool + volume_count: + type: integer + description: The number of volumes in the pool stats: type: object properties: diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index 9e991c1b..152c1e7e 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -347,9 +347,11 @@ def getPoolInformation(zk_conn, pool): # Parse the stats data pool_stats_raw = zkhandler.readdata(zk_conn, '/ceph/pools/{}/stats'.format(pool)) pool_stats = dict(json.loads(pool_stats_raw)) + volume_count = len(getCephVolumes(zk_conn, pool)) pool_information = { 'name': pool, + 'volume_count': volume_count, 'stats': pool_stats } return pool_information