mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
(cherry picked from commit 18aee6583e5646863a85a79e1538bbb56bb203d9)
This commit is contained in:
parent
5d1928f0a9
commit
ff089908d1
@ -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;
|
||||
|
@ -158,6 +158,10 @@ int VirtualMachineDisk::get_image_id(int &id, int uid) const
|
||||
{
|
||||
id = image->get_oid();
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user