1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

feature : Return error when a template image cannot be deleted

(recursive mode)
This commit is contained in:
Ruben S. Montero 2016-02-29 18:30:22 +01:00
parent a4dc856406
commit 674801b4be

@ -15,6 +15,7 @@
/* -------------------------------------------------------------------------- */
#include "RequestManagerDelete.h"
#include "NebulaUtil.h"
using namespace std;
@ -152,6 +153,7 @@ void TemplateDelete::request_execute(
VMTemplate * object;
string error_msg;
vector<int> img_ids;
set<int> error_ids;
ErrorCode ec;
if (paramList.size() > 2)
@ -205,12 +207,23 @@ void TemplateDelete::request_execute(
if (ec != SUCCESS)
{
NebulaLog::log("ReM", Log::ERROR, failure_message(ec, att));
}
// TODO rollback?
error_ids.insert(*it);
rc = -1;
}
}
}
if ( rc != 0 )
{
att.resp_msg = "Cannot delete " + object_name(PoolObjectSQL::IMAGE) +
": " + one_util::join<set<int>::iterator>(error_ids.begin(),
error_ids.end(), ',');
failure_response(ACTION, att);
return;
}
success_response(oid, att);
return;