mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Merge branch 'feature-2427' for scheduling different VNETs across VM NICS
This commit is contained in:
commit
c73e034f84
@ -33,8 +33,8 @@
|
||||
# 2 = Load-aware. Heuristic that tries to maximize resources available for
|
||||
# the VMs by using those nodes with less load
|
||||
# 3 = Custom.
|
||||
# - rank: Custom arithmetic expression to rank suitable hosts based in their
|
||||
# attributes
|
||||
# - rank: Custom arithmetic expression to rank suitable hosts based in
|
||||
# their attributes
|
||||
# 4 = Fixed. Hosts will be ranked according to the PRIORITY attribute found
|
||||
# in the Host or Cluster template.
|
||||
#
|
||||
@ -45,11 +45,24 @@
|
||||
# 1 = Striping. Tries to optimize I/O by distributing the VMs across
|
||||
# datastores.
|
||||
# 2 = Custom.
|
||||
# - rank: Custom arithmetic exprission to rank suitable datastores based on
|
||||
# their attributes
|
||||
# - rank: Custom arithmetic exprission to rank suitable datastores based
|
||||
# on their attributes
|
||||
# 3 = Fixed. Datastores will be ranked according to the PRIORITY attribute
|
||||
# found in the Datastore template.
|
||||
#
|
||||
# DEFAULT_NIC_SCHED: Definition of the default virtual network scheduler
|
||||
# - policy:
|
||||
# 0 = Packing. Tries to pack address usage by selecting the VNET with
|
||||
# less free leases
|
||||
# 1 = Striping. Tries to distribute address usage across VNETs.
|
||||
# 2 = Custom.
|
||||
# - rank: Custom arithmetic exprission to rank suitable datastores based
|
||||
# on their attributes
|
||||
# 3 = Fixed. Virtual Networks will be ranked according to the PRIORITY
|
||||
# attribute found in the Virtual Network template.
|
||||
#
|
||||
# DIFFERENT_VNETS: When set (YES) the NICs of a VM will be forced to be in
|
||||
# different Virtual Networks.
|
||||
#
|
||||
# LOG: Configuration for the logging system
|
||||
# - system: defines the logging system:
|
||||
@ -87,6 +100,8 @@ LIVE_RESCHEDS = 0
|
||||
|
||||
MEMORY_SYSTEM_DS_SCALE = 0
|
||||
|
||||
DIFFERENT_VNETS = YES
|
||||
|
||||
DEFAULT_SCHED = [
|
||||
policy = 1
|
||||
]
|
||||
@ -95,6 +110,10 @@ DEFAULT_DS_SCHED = [
|
||||
policy = 1
|
||||
]
|
||||
|
||||
DEFAULT_NIC_SCHED = [
|
||||
policy = 1
|
||||
]
|
||||
|
||||
#DEFAULT_SCHED = [
|
||||
# policy = 3,
|
||||
# rank = "- (RUNNING_VMS * 50 + FREE_CPU)"
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -157,6 +157,8 @@ void Scheduler::start()
|
||||
|
||||
conf.get("MEMORY_SYSTEM_DS_SCALE", mem_ds_scale);
|
||||
|
||||
conf.get("DIFFERENT_VNETS", diff_vnets);
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Log system & Configuration File
|
||||
// -----------------------------------------------------------
|
||||
@ -1517,13 +1519,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;
|
||||
|
||||
@ -1537,6 +1539,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 )
|
||||
@ -1584,14 +1591,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;
|
||||
|
||||
|
@ -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 = "YES";
|
||||
|
||||
attribute = new SingleAttribute("DIFFERENT_VNETS",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
//LOG CONFIGURATION
|
||||
vvalue.clear();
|
||||
vvalue.insert(make_pair("SYSTEM","file"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user