1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-04-01 06:50:25 +03:00

Feature #1554: Make requirements and rank expressions able to search in /HOST/CLUSTER_TEMPLATE

This commit is contained in:
Carlos Martín 2013-01-22 15:07:57 +01:00
parent b676646656
commit 84c80c8d0f
2 changed files with 31 additions and 0 deletions

View File

@ -105,11 +105,13 @@ expr: STRING { float val = 0.0;
ostringstream xpath_t;
ostringstream xpath_s;
ostringstream xpath_c;
vector<string> results;
xpath_t << "/HOST/TEMPLATE/" << $1;
xpath_s << "/HOST/HOST_SHARE/" << $1;
xpath_c << "/HOST/CLUSTER_TEMPLATE/" << $1;
results = (*oxml)[xpath_t.str().c_str()];
@ -118,6 +120,11 @@ expr: STRING { float val = 0.0;
results = (*oxml)[xpath_s.str().c_str()];
}
if (results.size() == 0)
{
results = (*oxml)[xpath_c.str().c_str()];
}
if (results.size() != 0)
{
istringstream iss(results[0]);

View File

@ -214,6 +214,14 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
@ -248,6 +256,14 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}
@ -282,6 +298,14 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
xpath_h << "/HOST/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
if (results.size() == 0)
{
xpath_h.str("");
xpath_h << "/HOST/CLUSTER_TEMPLATE/" << attr;
results = (*oxml)[xpath_h.str().c_str()];
}
}
}