]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: disallow managed options in ServiceSpec config section
authorSage Weil <sage@newdream.net>
Tue, 23 Feb 2021 21:50:44 +0000 (16:50 -0500)
committerSage Weil <sage@newdream.net>
Fri, 26 Feb 2021 13:28:28 +0000 (08:28 -0500)
If a service is managing a config option, prevent the user from specifying
it in the spec.

Signed-off-by: Sage Weil <sage@newdream.net>
src/python-common/ceph/deployment/service_spec.py

index dde78ac4101a72f19c64ec7c057fbb18bf7fb422..2e5762c43542bd54df98f79aa15c24d676b95c5f 100644 (file)
@@ -391,6 +391,9 @@ class ServiceSpec(object):
                           'node-exporter osd prometheus rbd-mirror rgw ' \
                           'container cephadm-exporter ha-rgw'.split()
     REQUIRES_SERVICE_ID = 'iscsi mds nfs osd rgw container ha-rgw '.split()
+    MANAGED_CONFIG_OPTIONS = [
+        'mds_join_fs',
+    ]
 
     @classmethod
     def _cls(cls: Type[ServiceSpecT], service_type: str) -> Type[ServiceSpecT]:
@@ -563,6 +566,12 @@ class ServiceSpec(object):
 
         if self.placement is not None:
             self.placement.validate()
+        if self.config:
+            for k, v in self.config.items():
+                if k in self.MANAGED_CONFIG_OPTIONS:
+                    raise ServiceSpecValidationError(
+                        f'Cannot set config option {k} in spec: it is managed by cephadm'
+                    )
 
     def __repr__(self) -> str:
         return "{}({!r})".format(self.__class__.__name__, self.__dict__)
@@ -636,6 +645,12 @@ class RGWSpec(ServiceSpec):
     Settings to configure a (multisite) Ceph RGW
 
     """
+    MANAGED_CONFIG_OPTIONS = ServiceSpec.MANAGED_CONFIG_OPTIONS + [
+        'rgw_zone',
+        'rgw_realm',
+        'rgw_frontends',
+    ]
+
     def __init__(self,
                  service_type: str = 'rgw',
                  service_id: Optional[str] = None,