mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Better check of drop/delete actions result and XML-RPC return data.
(cherry picked from commit f31fbb49bcd21c1109f51fdca7800b112f4d354f)
This commit is contained in:
parent
fa71b4180a
commit
2f57cb6647
@ -32,7 +32,7 @@ void RequestManager::ClusterDelete::execute(
|
||||
int clid;
|
||||
ostringstream oss;
|
||||
int rc;
|
||||
|
||||
|
||||
const string method_name = "ClusterDelete";
|
||||
|
||||
/* -- RPC specific vars -- */
|
||||
@ -74,7 +74,7 @@ void RequestManager::ClusterDelete::execute(
|
||||
}
|
||||
|
||||
// Return success
|
||||
arrayData.push_back(xmlrpc_c::value_boolean( rc == 0 )); // SUCCESS
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(true)); // SUCCESS
|
||||
arrayresult = new xmlrpc_c::value_array(arrayData);
|
||||
|
||||
// Copy arrayresult into retval mem space
|
||||
|
@ -33,7 +33,7 @@ void RequestManager::HostDelete::execute(
|
||||
Host * host;
|
||||
ostringstream oss;
|
||||
int rc;
|
||||
|
||||
|
||||
const string method_name = "HostDelete";
|
||||
|
||||
/* -- RPC specific vars -- */
|
||||
@ -79,8 +79,13 @@ void RequestManager::HostDelete::execute(
|
||||
|
||||
host->unlock();
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
goto error_host_drop;
|
||||
}
|
||||
|
||||
// All nice, return the host info to the client
|
||||
arrayData.push_back(xmlrpc_c::value_boolean( rc == 0 )); // SUCCESS
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(true)); // SUCCESS
|
||||
arrayresult = new xmlrpc_c::value_array(arrayData);
|
||||
|
||||
// Copy arrayresult into retval mem space
|
||||
@ -102,6 +107,10 @@ error_host_get:
|
||||
oss.str(get_error(method_name, "HOST", hid));
|
||||
goto error_common;
|
||||
|
||||
error_host_drop:
|
||||
oss.str(action_error(method_name, "DELETE", "HOST", hid, rc));
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
NebulaLog::log ("Rem",Log::ERROR,oss);
|
||||
|
||||
|
@ -33,14 +33,14 @@ void RequestManager::ImageDelete::execute(
|
||||
int iid;
|
||||
int uid;
|
||||
int rc;
|
||||
|
||||
|
||||
int image_owner;
|
||||
bool is_public;
|
||||
|
||||
Image * image;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
|
||||
const string method_name = "ImageDelete";
|
||||
|
||||
vector<xmlrpc_c::value> arrayData;
|
||||
@ -60,7 +60,7 @@ void RequestManager::ImageDelete::execute(
|
||||
{
|
||||
goto error_authenticate;
|
||||
}
|
||||
|
||||
|
||||
// Get image from the ImagePool
|
||||
image = ImageDelete::ipool->get(iid,true);
|
||||
|
||||
@ -68,12 +68,12 @@ void RequestManager::ImageDelete::execute(
|
||||
{
|
||||
goto error_image_get;
|
||||
}
|
||||
|
||||
|
||||
image_owner = image->get_uid();
|
||||
is_public = image->isPublic();
|
||||
|
||||
|
||||
image->unlock();
|
||||
|
||||
|
||||
//Authorize the operation
|
||||
if ( uid != 0 ) // uid == 0 means oneadmin
|
||||
{
|
||||
@ -101,14 +101,13 @@ void RequestManager::ImageDelete::execute(
|
||||
|
||||
rc = ImageDelete::ipool->drop(image);
|
||||
|
||||
image->unlock();
|
||||
|
||||
if ( rc < 0 )
|
||||
{
|
||||
goto error_delete;
|
||||
|
||||
}
|
||||
|
||||
image->unlock();
|
||||
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(true));
|
||||
arrayData.push_back(xmlrpc_c::value_int(iid));
|
||||
|
||||
|
@ -105,8 +105,13 @@ void RequestManager::VirtualNetworkDelete::execute(
|
||||
|
||||
vn->unlock();
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
goto error_vn_drop;
|
||||
}
|
||||
|
||||
// All nice, return the host info to the client
|
||||
arrayData.push_back(xmlrpc_c::value_boolean( rc == 0 )); // SUCCESS
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(true)); // SUCCESS
|
||||
arrayresult = new xmlrpc_c::value_array(arrayData);
|
||||
|
||||
// Copy arrayresult into retval mem space
|
||||
@ -128,6 +133,10 @@ error_vn_get:
|
||||
oss.str(get_error(method_name, "NET", nid));
|
||||
goto error_common;
|
||||
|
||||
error_vn_drop:
|
||||
oss.str(action_error(method_name, "DELETE", "NET",nid,rc));
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
NebulaLog::log ("ReM",Log::ERROR,oss);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user