Feature #3101

allow "ceph osd crush set" without overwriting weight

Added by Anonymous over 10 years ago. Updated over 10 years ago.

Target version:
% Done:


Affected Versions:
Pull request ID:


Currently, a ceph-osd coming up gets its weight reset by src/upstart/ceph-osd.conf. This is not good. A node reboot should not override admin decisions about OSD weights.

There should be a way to adjust the OSD location in CRUSH without changing the weight.

Perhaps use a placeholder value like "nochange", "-" or "keep", to signal no change.

Related, why do we need to pass in both name and id?

    ceph \
        --cluster="${cluster:-ceph}" \
        --name="osd.$id" \
        --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
        osd crush set \
    -- \
        "$id" "osd.$id" "${weight:-1}" \
    root=default \

Associated revisions

Revision b2409a2c (diff)
Added by Sage Weil over 10 years ago

mon: 'osd crush create-or-move <id> <initial-weight> <loc ...>'

Create an item in the tree with the given weight, or move it (without
touching the weight) if it is already present.

Closes: #3101
Signed-off-by: Sage Weil <>

Revision fb6c5c3e (diff)
Added by Tommi Virtanen over 10 years ago

upstart: Use "ceph osd crush create-or-move".

Now the weight is only set when adding the OSD to the CRUSH map for
the first time. Once it's there, it's only moved, and the weight is
left untouched.

Change the ceph.conf option for the initial weight from
osd_crush_weight to osd_crush_initial_weight, to reflect this.

If you don't want new OSDs to store data automatically (to minimize
balancing and keep a human in the control loop), you can now
set osd_crush_initial_weight=0.

Closes: #3101
Signed-off-by: Tommi Virtanen <>


#1 Updated by Anonymous over 10 years ago

Sage proposed this would be "ceph osd crush create-or-move".. I think the args could be "ID INITIAL_WEIGHT VAR=VAL.."

Sage, I'm taking back my "why don't we put the mon in charge of initial weight configurability" -- I see the upstart script is already looking at ceph.conf, we might as well use that: $osd_crush_weight. Perhaps we should rename that $osd_crush_initial_weight, though, and change the default embedded in src/upstart/ceph-osd.conf to 0 (and remove $osd_crush_weight).

#2 Updated by Sage Weil over 10 years ago

  • Tracker changed from Bug to Feature

#3 Updated by Sage Weil over 10 years ago

  • Category set to Monitor
  • Status changed from New to Fix Under Review
  • Target version set to v0.53c

#4 Updated by Sage Weil over 10 years ago

  • Assignee set to Sage Weil

#5 Updated by Sage Weil over 10 years ago

  • translation missing: en.field_story_points set to 1
  • translation missing: en.field_position set to 1
  • translation missing: en.field_position changed from 1 to 1394

#6 Updated by Sage Weil over 10 years ago

  • Status changed from Fix Under Review to Resolved

Also available in: Atom PDF