From db1255edab904d8d7b522474c77a8295fa648b3b Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 23 Nov 2020 11:38:27 +0530 Subject: [PATCH] mgr/volumes: Add tenant_id option to subvolume authorize Fixes: https://tracker.ceph.com/issues/44931 Signed-off-by: Kotresh HR (cherry picked from commit 39acfcc91c1b6a85f6fa96a5e894d81a7225f9dc) --- src/pybind/mgr/volumes/fs/volume.py | 3 ++- src/pybind/mgr/volumes/module.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/volumes/fs/volume.py b/src/pybind/mgr/volumes/fs/volume.py index ad1d562e83b..0924a9b61fe 100644 --- a/src/pybind/mgr/volumes/fs/volume.py +++ b/src/pybind/mgr/volumes/fs/volume.py @@ -213,12 +213,13 @@ class VolumeClient(object): authid = kwargs['auth_id'] groupname = kwargs['group_name'] accesslevel = kwargs['access_level'] + tenant_id = kwargs['tenant_id'] try: with open_volume(self, volname) as fs_handle: with open_group(fs_handle, self.volspec, groupname) as group: with open_subvol(self.mgr, fs_handle, self.volspec, group, subvolname, SubvolumeOpType.ALLOW_ACCESS) as subvolume: - key = subvolume.authorize(authid, accesslevel) + key = subvolume.authorize(authid, accesslevel, tenant_id) ret = 0, key, "" except VolumeException as ve: ret = self.volume_exception_to_retval(ve) diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py index b8b64859b7b..0ae663ced60 100644 --- a/src/pybind/mgr/volumes/module.py +++ b/src/pybind/mgr/volumes/module.py @@ -123,7 +123,8 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): 'name=sub_name,type=CephString ' 'name=auth_id,type=CephString ' 'name=group_name,type=CephString,req=false ' - 'name=access_level,type=CephString,req=false ', + 'name=access_level,type=CephString,req=false ' + 'name=tenant_id,type=CephString,req=false ', 'desc': "Allow a cephx auth ID access to a subvolume", 'perm': 'rw' }, @@ -520,7 +521,8 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): sub_name=cmd['sub_name'], auth_id=cmd['auth_id'], group_name=cmd.get('group_name', None), - access_level=cmd.get('access_level', 'rw')) + access_level=cmd.get('access_level', 'rw'), + tenant_id=cmd.get('tenant_id', None)) @mgr_cmd_wrap def _cmd_fs_subvolume_deauthorize(self, inbuf, cmd): -- 2.47.3