1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #5575: Fix onevm chown error msg on quota limit (#1528)

(cherry picked from commit ad558f2f7d5bcc951c85ed81bae164bc8bcf7721)
This commit is contained in:
Pavel Czerný 2021-10-15 17:11:22 +02:00 committed by Ruben S. Montero
parent d0f13f283e
commit f10f73ce33
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -41,7 +41,7 @@ unique_ptr<PoolObjectSQL> RequestManagerChown::get_and_quota(
std::string memory, cpu;
auto object = pool->get<PoolObjectSQL>(oid);
auto object = pool->get_ro<PoolObjectSQL>(oid);
if ( object == nullptr )
{
@ -174,15 +174,7 @@ unique_ptr<PoolObjectSQL> RequestManagerChown::get_and_quota(
}
}
if (!error)
{
for (auto& it : quota_to_rback)
{
quota_rollback(it.second.get(), it.first, att_old);
}
object = pool->get<PoolObjectSQL>(oid);
}
object = pool->get<PoolObjectSQL>(oid);
// -------------------------------------------------------------------------
// Error or object deleted. Rollback chown quota operation. Add again usage
@ -192,25 +184,25 @@ unique_ptr<PoolObjectSQL> RequestManagerChown::get_and_quota(
{
for (auto& it : quota_to_rback)
{
if ( object == nullptr )
{
quota_authorization(it.second.get(), it.first, att_old, att.resp_msg);
}
quota_rollback(it.second.get(), it.first, att_new);
}
if ( object == 0 )
if ( error )
{
failure_response(AUTHORIZATION, att);
}
else
{
att.resp_id = oid;
failure_response(NO_EXISTS, att);
}
else
{
failure_response(AUTHORIZATION, att);
}
object = nullptr;
return nullptr;
}
for (auto& it : quota_to_rback)
{
quota_rollback(it.second.get(), it.first, att_old);
}
return object;