mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
Merge monitor information for the VM (instead of recreating). Update
Template.merge interface
This commit is contained in:
parent
2560c2da92
commit
03b7b77ce8
@ -394,11 +394,8 @@ public:
|
||||
* replacing the existing ones
|
||||
*
|
||||
* @param from_tmpl the template to be merged
|
||||
* @param error_str string describing the error
|
||||
*
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int merge(const Template * from_tmpl, string& error_str);
|
||||
void merge(const Template * from_tmpl);
|
||||
|
||||
/**
|
||||
* Deletes all restricted attributes
|
||||
|
@ -41,20 +41,22 @@ public:
|
||||
*/
|
||||
int update(const string& monitor_data, string& error)
|
||||
{
|
||||
VirtualMachineMonitorInfo new_info;
|
||||
|
||||
char * error_c = 0;
|
||||
|
||||
clear();
|
||||
|
||||
int rc = parse(monitor_data, &error_c);
|
||||
|
||||
if (rc != 0)
|
||||
if (new_info.parse(monitor_data, &error_c) != 0)
|
||||
{
|
||||
error = error_c;
|
||||
|
||||
free(error_c);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
merge(&new_info);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
char remove_state()
|
||||
|
@ -248,8 +248,6 @@ int Host::update_info(Template &tmpl,
|
||||
int vmid;
|
||||
float val;
|
||||
|
||||
string error_st;
|
||||
|
||||
ostringstream zombie;
|
||||
ostringstream wild;
|
||||
|
||||
@ -286,7 +284,7 @@ int Host::update_info(Template &tmpl,
|
||||
// Copy monitor, extract share info & update last_monitored and state
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
obj_template->merge(&tmpl, error_st);
|
||||
obj_template->merge(&tmpl);
|
||||
|
||||
touch(true);
|
||||
|
||||
|
@ -200,8 +200,7 @@ int PoolObjectSQL::replace_template(
|
||||
{
|
||||
obj_template->remove_all_except_restricted();
|
||||
|
||||
string aux_error;
|
||||
new_tmpl->merge(obj_template, aux_error);
|
||||
new_tmpl->merge(obj_template);
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +259,8 @@ int PoolObjectSQL::append_template(
|
||||
{
|
||||
old_tmpl = new Template(*obj_template);
|
||||
|
||||
obj_template->merge(new_tmpl, error);
|
||||
obj_template->merge(new_tmpl);
|
||||
|
||||
delete new_tmpl;
|
||||
}
|
||||
else
|
||||
|
@ -271,12 +271,7 @@ Request::ErrorCode VMTemplateInstantiate::merge(
|
||||
}
|
||||
}
|
||||
|
||||
rc = tmpl->merge(&uattrs, att.resp_msg);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
return INTERNAL;
|
||||
}
|
||||
tmpl->merge(&uattrs);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ int Template::from_xml_node(const xmlNodePtr node)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
int Template::merge(const Template * from_tmpl, string& error_str)
|
||||
void Template::merge(const Template * from_tmpl)
|
||||
{
|
||||
multimap<string,Attribute *>::const_iterator it;
|
||||
|
||||
@ -600,8 +600,6 @@ int Template::merge(const Template * from_tmpl, string& error_str)
|
||||
{
|
||||
this->set(it->second->clone());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -4166,8 +4166,7 @@ int VirtualMachine::replace_template(
|
||||
{
|
||||
user_obj_template->remove_all_except_restricted();
|
||||
|
||||
string aux_error;
|
||||
new_tmpl->merge(user_obj_template, aux_error);
|
||||
new_tmpl->merge(user_obj_template);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4208,7 +4207,7 @@ int VirtualMachine::append_template(
|
||||
|
||||
if (user_obj_template != 0)
|
||||
{
|
||||
user_obj_template->merge(new_tmpl, error);
|
||||
user_obj_template->merge(new_tmpl);
|
||||
delete new_tmpl;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user