mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #360: Add parser for scheduler configuration file. Add configuration file for sched
This commit is contained in:
parent
52819b7909
commit
755f372a30
@ -75,7 +75,6 @@ const char * OpenNebulaTemplate::conf_name="oned.conf";
|
||||
|
||||
void OpenNebulaTemplate::set_conf_default()
|
||||
{
|
||||
ostringstream os;
|
||||
SingleAttribute * attribute;
|
||||
VectorAttribute * vattribute;
|
||||
string value;
|
||||
|
51
src/scheduler/etc/sched.conf
Normal file
51
src/scheduler/etc/sched.conf
Normal file
@ -0,0 +1,51 @@
|
||||
#*******************************************************************************
|
||||
# OpenNebula Configuration file
|
||||
#*******************************************************************************
|
||||
|
||||
#*******************************************************************************
|
||||
# Daemon configuration attributes
|
||||
#-------------------------------------------------------------------------------
|
||||
# ONED_PORT: Port to connect to the OpenNebula daemon (oned)
|
||||
#
|
||||
# SCHED_INTERVAL: Seconds between two scheduling actions
|
||||
#
|
||||
# MAX_VM: Maximum number of Virtual Machines scheduled in each scheduling
|
||||
# action
|
||||
#
|
||||
# MAX_DISPATCH: Maximum number of Virtual Machines actually dispatched to a
|
||||
# host in each scheduling action
|
||||
#
|
||||
# MAX_HOST: Maximum number of Virtual Machines dispatched to a given host in
|
||||
# each scheduling action
|
||||
#
|
||||
# DEFAULT_SCHED: Definition of the default scheduling algorithm
|
||||
# - policy:
|
||||
# 0 = Packing. Heuristic that minimizes the number of hosts in use by
|
||||
# packing the VMs in the hosts to reduce VM fragmentation
|
||||
# 1 = Striping. Heuristic that tries to maximize resources available for
|
||||
# the VMs by spreading the VMs in the hosts
|
||||
# 2 = Load-aware. Heuristic that tries to maximize resources available for
|
||||
# the VMs by usingthose nodes with less load
|
||||
# 3 = Custom.
|
||||
# - rank: Custom arithmetic exprission to rank suitable hosts based in their
|
||||
# attributes
|
||||
#*******************************************************************************
|
||||
|
||||
ONED_PORT = 2633
|
||||
|
||||
SCHED_INTERVAL = 30
|
||||
|
||||
MAX_VM = 300
|
||||
|
||||
MAX_DISPATCH = 30
|
||||
|
||||
MAX_HOST = 1
|
||||
|
||||
DEFAULT_SCHED = [
|
||||
policy = 1
|
||||
]
|
||||
|
||||
#DEFAULT_SCHED = [
|
||||
# policy = 3,
|
||||
# rank = "- (RUNNING_VMS / 8 + FREE_CPU)"
|
||||
#]
|
45
src/scheduler/include/SchedulerTemplate.h
Normal file
45
src/scheduler/include/SchedulerTemplate.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef SCHEDULER_TEMPLATE_H_
|
||||
#define SCHEDULER_TEMPLATE_H_
|
||||
|
||||
#include "NebulaTemplate.h"
|
||||
|
||||
|
||||
class SchedulerTemplate : public NebulaTemplate
|
||||
{
|
||||
public:
|
||||
|
||||
SchedulerTemplate(const string& etc_location, const string& _var_location):
|
||||
NebulaTemplate(etc_location, conf_name)
|
||||
{};
|
||||
|
||||
~SchedulerTemplate(){};
|
||||
|
||||
private:
|
||||
/**
|
||||
* Name for the configuration file, oned.conf
|
||||
*/
|
||||
static const char * conf_name;
|
||||
|
||||
/**
|
||||
* Sets the defaults value for the template
|
||||
*/
|
||||
void set_conf_default();
|
||||
};
|
||||
|
||||
#endif /*SCHEDULER_TEMPLATE_H_*/
|
@ -21,7 +21,7 @@ import os
|
||||
|
||||
lib_name='scheduler_sched'
|
||||
|
||||
source_files=['Scheduler.cc']
|
||||
source_files=['Scheduler.cc' , 'SchedulerTemplate.cc']
|
||||
|
||||
# Build library
|
||||
sched_env.StaticLibrary(lib_name, source_files)
|
||||
|
82
src/scheduler/src/sched/SchedulerTemplate.cc
Normal file
82
src/scheduler/src/sched/SchedulerTemplate.cc
Normal file
@ -0,0 +1,82 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#include "NebulaTemplate.h"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
const char * OpenNebulaTemplate::conf_name="sched.conf";
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void OpenNebulaTemplate::set_conf_default()
|
||||
{
|
||||
SingleAttribute * attribute;
|
||||
VectorAttribute * vattribute;
|
||||
string value;
|
||||
|
||||
/*
|
||||
#*******************************************************************************
|
||||
# Daemon configuration attributes
|
||||
#-------------------------------------------------------------------------------
|
||||
# ONED_PORT
|
||||
# SCHED_INTERVAL
|
||||
# MAX_VM
|
||||
# MAX_DISPATCH
|
||||
# MAX_HOST
|
||||
# DEFAULT_SCHED
|
||||
#-------------------------------------------------------------------------------
|
||||
*/
|
||||
// ONED_PORT
|
||||
value = "2633";
|
||||
|
||||
attribute = new SingleAttribute("ONED_PORT",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// SCHED_INTERVAL
|
||||
value = "30";
|
||||
|
||||
attribute = new SingleAttribute("SCHED_INTERVAL",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// MAX_VM
|
||||
value = "300";
|
||||
|
||||
attribute = new SingleAttribute("MAX_VM",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// MAX_DISPATCH
|
||||
value = "30";
|
||||
|
||||
attribute = new SingleAttribute("MAX_DISPATCH",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
//MAX_HOST
|
||||
value = "1";
|
||||
|
||||
attribute = new SingleAttribute("MAX_HOST",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
//DEFAULT_SCHED [0: Packing, 1: Striping, 2: Load-aware, or 3:Custom]
|
||||
map<string,string> vvalue;
|
||||
vvalue.insert(make_pair("POLICY","packing"));
|
||||
|
||||
vattribute = new VectorAttribute("DEFAULT_SCHED",vvalue);
|
||||
conf_default.insert(make_pair(attribute->name(),vattribute));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user