"""
# CephFS mount where read/write test will be conducted.
self.mount = mount
+ # Set new file creation path
+ self.new_file = os_path_join(self.mount.hostfs_mntpt, path.lstrip('/'), 'new_file')
# Path where out test file located.
self.path = self._gen_test_file_path(path)
# Data that out test file will contain.
self.data = self._gen_test_file_data()
+
self.mount.write_file(self.path, self.data)
log.info(f'Test file has been created on FS '
f'"{self.mount.cephfs_name}" at path "{self.path}" with the '
self.path = {self.path}
cephfs_name = {self.mount.cephfs_name}
cephfs_mntpt = {self.mount.cephfs_mntpt}
- hostfs_mntpt = {self.mount.hostfs_mntpt}''')
+ hostfs_mntpt = {self.mount.hostfs_mntpt}
+ self.new_file_path = {self.new_file}''')
def run_mds_cap_tests(self, perm, mntpt=None):
"""
# cephfs dir serving as root for current mnt: /dir1/dir2
# therefore, final path: /mnt/cephfs_x/testdir
self.path = self.path.replace(mntpt, '')
+ self.new_file = self.new_file.replace(mntpt, '')
self.conduct_pos_test_for_read_caps()
if perm == 'rw':
self.conduct_pos_test_for_write_caps()
+ self.conduct_pos_test_for_new_file_creation()
elif perm == 'r':
self.conduct_neg_test_for_write_caps()
else:
log.info('absence of write perm was tested successfully: '
f'failed to be write data to file {self.path}.')
+ def conduct_pos_test_for_new_file_creation(self, sudo_write=False):
+ log.info(f'test write perm: try creating a new "{self.new_file}"')
+ self.mount.create_file(self.new_file)
+ log.info(f'write perm was tested successfully: new file "{self.new_file}" '
+ 'created successfully')
+
class CapTester(MonCapTester, MdsCapTester):
'''
self._remount(keyring)
self.captester.run_mds_cap_tests(PERM)
+ def test_fs_read_and_single_path_rw(self):
+ """
+ Tests the file creation using 'touch' cmd on a specific path
+ which has 'rw' caps and 'r' caps on the rest of the fs.
+
+ The mds auth caps with 'rw' caps on a specific path and 'r' caps
+ on the rest of the fs has an issue. The file creation using 'touch'
+ cmd on the fuse client used to fail while doing setattr.
+ Please see https://tracker.ceph.com/issues/67212
+
+ The new file creation test using 'touch' cmd is added to
+ 'MdsCapTester.run_mds_cap_tests' which eventually gets
+ called by '_remount_and_run_tests'
+ """
+ FS_AUTH_CAPS = (('/', 'r'), ('/dir2', 'rw'))
+ self.mount_a.run_shell('mkdir -p ./dir2')
+ self.captesters = (CapTester(self.mount_a, '/'),
+ CapTester(self.mount_a, '/dir2'))
+ keyring = self.fs.authorize(self.client_id, FS_AUTH_CAPS)
+
+ self._remount_and_run_tests(FS_AUTH_CAPS, keyring)
+
def test_multiple_path_r(self):
PERM = 'r'
FS_AUTH_CAPS = (('/dir1/dir12', PERM), ('/dir2/dir22', PERM))