]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/volumes: Add placement option to create nfs cluster interface
authorVarsha Rao <varao@redhat.com>
Tue, 21 Apr 2020 12:53:04 +0000 (18:23 +0530)
committerVarsha Rao <varao@redhat.com>
Wed, 8 Jul 2020 05:36:34 +0000 (07:36 +0200)
Signed-off-by: Varsha Rao <varao@redhat.com>
(cherry picked from commit b16190bb5fb61754199cf9731c496888299c983a)

doc/cephfs/fs-nfs-exports.rst
src/pybind/mgr/volumes/fs/nfs.py
src/pybind/mgr/volumes/module.py

index f18bbbae170c30e1b651e5f47ebf62616742c130..b076b88280c6e73a8d9eedde3f68a15aa876d26d 100644 (file)
@@ -17,18 +17,15 @@ Create NFS Ganesha Cluster
 
 .. code:: bash
 
-    $ ceph nfs cluster create <type=cephfs> [--size=1] <clusterid>
+    $ ceph nfs cluster create <type=cephfs> <clusterid> [<placement>]
 
 This creates a common recovery pool for all Ganesha daemons, new user based on
 cluster_id and common ganesha config rados object.
 
-Here size denotes the number of ganesha daemons within a cluster and type is
-export type. Currently only CephFS is supported.
-
-.. note:: This does not setup ganesha recovery database and start the daemons.
-          It needs to be done manually if not using vstart for creating
-          clusters. Please refer `ganesha-rados-grace doc
-          <https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/doc/man/ganesha-rados-grace.rst>`_
+Here type is export type and placement specifies the size of cluster and hosts.
+For more details on placement specification refer the `orchestrator doc
+<https://docs.ceph.com/docs/master/mgr/orchestrator/#placement-specification>`_.
+Currently only CephFS export type is supported.
 
 Create CephFS Export
 ====================
index d53e00617eea1e21cb5f671e1571a1e7f9e54a01..f7084b0d99b712758f432973164726a1da0056bb 100644 (file)
@@ -349,10 +349,10 @@ class NFSCluster:
             log.exception(str(e))
             return True
 
-    def _call_orch_apply_nfs(self, size):
+    def _call_orch_apply_nfs(self, placement):
         spec = NFSServiceSpec(service_type='nfs', service_id=self.cluster_id,
                               pool=self.pool_name, namespace=self.pool_ns,
-                              placement=PlacementSpec.from_string(str(size)))
+                              placement=PlacementSpec.from_string(placement))
         try:
             completion = self.mgr.apply_nfs(spec)
             self.mgr._orchestrator_wait([completion])
@@ -360,7 +360,7 @@ class NFSCluster:
         except Exception as e:
             log.exception("Failed to create NFS daemons:{}".format(e))
 
-    def create_nfs_cluster(self, export_type, size):
+    def create_nfs_cluster(self, export_type, placement):
         if export_type != 'cephfs':
             return -errno.EINVAL,"", f"Invalid export type: {export_type}"
 
@@ -384,7 +384,7 @@ class NFSCluster:
         if self.check_cluster_exists():
             log.info(f"{self.cluster_id} cluster already exists")
         else:
-            self._call_orch_apply_nfs(size)
+            self._call_orch_apply_nfs(placement)
 
         return 0, "", "NFS Cluster Created Successfully"
 
index c830169af95746f9de81678f356196aed0a3f3c8..03c3310e726e9e565432dc40b20c9640265c6c4f 100644 (file)
@@ -274,7 +274,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
             'cmd': 'nfs cluster create '
                    'name=type,type=CephString '
                    'name=clusterid,type=CephString '
-                   'name=size,type=CephInt,req=false ',
+                   'name=placement,type=CephString,req=false ',
             'desc': "Create an NFS Cluster",
             'perm': 'rw'
         },
@@ -476,6 +476,6 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
         return self.fs_export.delete_export(cmd['export_id'])
 
     def _cmd_nfs_cluster_create(self, inbuf, cmd):
-        #TODO add placement option
         nfs_cluster_obj = NFSCluster(self, cmd['clusterid'])
-        return nfs_cluster_obj.create_nfs_cluster(export_type=cmd['type'], size=cmd.get('size', 1))
+        return nfs_cluster_obj.create_nfs_cluster(export_type=cmd['type'],
+                                                  placement=cmd.get('placement', None))