ceph.rados_utils module

class ceph.rados_utils.RadosHelper(mon, config=None, log=None, cluster='ceph')

Bases: object

collect_osd_daemon_ids(mon_node, osd_node)

The method is used to collect the various OSD’s present on a particular node :param mon_node: name of the monitor node (ceph.ceph.CephNode): ceph node :param osd_node: name of the OSD node on which osd daemon details are collected (ceph.ceph.CephNode): ceph node :return: list od OSD’s present on the node

create_pool(pool_name, pg_num=16, erasure_code_profile_name=None, min_size=None, erasure_code_use_overwrites=False)

Create a pool named from the pool_name parameter.

Parameters:
  • pool_name (Str) – name of the pool being created.

  • pg_num (Int) – initial number of pgs.

  • erasure_code_profile_name (Str) – if set and !None create an erasure coded pool using the profile

  • erasure_code_use_overwrites (Bool) – if true, allow overwrites

get_mgr_proxy_container(node, docker_image, proxy_container='mgr_proxy')

Returns mgr dummy container to access containerized storage :param node: ceph node :type node: ceph.ceph.CephNode :param docker_image: repository/image:tag :type docker_image: str

Returns:

mgr object

Return type:

ceph.ceph.CephDemon

get_num_pools()
Returns:

number of pools in the cluster

get_osd_dump_json()

osd dump –format=json converted to a python object :returns: the python object

get_pg_primary(pool, pgnum)

get primary for pool, pgnum (e.g. (data, 0)->0

get_pg_random(pool, pgnum)

get random osd for pool, pgnum (e.g. (data, 0)->0

get_pgid(pool, pgnum)
Parameters:
  • pool – pool name

  • pgnum – pg number

Returns:

a string representing this pg.

get_pool_dump(pool)

get the osd dump part of a pool

get_pool_num(pool)

get number for pool (e.g., data -> 2)

get_pool_property(pool_name, prop)
Parameters:
  • pool_name – pool

  • prop – property to be checked.

Returns:

property as an int value.

is_up(osd_id)

:return 1 if up, 0 if down

kill_osd(osd_node, osd_service)
Params:

id , type of signal, list of osd objects type: “SIGKILL”, “SIGTERM”, “SIGHUP” etc.

Returns:

1 or 0

list_pools()

list all pool names

raw_cluster_cmd(*args)
Returns:

(stdout, stderr)

revive_osd(osd_node, osd_service)
Returns:

0 if revive success,1 if fail

run_deep_scrub()

run deep-scrub on all osds

run_radosbench(pg_count=8, seconds=10)

run IO using radosbench cli tool

run_scrub()

run scrub on all osds

wait_until_osd_state(osd_id, down=False) bool

Checks the state of given osd and waits for 120 seconds for the same state to be achieved

Parameters:
  • osd_id – ID of the osd to be checked

  • down – If True, Specifies that the OSD should be down

Returns:

Boolean True -> Pass, False -> Fail