Project

General

Profile

Actions

Bug #73080

closed
SC SC

"ceph device ls" and "ceph osd tree" gives different hostname results

Bug #73080: "ceph device ls" and "ceph osd tree" gives different hostname results

Added by Senol Colak about 1 year ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Monitor
Target version:
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Manager (RADOS bits)
Pull request ID:
Tags (freeform):
Fixed In:
v21.3.0-1510-gbfebe2ea25
Released In:
Upkeep Timestamp:
2026-07-29T03:30:00+00:00

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 Actions #1

  • Tags set to medium-hanging-fruit

RZ Updated by Radoslaw Zarzynski about 1 year ago Actions #2

Bump up.

NO Updated by Neha Ojha 12 months ago Actions #3

  • Assignee set to Naveen Naidu

NN Updated by Naveen Naidu 11 months ago Actions #4

  • Status changed from New to In Progress
  • Pull request ID set to 66750

NN Updated by Naveen Naidu 11 months ago Actions #5

  • Status changed from In Progress to New
  • Pull request ID deleted (66750)

SC Updated by Senol Colak 11 months ago Actions #6

  • Pull request ID set to 66757
  • Component(RADOS) Manager (RADOS bits) added

RZ Updated by Radoslaw Zarzynski 11 months ago · Edited Actions #7

  • 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 Actions #8

Review-in-progress.

RZ Updated by Radoslaw Zarzynski 10 months ago Actions #9

Approved.

LF Updated by Laura Flores 10 months ago Actions #10

Scrub note: author needs minor rework; and waiting on review from Adam King.

SC Updated by Senol Colak 9 months ago Actions #11

  • 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 Actions #12

Sent to QA.

RZ Updated by Radoslaw Zarzynski 9 months ago Actions #13

Went into testing.

RZ Updated by Radoslaw Zarzynski 9 months ago Actions #14

QA is fine, waiting for ACK from @Adam King.

LF Updated by Laura Flores 8 months ago Actions #15

PR sent back into QA.

SC Updated by Senol Colak 6 months ago Actions #16

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 Actions #17

PR needs another review and retest.

RZ Updated by Radoslaw Zarzynski 6 months ago Actions #18

Resent to QA.

UB Updated by Upkeep Bot 4 months ago Actions #19

  • 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
Actions

Also available in: PDF Atom