]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix OSD IDs are not displayed when using cephadm backend 32207/head
authorKiefer Chang <kiefer.chang@suse.com>
Thu, 5 Dec 2019 10:05:30 +0000 (18:05 +0800)
committerKiefer Chang <kiefer.chang@suse.com>
Thu, 12 Dec 2019 10:01:07 +0000 (18:01 +0800)
The basename of device path should be used for OSD mapping comparison.
e.g. `/dev/sda` -> `sda`.

Fixes: https://tracker.ceph.com/issues/43136
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
src/pybind/mgr/dashboard/controllers/orchestrator.py
src/pybind/mgr/dashboard/tests/test_orchestrator.py

index f38ac90a87e07aa3e0f2449267261d4b140741a9..6235f209ee0fdefc59b371e4c63a4d73605fe329 100644 (file)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
+import os.path
 
 import cherrypy
 from ceph.deployment.drive_group import DriveGroupSpec, DriveGroupValidationError
@@ -83,7 +84,8 @@ class OrchestratorInventory(RESTController):
             node_osds = device_osd_map.get(inventory_node['name'])
             for device in inventory_node['devices']:
                 if node_osds:
-                    device['osd_ids'] = sorted(node_osds.get(device['path'], []))
+                    dev_name = os.path.basename(device['path'])
+                    device['osd_ids'] = sorted(node_osds.get(dev_name, []))
                 else:
                     device['osd_ids'] = []
         return inventory_nodes
index 7ed687e1eb074247f2539ad70e338a3f8caaeeb5..2817a69168095dd00c154d39a0d99ded520af535 100644 (file)
@@ -73,14 +73,14 @@ class OrchestratorControllerTest(ControllerTestCase):
                 'name': 'host-0',
                 'devices': [
                     {'path': 'nvme0n1'},
-                    {'path': 'sdb'},
-                    {'path': 'sdc'},
+                    {'path': '/dev/sdb'},
+                    {'path': '/dev/sdc'},
                 ]
             },
             {
                 'name': 'host-1',
                 'devices': [
-                    {'path': 'sda'},
+                    {'path': '/dev/sda'},
                     {'path': 'sdb'},
                 ]
             }