]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/cephfs: Add list and get export usage
authorVarsha Rao <varao@redhat.com>
Tue, 16 Jun 2020 10:29:19 +0000 (15:59 +0530)
committerVarsha Rao <varao@redhat.com>
Tue, 30 Jun 2020 17:47:38 +0000 (23:17 +0530)
Signed-off-by: Varsha Rao <varao@redhat.com>
doc/cephfs/fs-nfs-exports.rst
src/pybind/mgr/volumes/fs/nfs.py

index ae1744da180d462f470a3feb974bdb402298fdc5..f2db5a0c55acd6e90e00f5f3d158247136b52598 100644 (file)
@@ -73,6 +73,25 @@ Delete CephFS Export
 
 It deletes an export in cluster based on pseudo root name (binding).
 
+List CephFS Export
+==================
+
+.. code:: bash
+
+    $ ceph nfs export ls <clusterid> [--detailed]
+
+It lists export for a cluster. With detailed option enabled it shows entire
+export block.
+
+Get CephFS Export
+=================
+
+.. code:: bash
+
+    $ ceph nfs export get <clusterid> <binding>
+
+It displays export block for a cluster based on pseudo root name (binding).
+
 Configuring NFS-Ganesha to export CephFS with vstart
 ====================================================
 
index 582ec0b0fb0f5176ea859d339afa3e582ff31e63..294224a806db4b91517b0d8fbd210a65b123fca2 100644 (file)
@@ -508,8 +508,8 @@ class FSExport(object):
                 return 0, "Successfully deleted export", ""
             return 0, "", "Export does not exist"
         except Exception as e:
-            log.warning("Failed to delete exports")
-            return -errno.EINVAL, "", str(e)
+            log.exception(f"Failed to delete {pseudo_path} export for {cluster_id}")
+            return getattr(e, 'errno', -1), "", str(e)
 
     def format_path(self, path):
         if path:
@@ -560,7 +560,7 @@ class FSExport(object):
                 return (0, json.dumps(result, indent=4), '')
             return 0, "", "Export already exists"
         except Exception as e:
-            log.warning("Failed to create exports")
+            log.exception(f"Failed to create {pseudo_path} export for {cluster_id}")
             return -errno.EINVAL, "", str(e)
 
     @export_cluster_checker
@@ -570,15 +570,16 @@ class FSExport(object):
     def delete_all_exports(self, cluster_id):
         try:
             export_list = list(self.exports[cluster_id])
-            self.rados_namespace = cluster_id
-            for export in export_list:
-               ret, out, err = self._delete_export(cluster_id=cluster_id, pseudo_path=None,
-                                                   export_obj=export)
-               if ret != 0:
-                   raise Exception(f"Failed to delete exports: {err} and {ret}")
-            log.info(f"All exports successfully deleted for cluster id: {cluster_id}")
         except KeyError:
             log.info("No exports to delete")
+            return
+        self.rados_namespace = cluster_id
+        for export in export_list:
+            ret, out, err = self._delete_export(cluster_id=cluster_id, pseudo_path=None,
+                                                export_obj=export)
+            if ret != 0:
+                raise Exception(f"Failed to delete exports: {err} and {ret}")
+        log.info(f"All exports successfully deleted for cluster id: {cluster_id}")
 
     @export_cluster_checker
     def list_exports(self, cluster_id, detailed):
@@ -592,8 +593,8 @@ class FSExport(object):
             log.warning(f"No exports to list for {cluster_id}")
             return 0, '', ''
         except Exception as e:
-            log.error(f"Failed to list exports for {cluster_id}")
-            return -errno.EINVAL, "", str(e)
+            log.exception(f"Failed to list exports for {cluster_id}")
+            return getattr(e, 'errno', -1), "", str(e)
 
     @export_cluster_checker
     def get_export(self, cluster_id, pseudo_path):
@@ -604,8 +605,8 @@ class FSExport(object):
             log.warning(f"No {pseudo_path} export to show for {cluster_id}")
             return 0, '', ''
         except Exception as e:
-            log.error(f"Failed to get {pseudo_path} export for {cluster_id}")
-            return -errno.EINVAL, "", str(e)
+            log.exception(f"Failed to get {pseudo_path} export for {cluster_id}")
+            return getattr(e, 'errno', -1), "", str(e)
 
 
 class NFSCluster:
@@ -670,8 +671,8 @@ class NFSCluster:
                 return 0, "NFS Cluster Created Successfully", ""
             return 0, "", f"{cluster_id} cluster already exists"
         except Exception as e:
-            log.warning("NFS Cluster could not be created")
-            return -errno.EINVAL, "", str(e)
+            log.exception(f"NFS Cluster {cluster_id} could not be created")
+            return getattr(e, 'errno', -1), "", str(e)
 
     @cluster_setter
     def update_nfs_cluster(self, cluster_id, placement):
@@ -681,8 +682,8 @@ class NFSCluster:
                 return 0, "NFS Cluster Updated Successfully", ""
             return -errno.ENOENT, "", "Cluster does not exist"
         except Exception as e:
-            log.warning("NFS Cluster could not be updated")
-            return -errno.EINVAL, "", str(e)
+            log.exception(f"NFS Cluster {cluster_id} could not be updated")
+            return getattr(e, 'errno', -1), "", str(e)
 
     @cluster_setter
     def delete_nfs_cluster(self, cluster_id):
@@ -698,12 +699,12 @@ class NFSCluster:
                 return 0, "NFS Cluster Deleted Successfully", ""
             return 0, "", "Cluster does not exist"
         except Exception as e:
-            log.warning("Failed to delete NFS Cluster")
-            return -errno.EINVAL, "", str(e)
+            log.exception(f"Failed to delete NFS Cluster {cluster_id}")
+            return getattr(e, 'errno', -1), "", str(e)
 
     def list_nfs_cluster(self):
         try:
             return 0, '\n'.join(available_clusters(self.mgr)), ""
         except Exception as e:
-            log.warning("Failed to list NFS Cluster")
-            return -errno.EINVAL, "", str(e)
+            log.exception("Failed to list NFS Cluster")
+            return getattr(e, 'errno', -1), "", str(e)