MCPcopy Create free account
hub / github.com/ceph/ceph / CephManager

Class CephManager

qa/tasks/ceph_manager.py:1597–3455  ·  view source on GitHub ↗

Ceph manager object. Contains several local functions that form a bulk of this module. :param controller: the remote machine where the Ceph commands should be executed :param ctx: the cluster context :param config: path to Ceph config file :param logg

Source from the content-addressed store, hash-verified

1595# XXX: this class has nothing to do with the Ceph daemon (ceph-mgr) of
1596# the same name.
1597class CephManager:
1598 """
1599 Ceph manager object.
1600 Contains several local functions that form a bulk of this module.
1601
1602 :param controller: the remote machine where the Ceph commands should be
1603 executed
1604 :param ctx: the cluster context
1605 :param config: path to Ceph config file
1606 :param logger: for logging messages
1607 :param cluster: name of the Ceph cluster
1608 """
1609
1610 def __init__(self, controller, ctx=None, config=None, logger=None,
1611 cluster='ceph', cephadm=False, rook=False) -> None:
1612 self.lock = threading.RLock()
1613 self.ctx = ctx
1614 self.config = config
1615 self.controller = controller
1616 self.next_pool_id = 0
1617 self.cluster = cluster
1618
1619 if (logger):
1620 self.log = lambda x: logger.info(x)
1621 else:
1622 def tmp(x):
1623 """
1624 implement log behavior.
1625 """
1626 print(x)
1627 self.log = tmp
1628
1629 if self.config is None:
1630 self.config = dict()
1631
1632 # NOTE: These variables are meant to be overriden by vstart_runner.py.
1633 self.rook = rook
1634 self.cephadm = cephadm
1635 self.testdir = teuthology.get_testdir(self.ctx)
1636 # prefix args for ceph cmds to be executed
1637 self.pre = ['adjust-ulimits', 'ceph-coverage',
1638 f'{self.testdir}/archive/coverage']
1639 self.RADOS_CMD = self.pre + ['rados', '--cluster', self.cluster]
1640
1641 pools = self.list_pools()
1642 self.pools = {}
1643 for pool in pools:
1644 # we may race with a pool deletion; ignore failures here
1645 try:
1646 self.pools[pool] = self.get_pool_int_property(pool, 'pg_num')
1647 except CommandFailedError:
1648 self.log('Failed to get pg_num from pool %s, ignoring' % pool)
1649
1650 def get_ceph_cmd(self, **kwargs):
1651 timeout = kwargs.pop('timeout', 120)
1652 return ['sudo'] + self.pre + ['timeout', f'{timeout}', 'ceph',
1653 '--cluster', self.cluster]
1654 def save_conf_epoch(self):

Callers 5

setup_managerFunction · 0.90
_init_mon_managerMethod · 0.90
ceph_osdsFunction · 0.90
taskFunction · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 1

_init_mon_managerMethod · 0.72