]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: Fix wrong data output when listing devices 34554/head
authorJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Wed, 1 Apr 2020 10:01:35 +0000 (12:01 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 14 Apr 2020 14:50:50 +0000 (16:50 +0200)
Information used to build the <device ls> output is not the right one.
Rook provides in the devices configmap the item <cephVolumeData> which contains the information returned by <ceph-volume>.
This is the right source information to build the devices list.

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
(cherry picked from commit e3a5fa49005a7d3ca374beca1dd8cd3e416819a9)

src/pybind/mgr/rook/module.py

index 75dc2193baa3534b9c266d4236502265cbd9c1d3..3459f2ce62136079f8884a5d88e20c33d4c41a5a 100644 (file)
@@ -2,6 +2,7 @@ import datetime
 import threading
 import functools
 import os
+import json
 
 from ceph.deployment import inventory
 from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec, PlacementSpec
@@ -232,16 +233,18 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
         for host_name, host_devs in devs.items():
             devs = []
             for d in host_devs:
-                dev = inventory.Device(
-                    path='/dev/' + d['name'],
-                    sys_api=dict(
-                        rotational='1' if d['rotational'] else '0',
-                        size=d['size']
-                    ),
-                    available=d['empty'],
-                    rejected_reasons=[] if d['empty'] else ['not empty'],
-                )
-                devs.append(dev)
+                if 'cephVolumeData' in d and d['cephVolumeData']:
+                    devs.append(inventory.Device.from_json(json.loads(d['cephVolumeData'])))
+                else:
+                    devs.append(inventory.Device(
+                        path = '/dev/' + d['name'],
+                        sys_api = dict(
+                            rotational = '1' if d['rotational'] else '0',
+                            size = d['size']
+                            ),
+                        available = False,
+                        rejected_reasons=['device data coming from ceph-volume not provided'],
+                    ))
 
             result.append(orchestrator.InventoryHost(host_name, inventory.Devices(devs)))