Merge PR #29355 into master

* refs/pull/29355/head:
	mgr/volumes: set uid/gid of FS client's mount as 0/0

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2019-07-31 11:33:36 -07:00
commit a6066f4214
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
2 changed files with 37 additions and 0 deletions

View File

@ -157,6 +157,23 @@ class TestVolumes(CephFSTestCase):
if ce.exitstatus != errno.ENOENT:
raise
def test_default_uid_gid_subvolume(self):
subvolume = self._generate_random_subvolume_name()
expected_uid = 0
expected_gid = 0
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
subvol_path = self._get_subvolume_path(self.volname, subvolume)
# check subvolume's uid and gid
stat = self.mount_a.stat(subvol_path)
self.assertEqual(stat['st_uid'], expected_uid)
self.assertEqual(stat['st_gid'], expected_gid)
# remove subvolume
self._fs_cmd("subvolume", "rm", self.volname, subvolume)
### subvolume group operations
def test_subvolume_create_and_rm_in_group(self):
@ -309,6 +326,23 @@ class TestVolumes(CephFSTestCase):
# force remove subvolume
self._fs_cmd("subvolumegroup", "rm", self.volname, group, "--force")
def test_default_uid_gid_subvolume_group(self):
group = self._generate_random_group_name()
expected_uid = 0
expected_gid = 0
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
group_path = self._get_subvolume_group_path(self.volname, group)
# check group's uid and gid
stat = self.mount_a.stat(group_path)
self.assertEqual(stat['st_uid'], expected_uid)
self.assertEqual(stat['st_gid'], expected_gid)
# remove group
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
### snapshot operations
def test_subvolume_snapshot_create_and_rm(self):

View File

@ -69,6 +69,9 @@ class ConnectionPool(object):
assert self.ops_in_progress == 0
log.debug("Connecting to cephfs '{0}'".format(self.fs_name))
self.fs = cephfs.LibCephFS(rados_inst=self.mgr.rados)
log.debug("Setting user ID and group ID of CephFS mount as root...")
self.fs.conf_set("client_mount_uid", "0")
self.fs.conf_set("client_mount_gid", "0")
log.debug("CephFS initializing...")
self.fs.init()
log.debug("CephFS mounting...")