Bug #73080
closed"ceph device ls" and "ceph osd tree" gives different hostname results
0%
Description
below is the "ceph osd tree" gives the correct hostnames
kubectl -n rook-ceph exec deployments/rook-ceph-tools -- ceph osd tree
ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF
-1 69.86353 root default
-5 69.86353 region cluster2
-10 34.93175 zone cluster2a
-13 11.64391 host node014-hostname32
1 nvme 1.45547 osd.1 up 1.00000 1.00000
6 nvme 1.45547 osd.6 up 1.00000 1.00000
11 nvme 1.45547 osd.11 up 1.00000 1.00000
16 nvme 1.45547 osd.16 up 1.00000 1.00000
21 nvme 1.45547 osd.21 up 1.00000 1.00000
27 nvme 1.45547 osd.27 up 1.00000 1.00000
below is the "ceph device ls" which we don't get the real names for the hosts
kubectl -n rook-ceph exec deployments/rook-ceph-tools -- ceph device ls
DEVICE HOST:DEV DAEMONS WEAR LIFE EXPECTANCY
Dell_Ent_NVMe_P5600_MU_U.2_1.6TB_PHAB132600PG1P9SGN worker-cluster2-nmxkx-fftsh:nvme2n1 worker-cluster2-pklxw-mwl28:nvme2n1 osd.10 0%
Dell_Ent_NVMe_P5600_MU_U.2_1.6TB_PHAB1326010N1P9SGN worker-cluster2-nmxkx-zc8q5:nvme2n1 worker-cluster2-pklxw-scb92:nvme2n1 osd.23 0%
Dell_Ent_NVMe_P5600_MU_U.2_1.6TB_PHAB132601471P9SGN worker-cluster2-pklxw-99mhh:nvme6n1 osd.24 0%
Manager
https://github.com/ceph/ceph/blob/main/src/mgr/DaemonServer.cc#L2287
ceph device ls
Monitor
https://github.com/ceph/ceph/blob/main/src/mon/OSDMonitor.cc#L5587
ceph osd df
Managed data needs to be fixed, this might create issues due to monitoring exports.
RZ Updated by Radoslaw Zarzynski about 1 year ago
- Tags set to medium-hanging-fruit
RZ Updated by Radoslaw Zarzynski about 1 year ago
Bump up.
NN Updated by Naveen Naidu 11 months ago
- Status changed from New to In Progress
- Pull request ID set to 66750
NN Updated by Naveen Naidu 11 months ago
- Status changed from In Progress to New
- Pull request ID deleted (
66750)
SC Updated by Senol Colak 11 months ago
- Pull request ID set to 66757
- Component(RADOS) Manager (RADOS bits) added
I already created a PR for open and update the hostname values.
RZ Updated by Radoslaw Zarzynski 11 months ago · Edited
- Status changed from New to Fix Under Review
- Assignee changed from Naveen Naidu to Senol Colak
Fix went into the review process.
RZ Updated by Radoslaw Zarzynski 11 months ago
Review-in-progress.
RZ Updated by Radoslaw Zarzynski 10 months ago
Approved.
LF Updated by Laura Flores 10 months ago
Scrub note: author needs minor rework; and waiting on review from Adam King.
SC Updated by Senol Colak 9 months ago
- Target version changed from v19.0.0 to v19.2.4
would be amazing if we could get this Merged, the backport to v19.2.4 would also be possible than.
RZ Updated by Radoslaw Zarzynski 9 months ago
Sent to QA.
RZ Updated by Radoslaw Zarzynski 9 months ago
Went into testing.
RZ Updated by Radoslaw Zarzynski 9 months ago
QA is fine, waiting for ACK from @Adam King.
LF Updated by Laura Flores 8 months ago
PR sent back into QA.
SC Updated by Senol Colak 6 months ago
PR #66757 has been updated with a complete rework: https://github.com/ceph/ceph/pull/66757
Root cause analysis of the original patch:
The previous version inserted the CRUSH hostname override inside if (m->service_daemon) in DaemonServer::handle_open. OSDs connect with service_daemon = false, so this branch is never reached for OSD daemons — the fix was dead code and had no effect in production. On our testings we got false positives because of the cloudinit configurations.
Additionally, the handle_update path called with_osdmap (acquires Objecter::rwlock) while holding state->lock, introducing a lock ordering that is not safe. Setting state->hostname directly before update_metadata would also corrupt the by_server index in DaemonStateIndex.
What the updated patch does:
Moves the override to MetadataUpdate::finish (the async mon metadata fetch — the actual primary path for OSD metadata) and Mgr::load_all_metadata (startup bulk-load). A static helper crush_hostname_for_osd(ClusterState&, int) resolves the CRUSH "host" bucket. Lock ordering is preserved by resolving the CRUSH host before acquiring state->lock. The hostname is communicated through the metadata map rather than set directly on the state object, keeping DaemonStateIndex::by_server consistent.
needs further tests, first version worked..
LF Updated by Laura Flores 6 months ago
PR needs another review and retest.
RZ Updated by Radoslaw Zarzynski 6 months ago
Resent to QA.
UB Updated by Upkeep Bot 4 months ago
- Status changed from Fix Under Review to Resolved
- Merge Commit set to bfebe2ea25a43f0fb576a93c063119cf6c77ba59
- Fixed In set to v21.3.0-1510-gbfebe2ea25
- Upkeep Timestamp set to 2026-07-29T03:30:00+00:00