]> git.apps.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)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2020 09:40:53 +0000 (11:40 +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>
(cherry picked from commit 75aa97ee3fec290682afde9eb5a3254db2104ece)

src/pybind/mgr/cephadm/services/cephadmservice.py
src/pybind/mgr/cephadm/services/iscsi.py

index 70d4be20f55dc023b2bcbdd781b875df2596e1db..1abf63e5dadba27624dbf04d22d8174be11c4722 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):
     """
@@ -235,10 +245,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, []
 
@@ -353,7 +363,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 daemon_spec
index d32210504c7d1f2d51a1122da0c6c6d6c8f871bb..77cdf01a76abac5b77932841c466edebb5142ea0 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 daemon_spec