New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add /cluster/<fsid>/{pool/<id>/}stats endpoints #494
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good.
def cluster_stats(cluster_name): | ||
import rados | ||
|
||
cluster = rados.Rados(name=RADOS_NAME, clustername=cluster_name, conffile='') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a context manager like
class ClusterHandle(): |
except Exception as e: | ||
raise RuntimeError("pool lookup: " + str(e)) | ||
|
||
result = cluster.open_ioctx(pool).get_stats() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b-ranto be sure to close this http://docs.ceph.com/docs/master/rados/api/python/#input-output-context
return result | ||
|
||
|
||
def pool_stats(cluster_name, pool_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b-ranto I'd like to building up of a data structure that could be used to support a list-view here. so maybe iterate over http://docs.ceph.com/docs/master/rados/api/python/#rados.Rados.list_pools and return a dict of pool name: stats
@@ -75,6 +75,11 @@ | |||
'patch': 'update', | |||
'delete': 'destroy'}), | |||
name='cluster-pool-detail'), | |||
url(r'^cluster/(?P<fsid>[a-zA-Z0-9-]+)/pool/(?P<pool_id>\d+)/stats$', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b-ranto please add a list view at /api/cluster/FSID/pool/stats you're almost there
The commit adds two stats endpoints that provide global cluster as well per pool statistics. Signed-off-by: Boris Ranto <branto@redhat.com>
8914757
to
096e722
Compare
I've rebased and repushed the commit that should cover the comments. I did use a somehow different layout for pool/stats endpoint since I did not manage to get the serializers to do it the suggested way. |
The commit adds two stats endpoints that provide global cluster as well
per pool statistics.
Signed-off-by: Boris Ranto branto@redhat.com