mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #201: Use HOST attributes in REQUIREMENTS. Now you can use CLUSTER to filter hosts
This commit is contained in:
parent
a778c8be0c
commit
31b8f05a65
@ -1867,22 +1867,29 @@ extern "C" void expr_bool_error(
|
||||
|
||||
void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
|
||||
{
|
||||
//TODO: pass xpath base
|
||||
ostringstream xpath_t;
|
||||
ostringstream xpath_s;
|
||||
|
||||
vector<string> results;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
|
||||
val = 0;
|
||||
|
||||
//TODO: pass xpath base
|
||||
vector<string> results;
|
||||
ostringstream xpath_t;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
results = (*oxml)[xpath_t.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_s;
|
||||
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
results = (*oxml)[xpath_s.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_h;
|
||||
|
||||
xpath_h << "/HOST/" << attr;
|
||||
results = (*oxml)[xpath_h.str().c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() != 0)
|
||||
@ -1894,22 +1901,29 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
|
||||
|
||||
void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
|
||||
{
|
||||
val = 0.0;
|
||||
|
||||
//TODO: pass xpath base
|
||||
ostringstream xpath_t;
|
||||
ostringstream xpath_s;
|
||||
|
||||
vector<string> results;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
|
||||
val = 0.0;
|
||||
|
||||
results = (*oxml)[xpath_t.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_s;
|
||||
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
results = (*oxml)[xpath_s.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_h;
|
||||
|
||||
xpath_h << "/HOST/" << attr;
|
||||
results = (*oxml)[xpath_h.str().c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() != 0)
|
||||
@ -1921,22 +1935,29 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
|
||||
|
||||
void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
|
||||
{
|
||||
val = "";
|
||||
|
||||
//TODO: pass xpath base
|
||||
ostringstream xpath_t;
|
||||
ostringstream xpath_s;
|
||||
|
||||
vector<string> results;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
|
||||
val = "";
|
||||
|
||||
results = (*oxml)[xpath_t.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_s;
|
||||
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
results = (*oxml)[xpath_s.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_h;
|
||||
|
||||
xpath_h << "/HOST/" << attr;
|
||||
results = (*oxml)[xpath_h.str().c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() != 0)
|
||||
|
@ -188,22 +188,29 @@ extern "C" void expr_bool_error(
|
||||
|
||||
void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
|
||||
{
|
||||
//TODO: pass xpath base
|
||||
ostringstream xpath_t;
|
||||
ostringstream xpath_s;
|
||||
|
||||
vector<string> results;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
|
||||
val = 0;
|
||||
|
||||
//TODO: pass xpath base
|
||||
vector<string> results;
|
||||
ostringstream xpath_t;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
results = (*oxml)[xpath_t.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_s;
|
||||
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
results = (*oxml)[xpath_s.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_h;
|
||||
|
||||
xpath_h << "/HOST/" << attr;
|
||||
results = (*oxml)[xpath_h.str().c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() != 0)
|
||||
@ -215,22 +222,29 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, int& val)
|
||||
|
||||
void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
|
||||
{
|
||||
val = 0.0;
|
||||
|
||||
//TODO: pass xpath base
|
||||
ostringstream xpath_t;
|
||||
ostringstream xpath_s;
|
||||
|
||||
vector<string> results;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
|
||||
val = 0.0;
|
||||
|
||||
results = (*oxml)[xpath_t.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_s;
|
||||
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
results = (*oxml)[xpath_s.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_h;
|
||||
|
||||
xpath_h << "/HOST/" << attr;
|
||||
results = (*oxml)[xpath_h.str().c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() != 0)
|
||||
@ -242,22 +256,29 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, float& val)
|
||||
|
||||
void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val)
|
||||
{
|
||||
val = "";
|
||||
|
||||
//TODO: pass xpath base
|
||||
ostringstream xpath_t;
|
||||
ostringstream xpath_s;
|
||||
|
||||
vector<string> results;
|
||||
|
||||
xpath_t << "/HOST/TEMPLATE/" << attr;
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
|
||||
val = "";
|
||||
|
||||
results = (*oxml)[xpath_t.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_s;
|
||||
|
||||
xpath_s << "/HOST/HOST_SHARE/" << attr;
|
||||
results = (*oxml)[xpath_s.str().c_str()];
|
||||
|
||||
if (results.size() == 0)
|
||||
{
|
||||
ostringstream xpath_h;
|
||||
|
||||
xpath_h << "/HOST/" << attr;
|
||||
results = (*oxml)[xpath_h.str().c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() != 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user