1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

B #4979: Remove OPENNEBULA_MANAGED in vm template clone (recursive)

(cherry picked from commit a84237a1dd)
This commit is contained in:
Ruben S. Montero 2020-07-14 17:36:43 +02:00
parent 472ee2bccf
commit 34bc68017a
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 9 additions and 3 deletions

View File

@ -129,6 +129,8 @@ protected:
return vm_instantiate.merge(tmpl, s_a, att);
};
static const std::vector<const char*> REMOVE_DISK_ATTRS;
};
/* ------------------------------------------------------------------------- */

View File

@ -119,6 +119,9 @@ Request::ErrorCode RequestManagerClone::clone(int source_id, const string &name,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
const std::vector<const char*> VMTemplateClone::REMOVE_DISK_ATTRS = {
"IMAGE", "IMAGE_UNAME", "IMAGE_UID", "OPENNEBULA_MANAGED"};
Request::ErrorCode VMTemplateClone::clone(int source_id, const string &name,
int &new_id, bool recursive, const string& s_uattr, RequestAttributes& att)
{
@ -198,9 +201,10 @@ Request::ErrorCode VMTemplateClone::clone(int source_id, const string &name,
goto error_images;
}
(*disk)->remove("IMAGE");
(*disk)->remove("IMAGE_UNAME");
(*disk)->remove("IMAGE_UID");
for (auto attr : REMOVE_DISK_ATTRS)
{
(*disk)->remove(attr);
}
(*disk)->replace("IMAGE_ID", new_img_id);