Cephadm: Change OSD service specification

The Ceph “Tentacle” version (v20.2.0) has been released a couple of weeks ago, and I just discovered a new command for the orchestrator:

tentacle:~ # ceph orch osd set-spec-affinity <new_spec> <osd_id>

But what is the purpose of this command?

One frequent question on the ceph-users mailing list or other channels is how to “move” OSDs to a different service specification. So let’s assume we have two different specs in place:

tentacle:~ # ceph orch ls osd
NAME            PORTS  RUNNING  REFRESHED  AGE  PLACEMENT   
osd.standalone               2  1s ago     7w   tentacle   
osd.test                     1  1s ago     42s  label:osd

Now how can we move the two OSDs from “osd.standalone” to “osd.test” without rebuilding OSDs (which is unnecessary)? My approach until now was to change the unit.meta file of every OSD manually:

# Use an editor of your choice
$ vi /var/lib/ceph/{FSID}/osd.{OSD_ID}/unit.meta  

# and change 
    "service_name": "osd.standalone",
# to 
    "service_name": "osd.test",

After a few minutes, the orchestrator will refresh its specs and update the output accordingly.

This process can now be executed via orchestrator (or alternatively, locally on a node via cephadm) as mentioned above:

tentacle:~ # ceph orch osd set-spec-affinity osd.test 0
Updated service for osd 0

This will replace "service_name": "osd.standalone" with "service_name": "osd.test" in the unit.meta file of OSD.0.

To demonstrate the local command (via cephadm) as well (for two OSDs simultaneously):

tentacle:~ # cephadm update-osd-service --fsid {FSID} --osd-ids 1,2 --service-name osd.test
Inferring config /var/lib/ceph/{FSID}/mon.tentacle/config
Successfully updated daemon osd.1 with service osd.test
Successfully updated daemon osd.2 with service osd.test

And the result:

tentacle:~ # ceph orch ls osd --refresh
NAME            PORTS  RUNNING  REFRESHED  AGE  PLACEMENT   
osd.standalone               0  -          7w   label:osd   
osd.test                     3  1s ago     19h  label:osd

This entry was posted in Ceph, cephadm and tagged , , , , , , . Bookmark the permalink.

Leave a Reply