Skip to content

CephCluster() class for cluster related operations

shylesh edited this page Jun 26, 2019 · 2 revisions

Usage of CephCluster() class.

The idea is to have all cluster related utilities and functionalities under one class which makes it easy to perform ceph cluster operations in a context sensitive way.

CephCluster()


CephCluster class holds in context the CephCluster(OCS) object and CephFilesystem objects. https://github.com/red-hat-storage/ocs-ci/blob/master/ocs/cluster.py#L73 and all cluster operations revolve around this context.

As of now this class doesn't perform any create operations like create_cluster or create_cephfs etc.

Cluster entities

https://github.com/red-hat-storage/ocs-ci/blob/master/ocs/cluster.py#L113-#L118 CephCluster holds the cluster entity objects(pod objects) for mons, mgrs, osds and mdss.

scan_cluster()

https://github.com/red-hat-storage/ocs-ci/blob/master/ocs/cluster.py#L93 scan_cluster() method is responsible for keeping the CephCluster object in sync with the cluster status. Any update operations user performs must use scan_cluster() method at the end so that everything is uptodate in CephCluster object.

cluster_health_check()

https://github.com/red-hat-storage/ocs-ci/blob/master/ocs/cluster.py#L159 For cluster health checks please use cluster_health_check() method, also there is room for significant improvement in this function.

Add/Remove cluster entities

https://github.com/red-hat-storage/ocs-ci/blob/master/ocs/cluster.py#L214 For adding or removing monitors please use mon_change_count(), in which you have to provide absolute number of mons required in the cluster. users can write wrappers like add_mon() , remove_mon() on top of this. similary we have mds_change_count().

More functionalities to come

few ops we might need

  1. add/remove osds
  2. kill/restart osds,mons,mdss
  3. get_primary_osd for pgs
  4. Improve ceph_health_check parameters many more on need basis.