From: Juan Miguel Olmo Martínez Date: Wed, 1 Apr 2020 10:01:35 +0000 (+0200) Subject: mgr/rook: Fix wrong data output when listing devices X-Git-Tag: v16.1.0~2615^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e3a5fa49005a7d3ca374beca1dd8cd3e416819a9;p=ceph.git mgr/rook: Fix wrong data output when listing devices Information used to build the output is not the right one. Rook provides in the devices configmap the item which contains the information returned by . This is the right source information to build the devices list. Signed-off-by: Juan Miguel Olmo Martínez --- diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index 75dc2193baa..3459f2ce621 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -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)))