Skip to content

Commit 8c4a468

Browse files
committed
Merge PR ceph#55833 into main
* refs/pull/55833/head: qa: Add multifs root_squash testcase Reviewed-by: Venky Shankar <[email protected]>
2 parents f04992f + 1fda8ed commit 8c4a468

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

qa/tasks/cephfs/test_admin.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,8 @@ def test_mirroring_with_filesystem_reset(self):
13671367
class TestFsAuthorize(CephFSTestCase):
13681368
client_id = 'testuser'
13691369
client_name = 'client.' + client_id
1370+
CLIENTS_REQUIRED = 2
1371+
MDSS_REQUIRED = 3
13701372

13711373
def test_single_path_r(self):
13721374
PERM = 'r'
@@ -1406,6 +1408,46 @@ def test_single_path_rootsquash(self):
14061408
self.captester.conduct_neg_test_for_chown_caps()
14071409
self.captester.conduct_neg_test_for_truncate_caps()
14081410

1411+
def test_multifs_single_path_rootsquash(self):
1412+
"""
1413+
Test root_squash with multi fs
1414+
"""
1415+
self.fs1 = self.fs
1416+
self.fs2 = self.mds_cluster.newfs('testcephfs2')
1417+
self.mount_b.remount(cephfs_name=self.fs2.name)
1418+
self.captesters = (CapTester(self.mount_a), CapTester(self.mount_b))
1419+
1420+
if not isinstance(self.mount_a, FuseMount):
1421+
self.skipTest("only FUSE client has CEPHFS_FEATURE_MDS_AUTH_CAPS "
1422+
"needed to enforce root_squash MDS caps")
1423+
1424+
# Authorize client to fs1
1425+
PERM = 'rw'
1426+
FS_AUTH_CAPS = (('/', PERM, 'root_squash'),)
1427+
self.captester = CapTester(self.mount_a, '/')
1428+
self.fs1.authorize(self.client_id, FS_AUTH_CAPS)
1429+
1430+
# Authorize client to fs2
1431+
self.fs2.authorize(self.client_id, FS_AUTH_CAPS)
1432+
keyring = self.fs.mon_manager.get_keyring(self.client_id)
1433+
1434+
self._remount(self.mount_a, self.fs1.name, keyring)
1435+
self._remount(self.mount_b, self.fs2.name, keyring)
1436+
# testing MDS caps...
1437+
# Since root_squash is set in client caps, client can read but not
1438+
# write even though access level is set to "rw" on both fses
1439+
self.captester[0].conduct_pos_test_for_read_caps()
1440+
self.captester[0].conduct_pos_test_for_open_caps()
1441+
self.captester[0].conduct_neg_test_for_write_caps(sudo_write=True)
1442+
self.captester[0].conduct_neg_test_for_chown_caps()
1443+
self.captester[0].conduct_neg_test_for_truncate_caps()
1444+
1445+
self.captester[1].conduct_pos_test_for_read_caps()
1446+
self.captester[1].conduct_pos_test_for_open_caps()
1447+
self.captester[1].conduct_neg_test_for_write_caps(sudo_write=True)
1448+
self.captester[1].conduct_neg_test_for_chown_caps()
1449+
self.captester[1].conduct_neg_test_for_truncate_caps()
1450+
14091451
def test_single_path_rootsquash_issue_56067(self):
14101452
"""
14111453
That a FS client using root squash MDS caps allows non-root user to write data

0 commit comments

Comments
 (0)