From: Sage Weil Date: Thu, 20 Feb 2020 22:57:48 +0000 (-0600) Subject: cephadm: fix adoption safety check X-Git-Tag: v15.1.1~339^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=19bbad7c33f255ac67f2b43a20ac6e13ce5399ce;p=ceph.git cephadm: fix adoption safety check The 'type' file is only required for *osds*. Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 49ea389939d9..0be8aa45d4ca 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2400,6 +2400,15 @@ def command_adopt(): osd_fsid = f.read().strip() except IOError: raise Error('unable to read OSD fsid from %s' % path) + os_type = None + if os.path.exists(os.path.join(data_dir_src, 'type')): + with open(os.path.join(data_dir_src, 'type')) as f: + os_type = f.read().strip() + else: + raise Error('"type" file missing for OSD data dir') + logger.info('objectstore_type is %s' % os_type) + if os_type == 'filestore': + raise Error('FileStore is not supported by cephadm') # NOTE: implicit assumption here that the units correspond to the # cluster we are adopting based on the /etc/{defaults,sysconfig}/ceph @@ -2415,15 +2424,6 @@ def command_adopt(): call_throws(['systemctl', 'disable', unit_name]) # data - os_type = None - if os.path.exists(os.path.join(data_dir_src, 'type')): - with open(os.path.join(data_dir_src, 'type')) as f: - os_type = f.read().strip() - else: - raise Error('"type" file missing for OSD data dir') - logger.info('objectstore_type is %s' % os_type) - if os_type == 'filestore': - raise Error('FileStore is not supported by cephadm') logger.info('Moving data...') data_dir_dst = make_data_dir(fsid, daemon_type, daemon_id, uid=uid, gid=gid)