)
+def _cephadm_remotes(ctx, log_excluded=False):
+ out = []
+ for remote, roles in ctx.cluster.remotes.items():
+ if any(r.startswith('cephadm.exclude') for r in roles):
+ if log_excluded:
+ log.info(
+ f'Remote {remote.shortname} excluded from cephadm cluster by role'
+ )
+ continue
+ out.append((remote, roles))
+ return out
+
+
def build_initial_config(ctx, config):
cluster_name = config['cluster']
These will help in iscsi clients with finding trusted_ip_list.
"""
log.info('Distributing iscsi-gateway.cfg...')
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
remote.write_file(
path='/etc/ceph/iscsi-gateway.cfg',
data=conf_data,
def _rm_cluster(ctx, cluster_name):
log.info('Removing cluster...')
- ctx.cluster.run(args=[
- 'sudo',
- ctx.cephadm,
- 'rm-cluster',
- '--fsid', ctx.ceph[cluster_name].fsid,
- '--force',
- ])
+ for remote, _ in _cephadm_remotes(ctx):
+ remote.run(args=[
+ 'sudo',
+ ctx.cephadm,
+ 'rm-cluster',
+ '--fsid', ctx.ceph[cluster_name].fsid,
+ '--force',
+ ])
def _rm_cephadm(ctx):
check_status=False)
# add other hosts
- for remote in ctx.cluster.remotes.keys():
+ for remote, roles in _cephadm_remotes(ctx, log_excluded=True):
if remote == bootstrap_remote:
continue
# This is the old way of adding mons that works with the (early) octopus
# cephadm scheduler.
num_mons = 1
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for mon in [r for r in roles
if teuthology.is_type('mon', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(mon)
break
else:
nodes = []
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for mon in [r for r in roles
if teuthology.is_type('mon', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(mon)
try:
nodes = []
daemons = {}
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for mgr in [r for r in roles
if teuthology.is_type('mgr', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(mgr)
# provision OSDs in numeric order
id_to_remote = {}
devs_by_remote = {}
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
devs_by_remote[remote] = teuthology.get_scratch_devices(remote)
for osd in [r for r in roles
if teuthology.is_type('osd', cluster_name)(r)]:
nodes = []
daemons = {}
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for role in [r for r in roles
if teuthology.is_type('mds', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(role)
nodes = []
daemons = {}
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for role in [r for r in roles
if teuthology.is_type(daemon_type, cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(role)
nodes = {}
daemons = {}
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for role in [r for r in roles
if teuthology.is_type('rgw', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(role)
daemons = {}
ips = []
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
for role in [r for r in roles
if teuthology.is_type('iscsi', cluster_name)(r)]:
c_, _, id_ = teuthology.split_role(role)
"""
cluster_name = config['cluster']
log.info('Distributing (final) config and client.admin keyring...')
- for remote, roles in ctx.cluster.remotes.items():
+ for remote, roles in _cephadm_remotes(ctx):
remote.write_file(
'/etc/ceph/{}.conf'.format(cluster_name),
ctx.ceph[cluster_name].config_file,
# mon ips
log.info('Choosing monitor IPs and ports...')
- remotes_and_roles = ctx.cluster.remotes.items()
+ remotes_and_roles = _cephadm_remotes(ctx)
ips = [host for (host, port) in
(remote.ssh.get_transport().getpeername() for (remote, role_list) in remotes_and_roles)]