mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-27 13:57:23 +03:00
bug #284: Default location for the image repository
(cherry picked from commit 8b9313699d9f07ff4198caddc9095f1bb3734899) (cherry picked from commit 4f93062accb94032eb80febc48706a586d5db7b6)
This commit is contained in:
parent
04874dbf7a
commit
b3857b1d22
@ -82,7 +82,7 @@ MAC_PREFIX = "02:00"
|
||||
# vd KVM virtual disk
|
||||
#*******************************************************************************
|
||||
|
||||
IMAGE_REPOSITORY_PATH = [IMAGES_LOCATION]
|
||||
#IMAGE_REPOSITORY_PATH = /srv/cloud/var/images
|
||||
DEFAULT_IMAGE_TYPE = "OS"
|
||||
DEFAULT_DEVICE_PREFIX = "hd"
|
||||
|
||||
|
@ -235,12 +235,6 @@ void Nebula::start()
|
||||
upool = new UserPool(db);
|
||||
|
||||
nebula_configuration->get("IMAGE_REPOSITORY_PATH", repository_path);
|
||||
|
||||
if (repository_path.empty()) // Defaults to ONE_LOCATION/var
|
||||
{
|
||||
repository_path = var_location;
|
||||
}
|
||||
|
||||
nebula_configuration->get("DEFAULT_IMAGE_TYPE", default_image_type);
|
||||
nebula_configuration->get("DEFAULT_DEVICE_PREFIX",
|
||||
default_device_prefix);
|
||||
|
@ -31,60 +31,114 @@ NebulaTemplate::NebulaTemplate(string& etc_location, string& var_location)
|
||||
{
|
||||
ostringstream os;
|
||||
SingleAttribute * attribute;
|
||||
VectorAttribute * vattribute;
|
||||
string value;
|
||||
|
||||
conf_file = etc_location + conf_name;
|
||||
|
||||
// MANAGER_TIMER
|
||||
value = "15";
|
||||
|
||||
attribute = new SingleAttribute("MANAGER_TIMER",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
/*
|
||||
#*******************************************************************************
|
||||
# Daemon configuration attributes
|
||||
#-------------------------------------------------------------------------------
|
||||
# HOST_MONITORING_INTERVAL
|
||||
# VM_POLLING_INTERVAL
|
||||
# VM_DIR
|
||||
# PORT
|
||||
# DB
|
||||
# VNC_BASE_PORT
|
||||
#*******************************************************************************
|
||||
*/
|
||||
// MONITOR_INTERVAL
|
||||
value = "600";
|
||||
|
||||
attribute = new SingleAttribute("HOST_MONITORING_INTERVAL",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// POLL_INTERVAL
|
||||
value = "300";
|
||||
|
||||
value = "600";
|
||||
|
||||
attribute = new SingleAttribute("VM_POLLING_INTERVAL",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// MANAGER_TIMER
|
||||
value = "30";
|
||||
|
||||
attribute = new SingleAttribute("MANAGER_TIMER",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// MONITOR_INTERVAL
|
||||
value = "300";
|
||||
|
||||
attribute = new SingleAttribute("HOST_MONITORING_INTERVAL",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));
|
||||
|
||||
//VM_DIR
|
||||
//VM_DIR
|
||||
attribute = new SingleAttribute("VM_DIR",var_location);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
//MAC_PREFIX
|
||||
value = "00:01";
|
||||
|
||||
attribute = new SingleAttribute("MAC_PREFIX",value);
|
||||
|
||||
//XML-RPC Server PORT
|
||||
value = "2633";
|
||||
|
||||
attribute = new SingleAttribute("PORT",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));
|
||||
//DB CONFIGURATION
|
||||
map<string,string> vvalue;
|
||||
vvalue.insert(make_pair("BACKEND","sqlite"));
|
||||
|
||||
//NETWORK_SIZE
|
||||
vattribute = new VectorAttribute("DB",vvalue);
|
||||
conf_default.insert(make_pair(attribute->name(),vattribute));
|
||||
|
||||
//VNC_BASE_PORT
|
||||
value = "5900";
|
||||
|
||||
attribute = new SingleAttribute("VNC_BASE_PORT",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
//DEBUG_LEVEL
|
||||
value = Log::WARNING;
|
||||
|
||||
attribute = new SingleAttribute("DEBUG_LEVEL",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));
|
||||
/*
|
||||
#*******************************************************************************
|
||||
# Physical Networks configuration
|
||||
#*******************************************************************************
|
||||
# NETWORK_SIZE
|
||||
# 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));
|
||||
|
||||
/*
|
||||
#*******************************************************************************
|
||||
# Image Repository Configuration
|
||||
#*******************************************************************************
|
||||
# IMAGE_REPOSITORY_PATH
|
||||
# DEFAULT_IMAGE_TYPE
|
||||
# DEFAULT_DEVICE_PREFIX
|
||||
#*******************************************************************************
|
||||
*/
|
||||
//IMAGE_REPOSITORY_PATH
|
||||
value = var_location + "/images";
|
||||
|
||||
attribute = new SingleAttribute("IMAGE_REPOSITORY_PATH",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));
|
||||
}
|
||||
|
||||
@ -95,31 +149,31 @@ NebulaTemplate::NebulaTemplate(string& etc_location, string& var_location)
|
||||
int NebulaTemplate::load_configuration()
|
||||
{
|
||||
char * error = 0;
|
||||
map<string, Attribute *>::iterator iter, j;
|
||||
map<string, Attribute *>::iterator iter, j;
|
||||
int rc;
|
||||
|
||||
|
||||
string aname;
|
||||
Attribute * attr;
|
||||
|
||||
|
||||
rc = parse(conf_file.c_str(), &error);
|
||||
|
||||
|
||||
if ( rc != 0 && error != 0)
|
||||
{
|
||||
|
||||
cout << "\nError while parsing configuration file:\n" << error << endl;
|
||||
|
||||
free(error);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for(iter=conf_default.begin();iter!=conf_default.end();)
|
||||
{
|
||||
aname = iter->first;
|
||||
attr = iter->second;
|
||||
|
||||
|
||||
j = attributes.find(aname);
|
||||
|
||||
|
||||
if ( j == attributes.end() )
|
||||
{
|
||||
attributes.insert(make_pair(aname,attr));
|
||||
@ -131,7 +185,7 @@ int NebulaTemplate::load_configuration()
|
||||
conf_default.erase(iter++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user