diff --git a/src/rm/RequestManagerClusterDelete.cc b/src/rm/RequestManagerClusterDelete.cc index ddfcee56e3..5c1010be1c 100644 --- a/src/rm/RequestManagerClusterDelete.cc +++ b/src/rm/RequestManagerClusterDelete.cc @@ -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 diff --git a/src/rm/RequestManagerHostDelete.cc b/src/rm/RequestManagerHostDelete.cc index 0a453a8f56..662bf42c2a 100644 --- a/src/rm/RequestManagerHostDelete.cc +++ b/src/rm/RequestManagerHostDelete.cc @@ -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); diff --git a/src/rm/RequestManagerImageDelete.cc b/src/rm/RequestManagerImageDelete.cc index 20875bf5f7..3c876de8ef 100644 --- a/src/rm/RequestManagerImageDelete.cc +++ b/src/rm/RequestManagerImageDelete.cc @@ -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 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)); diff --git a/src/rm/RequestManagerVirtualNetworkDelete.cc b/src/rm/RequestManagerVirtualNetworkDelete.cc index 4a44d445c2..184550fc12 100644 --- a/src/rm/RequestManagerVirtualNetworkDelete.cc +++ b/src/rm/RequestManagerVirtualNetworkDelete.cc @@ -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);