mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Feature #662: Bug in RM: one.image.delete was using the ImagePool instead of the ImageManager
This commit is contained in:
parent
d6017d4ba4
commit
0ac7a78ced
@ -42,6 +42,18 @@ protected:
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
void request_execute(xmlrpc_c::paramList const& _paramList);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
virtual int drop(int oid, PoolObjectSQL * object, string& error_msg)
|
||||
{
|
||||
int rc = pool->drop(object, error_msg);
|
||||
|
||||
object->unlock();
|
||||
|
||||
return rc;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -96,6 +108,11 @@ public:
|
||||
};
|
||||
|
||||
~ImageDelete(){};
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
int drop(int oid, PoolObjectSQL * object, string& error_msg);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -148,6 +165,10 @@ public:
|
||||
};
|
||||
|
||||
~UserDelete(){};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
int drop(int oid, PoolObjectSQL * object, string& error_msg);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -25,7 +25,6 @@ void RequestManagerDelete::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
{
|
||||
int oid = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
PoolObjectSQL * object;
|
||||
set<int> group_set;
|
||||
string error_msg;
|
||||
|
||||
if ( basic_authorization(oid) == false )
|
||||
@ -41,15 +40,7 @@ void RequestManagerDelete::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( auth_object == AuthRequest::USER )
|
||||
{
|
||||
User * user = static_cast<User *>(object);
|
||||
group_set = user->get_groups();
|
||||
}
|
||||
|
||||
int rc = pool->drop(object, error_msg);
|
||||
|
||||
object->unlock();
|
||||
int rc = drop(oid, object, error_msg);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
@ -58,7 +49,38 @@ void RequestManagerDelete::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( auth_object == AuthRequest::USER )
|
||||
success_response(oid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int ImageDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
ImageManager * imagem = nd.get_imagem();
|
||||
|
||||
object->unlock();
|
||||
int rc = imagem->delete_image(oid);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int UserDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
|
||||
{
|
||||
set<int> group_set;
|
||||
|
||||
User * user = static_cast<User *>(object);
|
||||
group_set = user->get_groups();
|
||||
|
||||
int rc = pool->drop(object, error_msg);
|
||||
|
||||
object->unlock();
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
GroupPool * gpool = nd.get_gpool();
|
||||
@ -83,8 +105,5 @@ void RequestManagerDelete::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
}
|
||||
}
|
||||
|
||||
success_response(oid);
|
||||
|
||||
return;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user