# this doesn't block until they are all stopped...
#ctx.cluster.run(args=['sudo', 'systemctl', 'stop', 'ceph.target'])
- # so, stop them individually
+ # stop the daemons we know
for role in ctx.daemons.resolve_role_list(None, CEPH_ROLE_TYPES, True):
cluster, type_, id_ = teuthology.split_role(role)
try:
log.exception(f'Failed to stop "{role}"')
raise
+ # tear down anything left (but leave the logs behind)
+ ctx.cluster.run(args=[
+ 'sudo',
+ ctx.cephadm,
+ 'rm-cluster',
+ '--fsid', fsid,
+ '--force',
+ '--keep-logs',
+ ])
+
# clean up /etc/ceph
ctx.cluster.run(args=[
'sudo', 'rm', '-f',
ctx.unit_dir + '/ceph-%s.target.wants' % ctx.fsid])
# rm data
call_throws(ctx, ['rm', '-rf', ctx.data_dir + '/' + ctx.fsid])
- # rm logs
- call_throws(ctx, ['rm', '-rf', ctx.log_dir + '/' + ctx.fsid])
- call_throws(ctx, ['rm', '-rf', ctx.log_dir + # noqa: W504
- '/*.wants/ceph-%s@*' % ctx.fsid])
+
+ if not ctx.keep_logs:
+ # rm logs
+ call_throws(ctx, ['rm', '-rf', ctx.log_dir + '/' + ctx.fsid])
+ call_throws(ctx, ['rm', '-rf', ctx.log_dir + # noqa: W504
+ '/*.wants/ceph-%s@*' % ctx.fsid])
+
# rm logrotate config
call_throws(ctx, ['rm', '-f', ctx.logrotate_dir + '/ceph-%s' % ctx.fsid])
'--force',
action='store_true',
help='proceed, even though this may destroy valuable data')
+ parser_rm_cluster.add_argument(
+ '--keep-logs',
+ action='store_true',
+ help='do not remove log files')
parser_run = subparsers.add_parser(
'run', help='run a ceph daemon, in a container, in the foreground')