Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F #2427 different nets #2535

Merged
merged 2 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/scheduler/include/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class Scheduler: public ActionListener
machines_limit(0),
dispatch_limit(0),
host_dispatch_limit(0),
mem_ds_scale(0)
mem_ds_scale(0),
diff_vnets(false)
{
am.addListener(this);
};
Expand Down Expand Up @@ -227,6 +228,11 @@ class Scheduler: public ActionListener
*/
float mem_ds_scale;

/**
* Boolean to dispatch the VM inside different vnets
*/
bool diff_vnets;

/**
* oned runtime configuration values
*/
Expand Down
34 changes: 28 additions & 6 deletions src/scheduler/src/sched/Scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void Scheduler::start()
ostringstream oss;

string etc_path;
string diff_vnets_str;

unsigned int live_rescheds;

Expand Down Expand Up @@ -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
// -----------------------------------------------------------
Expand Down Expand Up @@ -1517,13 +1534,13 @@ void Scheduler::dispatch()
//------------------------------------------------------------------
// Get the highest ranked network
//------------------------------------------------------------------
extra.clear();
extra.str("");

set<int> nics_ids = vm->get_nics_ids();

map<int, int> matched_networks;

unsigned int num_mached_networks = 0;
unsigned int num_matched_networks = 0;

set<int>::iterator it;

Expand All @@ -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 )
Expand Down Expand Up @@ -1584,14 +1606,14 @@ void Scheduler::dispatch()
matched_networks[netid] = 1;
}

num_mached_networks++;
num_matched_networks++;

extra << "NIC=[NIC_ID=\"" << nic_id
<< "\", NETWORK_MODE=\"auto\" , NETWORK_ID=\"" << netid
extra << "NIC=[NIC_ID=\"" << nic_id
<< "\", NETWORK_MODE=\"auto\" , NETWORK_ID=\"" << netid
<< "\"]";
}

if ( num_mached_networks < nics_ids.size())
if ( num_matched_networks < nics_ids.size())
{
map<int,int>::iterator it;

Expand Down
6 changes: 6 additions & 0 deletions src/scheduler/src/sched/SchedulerTemplate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down