1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #2427: Added option to pick differents networks for a VM

This commit is contained in:
juanmont 2018-10-19 16:53:04 +02:00
parent b797a7e512
commit 0a065d8b2e
3 changed files with 35 additions and 1 deletions

View File

@ -83,7 +83,8 @@ protected:
machines_limit(0),
dispatch_limit(0),
host_dispatch_limit(0),
mem_ds_scale(0)
mem_ds_scale(0),
diff_vnets(false)
{
am.addListener(this);
};
@ -227,6 +228,11 @@ private:
*/
float mem_ds_scale;
/**
* Boolean to dispatch the VM inside different vnets
*/
bool diff_vnets;
/**
* oned runtime configuration values
*/

View File

@ -108,6 +108,7 @@ void Scheduler::start()
ostringstream oss;
string etc_path;
string diff_vnets_str;
unsigned int live_rescheds;
@ -157,6 +158,22 @@ void Scheduler::start()
conf.get("MEMORY_SYSTEM_DS_SCALE", mem_ds_scale);
conf.get("DIFFERENT_VNETS", diff_vnets_str);
one_util::toupper(diff_vnets_str);
if (diff_vnets_str != "" )
{
if ( diff_vnets_str == "NO" )
{
diff_vnets = false;
}
else if ( diff_vnets_str == "YES" )
{
diff_vnets = true;
}
}
// -----------------------------------------------------------
// Log system & Configuration File
// -----------------------------------------------------------
@ -1537,6 +1554,11 @@ void Scheduler::dispatch()
for (n = net_resources.rbegin() ; n != net_resources.rend(); n++)
{
if ( diff_vnets && matched_networks.find((*n)->oid) != matched_networks.end() )
{
continue;
}
net = vnetpool->get((*n)->oid);
if ( net == 0 )

View File

@ -122,6 +122,12 @@ void SchedulerTemplate::set_conf_default()
attribute = new SingleAttribute("MEMORY_SYSTEM_DS_SCALE",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//DIFFERENT_VNETS
value = "NO";
attribute = new SingleAttribute("DIFFERENT_VNETS",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//LOG CONFIGURATION
vvalue.clear();
vvalue.insert(make_pair("SYSTEM","file"));