From: Adam King Date: Wed, 6 Dec 2023 15:58:03 +0000 (-0500) Subject: mgr/orchestrator: block OSD specs with no service id X-Git-Tag: v19.3.0~255^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=993ce910f41c69a84b5b3058da534ed0e8841a03;p=ceph.git mgr/orchestrator: block OSD specs with no service id This is a copy of a code comment from this commit, but it explains the change, so putting it here as well There is a general "osd" service with no service id, but we use that to dump osds created individually with "ceph orch daemon add osd" and those made with "ceph orch apply osd --all-available-devices" For actual user created OSD specs, we should promote users having a service id so it doesn't get mixed in with those other OSDs. This check is being done in this spot in particular as this is the only place we can 100% differentiate between an actual user created OSD spec and a spec we made ourselves to cover the all-available-devices case Relates to: https://tracker.ceph.com/issues/63729 Signed-off-by: Adam King --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index d6f36e81b718..5f36005b0b1a 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1351,6 +1351,21 @@ Usage: except KeyError: raise SpecValidationError(f'Invalid config option {k} in spec') + # There is a general "osd" service with no service id, but we use + # that to dump osds created individually with "ceph orch daemon add osd" + # and those made with "ceph orch apply osd --all-available-devices" + # For actual user created OSD specs, we should promote users having a + # service id so it doesn't get mixed in with those other OSDs. This + # check is being done in this spot in particular as this is the only + # place we can 100% differentiate between an actual user created OSD + # spec and a spec we made ourselves to cover the all-available-devices case + if ( + isinstance(spec, DriveGroupSpec) + and spec.service_type == 'osd' + and not spec.service_id + ): + raise SpecValidationError('Please provide the service_id field in your OSD spec') + if dry_run and not isinstance(spec, HostSpec): spec.preview_only = dry_run