]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator: block OSD specs with no service id
authorAdam King <adking@redhat.com>
Wed, 6 Dec 2023 15:58:03 +0000 (10:58 -0500)
committerAdam King <adking@redhat.com>
Wed, 6 Dec 2023 15:58:03 +0000 (10:58 -0500)
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 <adking@redhat.com>
src/pybind/mgr/orchestrator/module.py

index d6f36e81b718b355b9cb70f5c490ad2f979e3265..5f36005b0b1aa667f0c327c7a43c9ce2b59d5048 100644 (file)
@@ -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