1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-12 09:17:41 +03:00

Feature #1483 #1556: Separate requirements in two attributes

AUTOMATIC_REQUIREMNTS is set by the core, cannot be edited.
SCHED_REQUIREMENTS can be set and edited by the users.
This commit is contained in:
Carlos Martín 2013-02-08 12:46:35 +01:00
parent 9bb7079a34
commit dc075e0955
2 changed files with 18 additions and 12 deletions

View File

@ -73,15 +73,29 @@ void VirtualMachineXML::init_attributes()
}
}
result = ((*this)["/VM/USER_TEMPLATE/SCHED_REQUIREMENTS"]);
result = ((*this)["/VM/TEMPLATE/AUTOMATIC_REQUIREMENTS"]);
if (result.size() > 0)
{
requirements = result[0];
}
else
result = ((*this)["/VM/USER_TEMPLATE/SCHED_REQUIREMENTS"]);
if (result.size() > 0)
{
requirements = "";
if ( !requirements.empty() )
{
ostringstream oss;
oss << requirements << " & ( " << result[0] << " )";
requirements = oss.str();
}
else
{
requirements = result[0];
}
}
result = ((*this)["/VM/HISTORY_RECORDS/HISTORY/HID"]);

View File

@ -980,15 +980,7 @@ int VirtualMachine::automatic_requirements(string& error_str)
oss.str("");
oss << "CLUSTER_ID = " << cluster_id;
user_obj_template->get("SCHED_REQUIREMENTS", requirements);
user_obj_template->erase("SCHED_REQUIREMENTS");
if ( !requirements.empty() )
{
oss << " & ( " << requirements << " )";
}
user_obj_template->add("SCHED_REQUIREMENTS", oss.str());
obj_template->add("AUTOMATIC_REQUIREMENTS", oss.str());
}
return 0;