]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix Dashboard ganesha setting duplication error 35908/head
authorKiefer Chang <kiefer.chang@suse.com>
Fri, 3 Jul 2020 02:32:17 +0000 (10:32 +0800)
committerKiefer Chang <kiefer.chang@suse.com>
Fri, 3 Jul 2020 03:09:37 +0000 (11:09 +0800)
Fix the problem when there are multiple daemons in a NFS service,
redundant Ganesha locations are set.

This change also fixes the setting is wrong when no namespace is used for
a Ganesha config pool.

Fixes: https://tracker.ceph.com/issues/46329
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
src/pybind/mgr/cephadm/services/nfs.py

index 98e0eb04544a6ab3caffdd0e20e505e9ab826d30..05d0199a18e69f10c271c3aba0855dea016d3d06 100644 (file)
@@ -1,7 +1,7 @@
 import logging
 
 import rados
-from typing import Dict, Optional, Tuple, Any, List, cast
+from typing import Dict, Optional, Tuple, Any, List, Set, cast
 
 from ceph.deployment.service_spec import NFSServiceSpec
 
@@ -76,14 +76,17 @@ class NFSService(CephadmService):
     def config_dashboard(self, daemon_descrs: List[DaemonDescription]):
         
         def get_set_cmd_dicts(out: str) -> List[dict]:
-            locations: List[str] = []
+            locations: Set[str] = set()
             for dd in daemon_descrs:
                 spec = cast(NFSServiceSpec,
                             self.mgr.spec_store.specs.get(dd.service_name(), None))
                 if not spec or not spec.service_id:
                     logger.warning('No ServiceSpec or service_id found for %s', dd)
                     continue
-                locations.append('{}:{}/{}'.format(spec.service_id, spec.pool, spec.namespace))
+                location = '{}:{}'.format(spec.service_id, spec.pool)
+                if spec.namespace:
+                    location = '{}/{}'.format(location, spec.namespace)
+                locations.add(location)
             new_value = ','.join(locations)
             if new_value and new_value != out:
                 return [{'prefix': 'dashboard set-ganesha-clusters-rados-pool-namespace',