]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: adopt: disable ceph-volume unit on host
authorSage Weil <sage@redhat.com>
Fri, 31 Jan 2020 16:56:18 +0000 (10:56 -0600)
committerSage Weil <sage@redhat.com>
Mon, 3 Feb 2020 22:24:34 +0000 (16:24 -0600)
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 <sage@redhat.com>
src/cephadm/cephadm

index 4d20182a07fc77a6559bc718595276b27d20ecc7..0678c7edde1976b892f7ea7f104f27fc49dda3ab 100755 (executable)
@@ -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)