* New method access_group_map_destroy(pool_name, vol_name, ag_name) Revoke the rw access of certain access group to defined volume. Parameters: pool_name (str): The name of pool which defined volume belongs to. vol_name (str): The name of volume. ag_name (str): Access group name Returns: N/A Errors: N/A
Signed-off-by: Gris Ge fge@redhat.com --- API.md | 11 +++++++++++ targetd/block.py | 12 ++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/API.md b/API.md index 6fe769c..8a720ba 100644 --- a/API.md +++ b/API.md @@ -236,6 +236,17 @@ Errors: -1000: No free host_lun_id. LUN ID between 0 ~ 255 is in use. -200: Access group not found.
+### access_group_map_destroy(pool_name, vol_name, ag_name) +Revoke the rw access of certain access group to defined volume. +Parameters: + pool_name (str): The name of pool which defined volume belongs to. + vol_name (str): The name of volume. + ag_name (str): Access group name +Returns: + N/A +Errors: + N/A + File system operations ---------------------- Ability to create different file systems and perform operation on them. The diff --git a/targetd/block.py b/targetd/block.py index 3695f65..888e6e4 100644 --- a/targetd/block.py +++ b/targetd/block.py @@ -114,6 +114,7 @@ def initialize(config_dict): access_group_init_del=access_group_init_del, access_group_map_list=access_group_map_list, access_group_map_create=access_group_map_create, + access_group_map_destroy=access_group_map_destroy, )
@@ -571,3 +572,14 @@ def access_group_map_create(req, pool_name, vol_name, ag_name, h_lun_id=None):
node_acl_group.mapped_lun_group(h_lun_id, tpg_lun) RTSRoot().save_to_file() + + +def access_group_map_destroy(req, pool_name, vol_name, ag_name): + tpg = _get_iscsi_tpg() + node_acl_group = NodeACLGroup(tpg, ag_name) + tpg_lun = _tpg_lun_of(tpg, pool_name, vol_name) + for map_group in node_acl_group.mapped_lun_groups: + if map_group.tpg_lun == tpg_lun: + map_group.delete() + + RTSRoot().save_to_file()