Skip to content

Commit

Permalink
F #2260: Added new wrapper to pass Pool and ObjectType
Browse files Browse the repository at this point in the history
(cherry picked from commit b89a8fe)
  • Loading branch information
juanmont authored and Ruben S. Montero committed Sep 13, 2018
1 parent 8e3d7f8 commit 389c10b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 11 additions & 1 deletion include/RequestManagerChown.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions src/rm/RequestManagerChown.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Quotas::QuotaType, Template *> quota_map;
std::map<Quotas::QuotaType, Template *> quota_to_rback;
Expand Down Expand Up @@ -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<int>::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 )
{
Expand All @@ -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();
}
Expand Down

0 comments on commit 389c10b

Please sign in to comment.