]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: CephadmDaemonSpec: add ceph_conf attribute
authorSebastian Wagner <sebastian.wagner@suse.com>
Sat, 29 Aug 2020 19:21:56 +0000 (21:21 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Fri, 11 Sep 2020 09:07:18 +0000 (11:07 +0200)
* `extra_config` should actually be called `extra_files`
* Special treatment for `ceph_conf` to ease refactorization

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/services/cephadmservice.py
src/pybind/mgr/cephadm/services/iscsi.py

index 648ca1c931e7a91018ebce8a56630d80929523e0..997880d8012418ec1006a4ff7a0f8054c11cd52a 100644 (file)
@@ -29,7 +29,8 @@ class CephadmDaemonSpec(Generic[ServiceSpecs]):
                  network: Optional[str] = None,
                  keyring: Optional[str] = None,
                  extra_args: Optional[List[str]] = None,
-                 extra_config: Optional[Dict[str, Any]] = None,
+                 ceph_conf: str = '',
+                 extra_files: Optional[Dict[str, Any]] = None,
                  daemon_type: Optional[str] = None,
                  ports: Optional[List[int]] = None,):
         """
@@ -56,7 +57,9 @@ class CephadmDaemonSpec(Generic[ServiceSpecs]):
 
         # For run_cephadm. Would be great to have more expressive names.
         self.extra_args: List[str] = extra_args or []
-        self.extra_config: Dict[str, Any] = extra_config or {}
+
+        self.ceph_conf = ceph_conf
+        self.extra_files = extra_files or {}
 
         # TCP ports used by the daemon
         self.ports:  List[int] = ports or []
@@ -64,6 +67,13 @@ class CephadmDaemonSpec(Generic[ServiceSpecs]):
     def name(self) -> str:
         return '%s.%s' % (self.daemon_type, self.daemon_id)
 
+    def config_get_files(self):
+        files = self.extra_files
+        if self.ceph_conf:
+            files['config'] = self.ceph_conf
+
+        return files
+
 
 class CephadmService(metaclass=ABCMeta):
     """
@@ -227,10 +237,10 @@ class CephService(CephadmService):
             daemon_spec.daemon_id,
             host=daemon_spec.host,
             keyring=daemon_spec.keyring,
-            extra_ceph_config=daemon_spec.extra_config.pop('config', ''))
+            extra_ceph_config=daemon_spec.ceph_conf)
 
-        if daemon_spec.extra_config:
-            cephadm_config.update({'files': daemon_spec.extra_config})
+        if daemon_spec.config_get_files():
+            cephadm_config.update({'files': daemon_spec.config_get_files()})
 
         return cephadm_config, []
 
@@ -325,7 +335,7 @@ class MonService(CephService):
                     'public_network is set but does not look like a CIDR network: \'%s\'' % network)
             extra_config += 'public network = %s\n' % network
 
-        daemon_spec.extra_config = {'config': extra_config}
+        daemon_spec.ceph_conf = extra_config
         daemon_spec.keyring = keyring
 
         return self.mgr._create_daemon(daemon_spec)
index 965e7492496f1e54121957be99877f8bd0f26f2b..2db98458c1c3cf77e17f8dccde6ea5f3124be73a 100644 (file)
@@ -68,7 +68,7 @@ class IscsiService(CephService):
         igw_conf = self.mgr.template.render('services/iscsi/iscsi-gateway.cfg.j2', context)
 
         daemon_spec.keyring = keyring
-        daemon_spec.extra_config = {'iscsi-gateway.cfg': igw_conf}
+        daemon_spec.extra_files = {'iscsi-gateway.cfg': igw_conf}
 
         return self.mgr._create_daemon(daemon_spec)