1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-22 22:03:39 +03:00

Feature #4238: Short-hand method to register single

attribute parameters
This commit is contained in:
Jaime Melis 2015-12-18 16:22:53 +01:00
parent 13fa50a38a
commit 5d1262ca66
3 changed files with 54 additions and 187 deletions

View File

@ -176,6 +176,13 @@ private:
* Sets the defaults value for the template
*/
void set_conf_default();
/**
* Sets a default single attribute value
*/
void set_conf_default_single(const std::string& attr,
const std::string& value);
};

View File

@ -57,7 +57,7 @@ LOG = [
debug_level = 3
]
#MANAGER_TIMER = 30
#MANAGER_TIMER = 15
MONITORING_INTERVAL = 60
MONITORING_THREADS = 50

View File

@ -82,22 +82,29 @@ const char * OpenNebulaTemplate::conf_name="oned.conf";
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void OpenNebulaTemplate::set_conf_default()
void OpenNebulaTemplate::set_conf_default_single(const std::string& attr,
const std::string& value)
{
SingleAttribute * attribute;
attribute = new SingleAttribute(attr, value);
conf_default.insert(make_pair(attribute->name(),attribute));
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void OpenNebulaTemplate::set_conf_default()
{
VectorAttribute * vattribute;
string value;
map<string,string> vvalue;
// MANAGER_TIMER
value = "15";
attribute = new SingleAttribute("MANAGER_TIMER",value);
conf_default.insert(make_pair(attribute->name(),attribute));
/*
#*******************************************************************************
# Daemon configuration attributes
#-------------------------------------------------------------------------------
# MANAGER_TIMER
# MONITORING_INTERVAL
# MONITORING_THREADS
# HOST_PER_INTERVAL
@ -113,59 +120,19 @@ void OpenNebulaTemplate::set_conf_default()
# VM_SUBMIT_ON_HOLD
#*******************************************************************************
*/
// MONITORING_INTERVAL
value = "60";
attribute = new SingleAttribute("MONITORING_INTERVAL",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// MONITORING_THREADS
value = "50";
attribute = new SingleAttribute("MONITORING_THREADS",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// HOST_PER_INTERVAL
value = "15";
attribute = new SingleAttribute("HOST_PER_INTERVAL",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// HOST_MONITORING_EXPIRATION_TIME
value = "43200";
attribute = new SingleAttribute("HOST_MONITORING_EXPIRATION_TIME",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// VM_INDIVIDUAL_MONITORING
value = "no";
attribute = new SingleAttribute("VM_INDIVIDUAL_MONITORING",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// VM_PER_INTERVAL
value = "5";
attribute = new SingleAttribute("VM_PER_INTERVAL",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// VM_MONITORING_EXPIRATION_TIME
value = "14400";
attribute = new SingleAttribute("VM_MONITORING_EXPIRATION_TIME",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//XML-RPC Server PORT
value = "2633";
attribute = new SingleAttribute("PORT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//XML-RPC Server listen address
value = "0.0.0.0";
attribute = new SingleAttribute("LISTEN_ADDRESS",value);
conf_default.insert(make_pair(attribute->name(),attribute));
set_conf_default_single("MANAGER_TIMER", "15");
set_conf_default_single("MONITORING_INTERVAL", "60");
set_conf_default_single("MONITORING_THREADS", "50");
set_conf_default_single("HOST_PER_INTERVAL", "15");
set_conf_default_single("HOST_MONITORING_EXPIRATION_TIME", "43200");
set_conf_default_single("VM_INDIVIDUAL_MONITORING", "no");
set_conf_default_single("VM_PER_INTERVAL", "5");
set_conf_default_single("VM_MONITORING_EXPIRATION_TIME", "14400");
set_conf_default_single("PORT", "2633");
set_conf_default_single("LISTEN_ADDRESS", "0.0.0.0");
set_conf_default_single("VNC_BASE_PORT", "5900");
set_conf_default_single("SCRIPTS_REMOTE_DIR", "/var/tmp/one");
set_conf_default_single("VM_SUBMIT_ON_HOLD", "NO");
//DB CONFIGURATION
vvalue.insert(make_pair("BACKEND","sqlite"));
@ -173,24 +140,6 @@ void OpenNebulaTemplate::set_conf_default()
vattribute = new VectorAttribute("DB",vvalue);
conf_default.insert(make_pair(vattribute->name(),vattribute));
//VNC_BASE_PORT
value = "5900";
attribute = new SingleAttribute("VNC_BASE_PORT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//SCRIPTS_REMOTE_DIR
value = "/var/tmp/one";
attribute = new SingleAttribute("SCRIPTS_REMOTE_DIR",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// VM_SUBMIT_ON_HOLD
value = "NO";
attribute = new SingleAttribute("VM_SUBMIT_ON_HOLD",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// LOG CONFIGURATION
vvalue.clear();
vvalue.insert(make_pair("SYSTEM","file"));
@ -244,53 +193,15 @@ void OpenNebulaTemplate::set_conf_default()
# LOG_CALL_FORMAT
#*******************************************************************************
*/
// MAX_CONN
value = "15";
set_conf_default_single("MAX_CONN", "15");
set_conf_default_single("MAX_CONN_BACKLOG", "15");
set_conf_default_single("KEEPALIVE_TIMEOUT", "15");
set_conf_default_single("KEEPALIVE_MAX_CONN", "30");
set_conf_default_single("TIMEOUT", "15");
set_conf_default_single("RPC_LOG", "NO");
set_conf_default_single("MESSAGE_SIZE", "1073741824");
set_conf_default_single("LOG_CALL_FORMAT", "Req:%i UID:%u %m invoked %l");
attribute = new SingleAttribute("MAX_CONN",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// MAX_CONN_BACKLOG
value = "15";
attribute = new SingleAttribute("MAX_CONN_BACKLOG",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// KEEPALIVE_TIMEOUT
value = "15";
attribute = new SingleAttribute("KEEPALIVE_TIMEOUT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// KEEPALIVE_MAX_CONN
value = "30";
attribute = new SingleAttribute("KEEPALIVE_MAX_CONN",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// TIMEOUT
value = "15";
attribute = new SingleAttribute("TIMEOUT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// RPC_LOG
value = "NO";
attribute = new SingleAttribute("RPC_LOG",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//MESSAGE_SIZE
value = "1073741824";
attribute = new SingleAttribute("MESSAGE_SIZE",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//LOG_CALL_FORMAT
value = "Req:%i UID:%u %m invoked %l";
attribute = new SingleAttribute("LOG_CALL_FORMAT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
/*
#*******************************************************************************
# Physical Networks configuration
@ -299,17 +210,9 @@ void OpenNebulaTemplate::set_conf_default()
# MAC_PREFIX
#*******************************************************************************
*/
//MAC_PREFIX
value = "02:00";
attribute = new SingleAttribute("MAC_PREFIX",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//NETWORK_SIZE
value = "254";
attribute = new SingleAttribute("NETWORK_SIZE",value);
conf_default.insert(make_pair(attribute->name(),attribute));
set_conf_default_single("MAC_PREFIX", "02:00");
set_conf_default_single("NETWORK_SIZE", "254");
/*
#*******************************************************************************
@ -323,37 +226,13 @@ void OpenNebulaTemplate::set_conf_default()
# DEFAULT_CDROM_DEVICE_PREFIX
#*******************************************************************************
*/
//DATASTORE_LOCATION
attribute = new SingleAttribute("DATASTORE_LOCATION",
var_location + "/datastores");
conf_default.insert(make_pair(attribute->name(),attribute));
set_conf_default_single("DATASTORE_LOCATION", var_location + "/datastores");
set_conf_default_single("DATASTORE_BASE_PATH", var_location + "/datastores");
set_conf_default_single("DATASTORE_CAPACITY_CHECK", "YES");
set_conf_default_single("DEFAULT_IMAGE_TYPE", "OS");
set_conf_default_single("DEFAULT_DEVICE_PREFIX", "hd");
set_conf_default_single("DEFAULT_CDROM_DEVICE_PREFIX", "hd");
//DATASTORE_BASE_PATH
attribute = new SingleAttribute("DATASTORE_BASE_PATH",
var_location + "/datastores");
conf_default.insert(make_pair(attribute->name(),attribute));
//DATASTORE_CAPACITY_CHECK
value = "YES";
attribute = new SingleAttribute("DATASTORE_CAPACITY_CHECK",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//DEFAULT_IMAGE_TYPE
value = "OS";
attribute = new SingleAttribute("DEFAULT_IMAGE_TYPE",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//DEFAULT_DEVICE_PREFIX
value = "hd";
attribute = new SingleAttribute("DEFAULT_DEVICE_PREFIX",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//DEFAULT_CDROM_DEVICE_PREFIX
attribute = new SingleAttribute("DEFAULT_CDROM_DEVICE_PREFIX",value);
conf_default.insert(make_pair(attribute->name(),attribute));
/*
#*******************************************************************************
# Auth Manager Configuration
@ -364,29 +243,10 @@ void OpenNebulaTemplate::set_conf_default()
# DEFAULT_UMASK
#*******************************************************************************
*/
// DEFAULT_AUTH
value = "default";
attribute = new SingleAttribute("DEFAULT_AUTH",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// SESSION_EXPIRATION_TIME
value = "0";
attribute = new SingleAttribute("SESSION_EXPIRATION_TIME",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// ENABLE_OTHER_PERMISSIONS
value = "YES";
attribute = new SingleAttribute("ENABLE_OTHER_PERMISSIONS",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// DEFAULT_UMASK
value = "177";
attribute = new SingleAttribute("DEFAULT_UMASK",value);
conf_default.insert(make_pair(attribute->name(),attribute));
set_conf_default_single("DEFAULT_AUTH", "default");
set_conf_default_single("SESSION_EXPIRATION_TIME", "0");
set_conf_default_single("ENABLE_OTHER_PERMISSIONS", "YES");
set_conf_default_single("DEFAULT_UMASK", "177");
}
/* -------------------------------------------------------------------------- */