1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

Feature #1556: Move all the attributes used in the code to the internal template

This commit is contained in:
Carlos Martín 2013-02-26 13:03:40 +01:00
parent 1f37cbffbe
commit f1ee01cffa
2 changed files with 49 additions and 0 deletions

View File

@ -1192,6 +1192,12 @@ private:
*/
void parse_graphics();
/**
* Searches the meaningful attributes and moves them from the user template
* to the internal template
*/
void parse_well_known_attributes();
/**
* Function that renders the VM in XML format optinally including
* extended information (all history records)

View File

@ -392,6 +392,8 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
parse_graphics();
parse_well_known_attributes();
// ------------------------------------------------------------------------
// Insert the VM
// ------------------------------------------------------------------------
@ -866,6 +868,47 @@ error_cleanup:
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
void VirtualMachine::parse_well_known_attributes()
{
/*
* List of meaningful attributes, used in other places and expected in
* obj_template:
*
* DISK
* NIC
* VCPU
* MEMORY
* CPU
* CONTEXT
* OS
* GRAPHICS
*
* INPUT
* FEATURES
* RAW
*/
vector<Attribute *> v_attr;
vector<Attribute *>::iterator it;
string names[] = {"INPUT", "FEATURES", "RAW"};
for (int i=0; i<3; i++)
{
v_attr.clear();
user_obj_template->remove(names[i], v_attr);
for (it=v_attr.begin(); it != v_attr.end(); it++)
{
obj_template->set(*it);
}
}
}
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
static int check_and_set_cluster_id(const char * id_name,
VectorAttribute * vatt,
string& cluster_id)