Skip to content

Commit 6355593

Browse files
authored
Merge pull request ceph#54812 from adk3798/osd-spec-needs-id
mgr/orchestrator: block OSD specs with no service id Reviewed-by: Guillaume Abrioux <[email protected]>
2 parents cae0089 + d5520f2 commit 6355593

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

doc/cephadm/services/osd.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,15 @@ configurations, without knowing the specifics of device names and paths.
454454
Service specifications make it possible to define a yaml or json file that can
455455
be used to reduce the amount of manual work involved in creating OSDs.
456456

457+
.. note::
458+
It is recommended that advanced OSD specs include the ``service_id`` field
459+
set. The plain ``osd`` service with no service id is where OSDs created
460+
using ``ceph orch daemon add`` or ``ceph orch apply osd --all-available-devices``
461+
are placed. Not including a ``service_id`` in your OSD spec would mix
462+
the OSDs from your spec with those OSDs and potentially overwrite services
463+
specs created by cephadm to track them. Newer versions of cephadm will even
464+
block creation of advanced OSD specs without the service_id present
465+
457466
For example, instead of running the following command:
458467

459468
.. prompt:: bash [monitor.1]#

src/pybind/mgr/orchestrator/module.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,21 @@ def apply_misc(self,
13721372
except KeyError:
13731373
raise SpecValidationError(f'Invalid config option {k} in spec')
13741374

1375+
# There is a general "osd" service with no service id, but we use
1376+
# that to dump osds created individually with "ceph orch daemon add osd"
1377+
# and those made with "ceph orch apply osd --all-available-devices"
1378+
# For actual user created OSD specs, we should promote users having a
1379+
# service id so it doesn't get mixed in with those other OSDs. This
1380+
# check is being done in this spot in particular as this is the only
1381+
# place we can 100% differentiate between an actual user created OSD
1382+
# spec and a spec we made ourselves to cover the all-available-devices case
1383+
if (
1384+
isinstance(spec, DriveGroupSpec)
1385+
and spec.service_type == 'osd'
1386+
and not spec.service_id
1387+
):
1388+
raise SpecValidationError('Please provide the service_id field in your OSD spec')
1389+
13751390
if dry_run and not isinstance(spec, HostSpec):
13761391
spec.preview_only = dry_run
13771392

0 commit comments

Comments
 (0)