mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
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:
parent
9bb7079a34
commit
dc075e0955
@ -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"]);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user