1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-08 20:58:17 +03:00

F #2260: Added new wrapper to pass Pool and ObjectType

This commit is contained in:
juanmont 2018-09-13 15:36:32 +02:00 committed by Ruben S. Montero
parent 8c2eaa2c38
commit b89a8fe5ca
2 changed files with 17 additions and 6 deletions

View File

@ -56,7 +56,17 @@ protected:
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

View File

@ -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;
@ -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 )
{
@ -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();
}