mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
Feature #1678: small refactor
This commit is contained in:
parent
51124a9d12
commit
bf8c8f1646
@ -174,15 +174,11 @@ public:
|
||||
{
|
||||
string err;
|
||||
|
||||
monitor_data.get("TOTAL_MB", total_mb);
|
||||
monitor_data.get("FREE_MB", free_mb);
|
||||
monitor_data.get("USED_MB", used_mb);
|
||||
|
||||
monitor_data.erase("TOTAL_MB");
|
||||
monitor_data.erase("FREE_MB");
|
||||
monitor_data.erase("USED_MB");
|
||||
|
||||
obj_template->merge(&monitor_data, err);
|
||||
|
||||
erase_template_attribute("TOTAL_MB", total_mb);
|
||||
erase_template_attribute("FREE_MB", free_mb);
|
||||
erase_template_attribute("USED_MB", used_mb);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -381,6 +381,21 @@ public:
|
||||
return obj_template->erase(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and removes a boolean based attribute (single)
|
||||
* @param name of the attribute
|
||||
* @param value of the attribute (a boolean), will be false if not defined or
|
||||
* not a single attribute
|
||||
* @return the number of attributes erased
|
||||
*/
|
||||
int erase_template_attribute(
|
||||
const char * name,
|
||||
bool& value)
|
||||
{
|
||||
obj_template->get(name,value);
|
||||
return obj_template->erase(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an int based attribute (single)
|
||||
* @param name of the attribute
|
||||
|
@ -341,8 +341,7 @@ int Host::update_info(string &parse_str,
|
||||
// Correlate VM information with the list of running VMs //
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
get_template_attribute("VM_POLL", with_vm_info);
|
||||
remove_template_attribute("VM_POLL");
|
||||
erase_template_attribute("VM_POLL", with_vm_info);
|
||||
|
||||
obj_template->remove("VM", vm_att);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user