From 389c10b238a8e8c456b75bab4b44ec3399ce840b Mon Sep 17 00:00:00 2001 From: juanmont Date: Thu, 13 Sep 2018 15:36:32 +0200 Subject: [PATCH] F #2260: Added new wrapper to pass Pool and ObjectType (cherry picked from commit b89a8fe5ca9e16a22ea540223b4ec07b2d03d599) --- include/RequestManagerChown.h | 12 +++++++++++- src/rm/RequestManagerChown.cc | 11 ++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/RequestManagerChown.h b/include/RequestManagerChown.h index 84b3b4aaf47..3d2baf6a60f 100644 --- a/include/RequestManagerChown.h +++ b/include/RequestManagerChown.h @@ -56,7 +56,17 @@ class RequestManagerChown : public Request PoolObjectSQL * get_and_quota(int oid, int new_uid, int new_gid, - RequestAttributes& att); + RequestAttributes& att) + { + return get_and_quota(oid, new_uid, new_gid, att, pool, auth_object); + } + + PoolObjectSQL * get_and_quota(int oid, + int new_uid, + int new_gid, + RequestAttributes& att, + PoolSQL * pool, + PoolObjectSQL::ObjectType auth_object); /** * Checks if the new owner cannot has other object with the same name (if diff --git a/src/rm/RequestManagerChown.cc b/src/rm/RequestManagerChown.cc index 491dbafc0d0..ac8773719d2 100644 --- a/src/rm/RequestManagerChown.cc +++ b/src/rm/RequestManagerChown.cc @@ -27,7 +27,9 @@ PoolObjectSQL * RequestManagerChown::get_and_quota( int oid, int new_uid, int new_gid, - RequestAttributes& att) + RequestAttributes& att, + PoolSQL * pool, + PoolObjectSQL::ObjectType auth_object) { std::map quota_map; std::map quota_to_rback; @@ -414,14 +416,13 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, // ------------------------------------------------------------------------- bool error_vm_quotas = false; - pool = Nebula::instance().get_vmpool(); - auth_object = PoolObjectSQL::VM; + PoolSQL * vm_pool = Nebula::instance().get_vmpool(); for (set::const_iterator it = vms.begin(); it != vms.end(); it++) { int vm_id = *it; - PoolObjectSQL * vm = get_and_quota(vm_id, noid, ngid, att); + PoolObjectSQL * vm = get_and_quota(vm_id, noid, ngid, att, vm_pool, PoolObjectSQL::VM); if ( vm == 0 ) { @@ -440,7 +441,7 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, vm->set_group(ngid, ngname); } - pool->update(vm); + vm_pool->update(vm); vm->unlock(); }