From 08aff73a63be3b8daf7950c956ea725c9c8e5567 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Juan=20Miguel=20Olmo=20Mart=C3=ADnez?= Date: Wed, 1 Apr 2020 12:01:35 +0200 Subject: [PATCH] mgr/rook: Fix wrong data output when listing devices MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit e3a5fa49005a7d3ca374beca1dd8cd3e416819a9) --- src/pybind/mgr/rook/module.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index 75dc2193baa35..3459f2ce62136 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))) -- 2.39.5