From: Adam King <47704447+adk3798@users.noreply.github.com> Date: Wed, 13 Apr 2022 18:24:36 +0000 (-0400) Subject: Merge pull request #43796 from windgmbh/cephadm-sysctl-fhs-fix X-Git-Tag: v18.0.0~1069 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc1a08c3d09c17caa042a6747c7756f9f80746cb;p=ceph.git Merge pull request #43796 from windgmbh/cephadm-sysctl-fhs-fix cephadm: Fix sysctl.d location Reviewed-by: Adam King Reviewed-by: Sebastian Wagner --- bc1a08c3d09c17caa042a6747c7756f9f80746cb diff --cc src/cephadm/cephadm index cade269827a,3bcea3e5b30..d0964130c8f --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@@ -6719,34 -6090,20 +6763,36 @@@ def command_rm_cluster(ctx) # rm logrotate config call_throws(ctx, ['rm', '-f', ctx.logrotate_dir + '/ceph-%s' % ctx.fsid]) - # rm cephadm logrotate config if last cluster on host - if not os.listdir(ctx.data_dir): + # if last cluster on host remove shared files + if get_ceph_cluster_count(ctx) == 0: + disable_systemd_service('ceph.target') + + # rm shared ceph target files + call_throws(ctx, ['rm', '-f', ctx.unit_dir + '/multi-user.target.wants/ceph.target']) + call_throws(ctx, ['rm', '-f', ctx.unit_dir + '/ceph.target']) + + # rm cephadm logrotate config call_throws(ctx, ['rm', '-f', ctx.logrotate_dir + '/cephadm']) + if not ctx.keep_logs: + # remove all cephadm logs + for fname in glob(f'{ctx.log_dir}/cephadm.log*'): + os.remove(fname) + # rm sysctl settings - sysctl_dir = Path(ctx.sysctl_dir) - for p in sysctl_dir.glob(f'90-ceph-{ctx.fsid}-*.conf'): - p.unlink() + sysctl_dirs: List[Path] = [Path(ctx.sysctl_dir), Path('/usr/lib/sysctl.d')] + + for sysctl_dir in sysctl_dirs: + for p in sysctl_dir.glob(f'90-ceph-{ctx.fsid}-*.conf'): + p.unlink() + # cleanup remaining ceph directories + ceph_dirs = [f'/run/ceph/{ctx.fsid}', f'/tmp/var/lib/ceph/{ctx.fsid}', f'/var/run/ceph/{ctx.fsid}'] + for dd in ceph_dirs: + shutil.rmtree(dd, ignore_errors=True) + # clean up config, keyring, and pub key files files = ['/etc/ceph/ceph.conf', '/etc/ceph/ceph.pub', '/etc/ceph/ceph.client.admin.keyring'] - if os.path.exists(files[0]): valid_fsid = False with open(files[0]) as f: