]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: use `ceph osd dump` to check osd status
authorVicente Cheng <freeze.bilsted@gmail.com>
Thu, 10 Sep 2015 08:13:37 +0000 (16:13 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Tue, 17 Nov 2015 01:24:43 +0000 (09:24 +0800)
  - Before deactivated osd, we need to know the status
    including IN/OUT, UP/DOWN on this osd.

Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
src/ceph-disk

index cf6b6d1f0250155eb5d773e393b49f191245b87e..19be89f0650dbd2be539fcce7f631740a9d57e6f 100755 (executable)
@@ -2645,8 +2645,7 @@ def _check_osd_status(cluster, osd_id):
                 [
                     'ceph',
                     'osd',
-                    'find',
-                    osd_id,
+                    'dump',
                     '--cluster={cluster}'.format(
                         cluster=cluster,
                         ),
@@ -2657,9 +2656,9 @@ def _check_osd_status(cluster, osd_id):
     except subprocess.CalledProcessError as e:
         raise Error(e)
     out_json = json.loads(out)
-    if out_json['status IN/OUT'] == u'IN':
+    if out_json[u'osds'][int(osd_id)][u'in'] is 1:
         status_code += 2
-    if out_json['status UP/DOWN'] == u'UP':
+    if out_json[u'osds'][int(osd_id)][u'up'] is 1:
         status_code += 1
     return status_code