]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: expose NFS "common" config
authorMichael Fritch <mfritch@suse.com>
Fri, 27 Mar 2020 15:23:38 +0000 (09:23 -0600)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 14 Apr 2020 14:50:50 +0000 (16:50 +0200)
populate `rados_config_location` in the ServiceDescription with the
RADOS url of the "common" config

Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit 05a9a1bfdaef1fff69ca8d0e959c84d157190db2)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/nfs.py
src/python-common/ceph/deployment/service_spec.py

index 4d034fc8012fa7a0b7e6eb60ca5862e3c12e43ad..96611be433e621ada4cc7915af4fc43374eb2171 100644 (file)
@@ -1895,6 +1895,9 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
                 if dd.service_name() in self.spec_store.specs:
                     sm[n].size = self._get_spec_size(spec)
                     sm[n].created = self.spec_store.spec_created[dd.service_name()]
+                    if service_type == 'nfs':
+                        spec = cast(NFSServiceSpec, spec)
+                        sm[n].rados_config_location = spec.rados_config_location()
                 else:
                     sm[n].size = 0
                 if dd.status == 1:
@@ -1917,6 +1920,9 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
                 size=self._get_spec_size(spec),
                 running=0,
             )
+            if service_type == 'nfs':
+                spec = cast(NFSServiceSpec, spec)
+                sm[n].rados_config_location = spec.rados_config_location()
         return list(sm.values())
 
     @trivial_completion
index 500f38ba8c989052dbde38193c347323b8ad4bb4..adc0fc3c3b183a66706eafb40bf09d10316d3064 100644 (file)
@@ -26,18 +26,6 @@ class NFSGanesha(object):
         # type: () -> str
         return '%s.%s' % (self.spec.service_type, self.daemon_id)
 
-    def get_rados_config_name(self):
-        # type: () -> str
-        return 'conf-' + self.spec.service_name()
-
-    def get_rados_config_url(self):
-        # type: () -> str
-        url = 'rados://' + self.spec.pool + '/'
-        if self.spec.namespace:
-            url += self.spec.namespace + '/'
-        url += self.get_rados_config_name()
-        return url
-
     def get_keyring_entity(self):
         # type: () -> str
         return utils.name_to_config_section(self.get_rados_user())
@@ -84,7 +72,7 @@ class NFSGanesha(object):
 
     def create_rados_config_obj(self, clobber=False):
         # type: (Optional[bool]) -> None
-        obj = self.get_rados_config_name()
+        obj = self.spec.rados_config_name()
 
         with self.mgr.rados.open_ioctx(self.spec.pool) as ioctx:
             if self.spec.namespace:
@@ -114,7 +102,7 @@ RADOS_URLS {{
 
 %url    {url}
 '''.format(user=self.get_rados_user(),
-           url=self.get_rados_config_url())
+           url=self.spec.rados_config_location())
 
     def get_cephadm_config(self):
         # type: () -> Dict
index 79490a3c9117244721457a7ed12a41f12ca9fd78..7572763d9d086e759aae4d0cfcbbcee2b3feac3c 100644 (file)
@@ -497,6 +497,18 @@ class NFSServiceSpec(ServiceSpec):
         if not self.pool:
             raise ServiceSpecValidationError('Cannot add NFS: No Pool specified')
 
+    def rados_config_name(self):
+        # type: () -> str
+        return 'conf-' + self.service_name()
+
+    def rados_config_location(self):
+        # type: () -> str
+        url = 'rados://' + self.pool + '/'
+        if self.namespace:
+            url += self.namespace + '/'
+        url += self.rados_config_name()
+        return url
+
 
 class RGWSpec(ServiceSpec):
     """