reef: mgr/nfs: disallow non-existent paths when creating export#50808
reef: mgr/nfs: disallow non-existent paths when creating export#50808
Conversation
this helper instantiates CephfsClient, however this was initially planned in ExportMgr class in export.py but due to make check failure where main python thread experienced a dead lock which after several efforts pointed at instantiation of CephfsClient in ExportMgr was problematic, it was decided in order to achieve singleton behavior, func has been added inside this helper func that restricts instantiation using functool's lru_cache. Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 1356992)
Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 6334e10)
Fixes: https://tracker.ceph.com/issues/58228 Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 992c686)
Fixes: https://tracker.ceph.com/issues/58228 Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit b0bb250)
Fixes: https://tracker.ceph.com/issues/58228 Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit afaf251)
Also adds a function _nfs_complete_cmd() that returns process obj so that stdout/stderr can be used for evaluation(_nfs_cmd() uses raw_cluster_cmd() that returns just stdout and it became difficult to time cluster creation errors in _test_create_cluster()). It takes sometime to update the cluster data, therefore running the command set (check nfs server status -> nfs cluster create test -> check cluster status) in a loop (max six iteration with sleep of 5 secs at each iteration) fixes the issue. Fixes: https://tracker.ceph.com/issues/58744 Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 7cb3e58)
…terid' Fixes: https://tracker.ceph.com/issues/58758 Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 3b3fa71)
Comment in the code says to wait for two minutes as cluster creation takes time but actually it's waiting for thirteen minutes, it's not required to wait this long, i think a minute here is more than enough, also switched to using safe_while(). Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 503f867)
_get_port_ip_info() fails to fetch port and ip due to empty 'backend' key:
2023-02-24T20:49:09.084 DEBUG:teuthology.orchestra.run.smithi042:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph nfs cluster info test
2023-02-24T20:49:09.471 INFO:teuthology.orchestra.run.smithi042.stdout:{
2023-02-24T20:49:09.472 INFO:teuthology.orchestra.run.smithi042.stdout: "test": {
2023-02-24T20:49:09.472 INFO:teuthology.orchestra.run.smithi042.stdout: "backend": [],
2023-02-24T20:49:09.472 INFO:teuthology.orchestra.run.smithi042.stdout: "virtual_ip": null
2023-02-24T20:49:09.472 INFO:teuthology.orchestra.run.smithi042.stdout: }
2023-02-24T20:49:09.472 INFO:teuthology.orchestra.run.smithi042.stdout:}
it then raises:
2023-02-24T20:49:10.323 INFO:tasks.cephfs_test_runner: info_output = json.loads(self._nfs_cmd('cluster', 'info', self.cluster_id))['test']['backend'][0]
2023-02-24T20:49:10.323 INFO:tasks.cephfs_test_runner:IndexError: list index out of range
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit 310286f)
- Renamed to cephfs_path_is_dir
- Removed exception handling to prevent redundant log statements like:
"No such file or directory error in stat: b'/mnt/testdir_symlink': No such file or directory [Errno 2]"
Exceptions handled inside caller eliminates this redundancy
- Set modifier flag AT_SYMLINK_NOFOLLOW
- Removed string "{path} is not a dir" when raising NotADirectoryError
Rationale: will be handled in export.py
- change mock to cephfs_path_is_dir
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit f3d7370)
in create_cephfs_export() Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit d759fe4)
It actually didn't test the invalid path but still ended with ENOENT(which is expected in case path is invalid) as the test didn't create a fs, and it failed saying "FS nfs-cephfs not found" which too raises ENOENT and thus it always passed. Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 5cc0857)
- test_nfs_export_creation_at_filepath: ENOTDIR is raised instead of EINVAL which is better aligned with the nature of the failure - test_nfs_export_creation_at_symlink: ENOTDIR is raised instead of ENOENT since the code can now check if the path is symlink but won't follow it. Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 0c89625)
Signed-off-by: Dhairya Parmar <dparmar@redhat.com> (cherry picked from commit 7a6ab31)
|
jenkins test api |
|
jenkins test make check |
|
Rados suite review: https://pulpito.ceph.com/?branch=wip-yuri6-testing-2023-04-26-1247-reef Failures, unrelated: Details: |
Backport tracker: https://tracker.ceph.com/issues/59251, https://tracker.ceph.com/issues/59248 and https://tracker.ceph.com/issues/59245
Backport of #49460
Parent tracker: https://tracker.ceph.com/issues/58228, https://tracker.ceph.com/issues/58744 and https://tracker.ceph.com/issues/58758
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows