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>
# -*- coding: utf-8 -*-
from __future__ import absolute_import
+import os.path
import cherrypy
from ceph.deployment.drive_group import DriveGroupSpec, DriveGroupValidationError
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
'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'},
]
}