Add volume_count to pool API data

This commit is contained in:
Joshua Boniface 2020-12-01 03:39:26 -05:00
parent 185615e6e8
commit 593810e53e
2 changed files with 5 additions and 0 deletions

View File

@ -3316,6 +3316,9 @@ class API_Storage_Ceph_Pool_Root(Resource):
name: name:
type: string type: string
description: The name of the pool description: The name of the pool
volume_count:
type: integer
description: The number of volumes in the pool
stats: stats:
type: object type: object
properties: properties:

View File

@ -347,9 +347,11 @@ def getPoolInformation(zk_conn, pool):
# Parse the stats data # Parse the stats data
pool_stats_raw = zkhandler.readdata(zk_conn, '/ceph/pools/{}/stats'.format(pool)) pool_stats_raw = zkhandler.readdata(zk_conn, '/ceph/pools/{}/stats'.format(pool))
pool_stats = dict(json.loads(pool_stats_raw)) pool_stats = dict(json.loads(pool_stats_raw))
volume_count = len(getCephVolumes(zk_conn, pool))
pool_information = { pool_information = {
'name': pool, 'name': pool,
'volume_count': volume_count,
'stats': pool_stats 'stats': pool_stats
} }
return pool_information return pool_information