]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-daemon: fix fsid detection for legacy osds
authorSage Weil <sage@redhat.com>
Wed, 2 Oct 2019 21:18:40 +0000 (16:18 -0500)
committerSage Weil <sage@redhat.com>
Sat, 5 Oct 2019 01:33:35 +0000 (20:33 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 49355f8a10151b9665d5504e21cff015f7310252..3017fa2578571838d77a2c1105ed34dc6222ca9f 100755 (executable)
@@ -77,7 +77,7 @@ def check_unit(unit_name):
         active = False
     return (enabled, active)
 
-def get_legacy_fsid(cluster):
+def get_legacy_config_fsid(cluster):
     try:
         config = configparser.ConfigParser()
         config.read('/etc/ceph/%s.conf' % cluster)
@@ -87,6 +87,21 @@ def get_legacy_fsid(cluster):
         return 'unknown'
     return 'unknown'
 
+def get_legacy_daemon_fsid(cluster_name, daemon_type, daemon_id):
+    fsid = None
+    if daemon_type == 'osd':
+        try:
+            with open(os.path.join(args.data_dir,
+                                   daemon_type,
+                                   'ceph-%s' % daemon_id,
+                                   'ceph_fsid'), 'r') as f:
+                fsid = f.read().strip()
+        except:
+            pass
+    if not fsid:
+        fsid = get_legacy_config_fsid(cluster)
+    return fsid
+
 def get_daemon_args(fsid, daemon_type, daemon_id):
     r = [
         '--default-log-to-file=false',
@@ -818,16 +833,7 @@ def command_ls():
                 if '-' not in j:
                     continue
                 (cluster, daemon_id) = j.split('-', 1)
-                fsid = None
-                if daemon_type == 'osd':
-                    try:
-                        with open(os.path.join(args.data_dir, i, j,
-                                               'ceph_fsid')) as f:
-                            fsid = f.read().strip()
-                    except:
-                        pass
-                if not fsid:
-                    fsid = get_legacy_fsid(cluster)
+                fsid = get_legacy_daemon_fsid(cluster, daemon_type, daemon_id)
                 (enabled, active) = check_unit('ceph-%s@%s' % (daemon_type,
                                                                daemon_id))
                 ls.append({