]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: minor osd_type cleanup in OSD adopt 34703/head
authorTim Serong <tserong@suse.com>
Thu, 23 Apr 2020 07:00:16 +0000 (17:00 +1000)
committerTim Serong <tserong@suse.com>
Tue, 28 Apr 2020 03:36:08 +0000 (13:36 +1000)
This addresses a couple of the comments in
https://github.com/ceph/ceph/pull/34565

Signed-off-by: Tim Serong <tserong@suse.com>
src/cephadm/cephadm

index 33b05c584c1544a36dbf1b8059ad7c7e71adc0be..41a19425a4ca5684e0d1060dfe8b22a91faf54c3 100755 (executable)
@@ -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')