]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: include pseudo in JSON output when nfs export apply -i fails
authorDhairya Parmar <dparmar@redhat.com>
Mon, 28 Aug 2023 10:29:17 +0000 (15:59 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Mon, 4 Dec 2023 10:33:45 +0000 (16:03 +0530)
[
  {
    "msg": "Failed to apply export: export FSAL user_id must be 'nfs.my-nfs.1'",
    "state": "error"
  },
 {
    "msg": "Failed to apply export: export FSAL user_id must be 'nfs.my-nfs.2'",
    "state": "error"
 }
]

it is a bit of hassle to know which export's update/creation failed as the dict contains
no info about the export(like pseudo path), therefore with something like below, it is
much better to figure out which export block needs correction

[
  {
    "pseudo": "cephfs1",
    "msg": "Failed to apply export: export FSAL user_id must be 'nfs.my-nfs.1'",
    "state": "error"
  },
  {
    "pseudo": "cephfs2",
    "msg": "Failed to apply export: export FSAL user_id must be 'nfs.my-nfs.2'",
    "state": "error"
  }
]

Fixes: https://tracker.ceph.com/issues/62626
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
src/pybind/mgr/nfs/export.py

index aaa93c34f6c1969a501c4bb35298b15f6971c8b7..2d07cd6eab607808bf4403edc56c43c271cc71d3 100644 (file)
@@ -583,7 +583,8 @@ class ExportMgr:
         except Exception as ex:
             msg = f'Failed to apply export: {ex}'
             log.exception(msg)
-            return {"state": "error", "msg": msg, "exception": ex}
+            return {"state": "error", "msg": msg, "exception": ex,
+                    "pseudo": export['pseudo']}
 
     def _update_user_id(
             self,