From a38db5d0fd21fcb0241e3de4998e9aca0252cf30 Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Wed, 21 Oct 2020 15:06:50 +0200 Subject: [PATCH] rgw: role: use svc->delete_role for deleting Signed-off-by: Abhishek Lekshmanan --- src/rgw/rgw_role.cc | 37 ++++++++++++++++++++----------------- src/rgw/rgw_role.h | 5 +++++ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index b6108f4e2fb..db4a2435ae7 100644 --- a/src/rgw/rgw_role.cc +++ b/src/rgw/rgw_role.cc @@ -102,26 +102,15 @@ int RGWRole::delete_obj(const DoutPrefixProvider *dpp, optional_yield y) return -ERR_DELETE_CONFLICT; } - // Delete id - ret = role_ctl->delete_info(id, y, dpp); - if (ret < 0) { - ldpp_dout(dpp, 0) << "ERROR: deleting role id: " - << id << ": " << cpp_strerror(-ret) << dendl; - } - - // Delete name - ret = role_ctl->delete_name(name, tenant, y, dpp); + RGWObjVersionTracker ot; + ret = role_ctl->delete_role(*this, y, dpp, + RGWRoleCtl::RemoveParams(). + set_objv_tracker(&ot)); if (ret < 0) { - ldpp_dout(dpp, 0) << "ERROR: deleting role: " - << name << ":" << cpp_strerror(-ret) << dendl; + ldpp_dout(dpp, 0) << "ERROR: deleting role: "<< id + << cpp_strerror(-ret) << dendl; } - // Delete path - ret = role_ctl->delete_path(id, path, tenant, y, dpp); - if (ret < 0) { - ldpp_dout(dpp, 0) << "ERROR: deleting role path:" - << path << ": " << cpp_strerror(-ret) << dendl; - } return ret; } @@ -482,6 +471,20 @@ RGWRoleCtl::read_name(const std::string& name, return make_pair(ret, role_id); } +int RGWRoleCtl::delete_role(const rgw::sal::RGWRole& info, + optional_yield y, + const DoutPrefixProvider *dpp, + const RemoveParams& params) +{ + return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { + return svc.role->delete_role(op->ctx(), + info, + params.objv_tracker, + y, dpp); + }); + return 0; +} + int RGWRoleCtl::delete_info(const std::string& role_id, optional_yield y, const DoutPrefixProvider *dpp, diff --git a/src/rgw/rgw_role.h b/src/rgw/rgw_role.h index 1b33089b30e..eb97a3e018c 100644 --- a/src/rgw/rgw_role.h +++ b/src/rgw/rgw_role.h @@ -333,6 +333,11 @@ public: const DoutPrefixProvider *dpp, const GetParams& params = {}); + int delete_role(const rgw::sal::RGWRole& role, + optional_yield y, + const DoutPrefixProvider *dpp, + const RemoveParams& params = {}); + int delete_info(const std::string& role_id, optional_yield y, const DoutPrefixProvider *dpp, -- 2.39.5