B #2053: Do not return failure on recursive delete (#1250)

(cherry picked from commit 18aee6583e)
This commit is contained in:
Pavel Czerný authored and Ruben S. Montero committed 2021-05-31 17:02:43 +02:00
1 parent 5d1928f0a9
commit ff089908d1
2 files changed
+11 -3

No files matched your search

+7 -3
View File
@@ -233,6 +233,8 @@ int TemplateDelete::drop(std::unique_ptr<PoolObjectSQL> object, bool recursive,
VirtualMachineDisks disks(true);
int tid = object->get_oid();
if (recursive)
{
static_cast<VMTemplate *>(object.get())->clone_disks(vdisks);
@@ -262,7 +264,7 @@ int TemplateDelete::drop(std::unique_ptr<PoolObjectSQL> object, bool recursive,
{
if ( img_delete.request_execute(iid, att) != SUCCESS )
{
NebulaLog::log("ReM", Log::ERROR, att.resp_msg);
NebulaLog::warn("ReM", att.resp_msg);
error_ids.insert(iid);
}
@@ -270,10 +272,12 @@ int TemplateDelete::drop(std::unique_ptr<PoolObjectSQL> object, bool recursive,
if ( !error_ids.empty() )
{
att.resp_msg = "Cannot delete " + object_name(PoolObjectSQL::IMAGE) +
att.resp_msg = "Template " + to_string(tid) +
" deleted, unable to recursively delete " +
object_name(PoolObjectSQL::IMAGE) +
": " + one_util::join(error_ids.begin(), error_ids.end(), ',');
return -1;
NebulaLog::warn("ReM", att.resp_msg);
}
return 0;
+4
View File
@@ -158,6 +158,10 @@ int VirtualMachineDisk::get_image_id(int &id, int uid) const
{
id = image->get_oid();
}
else
{
return -1;
}
return 0;
}