]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: minor osd_type cleanup in OSD adopt
authorTim Serong <tserong@suse.com>
Thu, 23 Apr 2020 07:00:16 +0000 (17:00 +1000)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 21 May 2020 21:33:18 +0000 (23:33 +0200)
This addresses a couple of the comments in
https://github.com/ceph/ceph/pull/34565

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit df201823b5263502b727c5a056de006b796bc49a)

src/cephadm/cephadm

index 99c76bf93865f0f2b7d5d6b88e55fb1d9152505f..082a2dd3c4d53cb32dba9b8bf29730078de1ca71 100755 (executable)
@@ -3166,13 +3166,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
 
@@ -3254,6 +3254,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')