From 1a529bf230b78a2aa68c79c5572d104361ceea32 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 31 Jan 2020 10:56:18 -0600 Subject: [PATCH] cephadm: adopt: disable ceph-volume unit on host This might be a simple or lvm unit. Disable it so that the host doesn't try to start this OSD after a reboot. Signed-off-by: Sage Weil --- src/cephadm/cephadm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 4d20182a07fc7..0678c7edde197 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2335,6 +2335,23 @@ def command_adopt(): if os.path.exists(p): logger.info('Chowning %s...' % p) os.chown(p, uid, gid) + # disable the ceph-volume 'simple' mode files on the host + simple_fn = os.path.join('/etc/ceph/osd', + '%s-%s.json' % (daemon_id, osd_fsid)) + if os.path.exists(simple_fn): + new_fn = simple_fn + '.adopted-by-cephadm' + logger.info('Renaming %s -> %s', simple_fn, new_fn) + os.rename(simple_fn, new_fn) + logger.info('Disabling host unit ceph-volume@ simple unit...') + call_throws(['systemctl', 'disable', + 'ceph-volume@simple-%s-%s.service' % ( + daemon_id, osd_fsid)]) + else: + # assume this is an 'lvm' c-v for now, but don't error + # out if it's not. + logger.info('Disabling host unit ceph-volume@ lvm unit...') + call(['systemctl', 'disable', + 'ceph-volume@lvm-%s-%s.service' % (daemon_id, osd_fsid)]) # config config_src = '/etc/ceph/%s.conf' % (args.cluster) -- 2.39.5