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

feature #4320: Add template cloning ID

This commit is contained in:
Ruben S. Montero 2016-05-05 14:46:50 +02:00
parent 01b1979a80
commit 244eec96ff
3 changed files with 13 additions and 7 deletions

View File

@ -133,7 +133,7 @@ Request::ErrorCode VMTemplateClone::clone(int source_id, const string &name,
{
return ec;
}
else if ( !recursive)
else if ( !recursive )
{
return SUCCESS;
}

View File

@ -69,16 +69,18 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
if (clone_template)
{
int new_id;
VMTemplateClone tmpl_clone;
string tmpl_name = name;
VMTemplateClone tmpl_clone;
string tmpl_name = name;
ostringstream oss;
if (tmpl_name.empty())
{
tmpl_name = original_tmpl_name + "-copy";
}
ErrorCode ec = tmpl_clone.request_execute(id, name, new_id, true,
ErrorCode ec = tmpl_clone.request_execute(id, tmpl_name, new_id, true,
str_uattrs, att);
if (ec != SUCCESS)
@ -88,7 +90,10 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
}
instantiate_id = new_id;
str_uattrs = "";
oss << "CLONING_TEMPLATE_ID=" << id << "\n";
str_uattrs = oss.str();
}
int vid;

View File

@ -1354,14 +1354,15 @@ void VirtualMachine::parse_well_known_attributes()
* INPUT
* FEATURES
* RAW
* CLONING_TEMPLATE_ID
*/
vector<Attribute *> v_attr;
vector<Attribute *>::iterator it;
string names[] = {"INPUT", "FEATURES", "RAW"};
string names[] = {"INPUT", "FEATURES", "RAW", "CLONING_TEMPLATE_ID"};
for (int i=0; i<3; i++)
for (int i=0; i<4; i++)
{
v_attr.clear();