From df201823b5263502b727c5a056de006b796bc49a Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Thu, 23 Apr 2020 17:00:16 +1000 Subject: [PATCH] cephadm: minor osd_type cleanup in OSD adopt This addresses a couple of the comments in https://github.com/ceph/ceph/pull/34565 Signed-off-by: Tim Serong --- src/cephadm/cephadm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 33b05c584c15..41a19425a4ca 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3127,13 +3127,13 @@ class AdoptOsd(object): with open(path, 'r') as f: osd_fsid = f.read().strip() logger.info("Found online OSD at %s" % path) - if os.path.exists(os.path.join(self.osd_data_dir, 'type')): - with open(os.path.join(self.osd_data_dir, 'type')) as f: - osd_type = f.read().strip() - else: - logger.info('"type" file missing for OSD data dir') except IOError: logger.info('Unable to read OSD fsid from %s' % path) + if os.path.exists(os.path.join(self.osd_data_dir, 'type')): + with open(os.path.join(self.osd_data_dir, 'type')) as f: + osd_type = f.read().strip() + else: + logger.info('"type" file missing for OSD data dir') return osd_fsid, osd_type @@ -3215,6 +3215,7 @@ def command_adopt_ceph(daemon_type, daemon_id, fsid): if not osd_fsid: raise Error('Unable to find OSD {}'.format(daemon_id)) logger.info('objectstore_type is %s' % osd_type) + assert osd_type if osd_type == 'filestore': raise Error('FileStore is not supported by cephadm') -- 2.47.3