/* -------------------------------------------------------------------------- */ /* Copyright 2002-2019, OpenNebula Project, OpenNebula Systems */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); you may */ /* not use this file except in compliance with the License. You may obtain */ /* a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ #include "RequestManagerChown.h" #include "PoolObjectSQL.h" #include "NebulaLog.h" #include "Nebula.h" /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ PoolObjectSQL * RequestManagerChown::get_and_quota( int oid, int new_uid, int new_gid, RequestAttributes& att, PoolSQL * pool, PoolObjectSQL::ObjectType auth_object) { std::map quota_map; std::map quota_to_rback; std::map::iterator it; int old_uid; int old_gid; std::string memory, cpu; PoolObjectSQL * object; object = pool->get(oid); if ( object == 0 ) { att.resp_id = oid; failure_response(NO_EXISTS, att); return 0; } if (auth_object == PoolObjectSQL::VM) { VirtualMachine * vm = static_cast(object); vector