mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Feature #1112: Remove datastore initialization from oned.conf
This commit is contained in:
parent
1e63b6ce4e
commit
7ffae6fb8e
@ -26,13 +26,7 @@ using namespace std;
|
||||
class DatastorePool : public PoolSQL
|
||||
{
|
||||
public:
|
||||
DatastorePool(SqlDB * db,
|
||||
const string& system_base_path,
|
||||
const string& system_type,
|
||||
const string& system_tm_mad,
|
||||
const string& default_base_path,
|
||||
const string& default_type,
|
||||
const string& default_tm_mad);
|
||||
DatastorePool(SqlDB * db);
|
||||
|
||||
~DatastorePool(){};
|
||||
|
||||
|
@ -105,18 +105,6 @@ MAC_PREFIX = "02:00"
|
||||
# vd KVM virtual disk
|
||||
#*******************************************************************************
|
||||
|
||||
SYSTEM_DS = [
|
||||
base_path = "/var/lib/one/system_ds",
|
||||
type = "fs",
|
||||
tm_mad = "tm_shared"
|
||||
]
|
||||
|
||||
DEFAULT_DS = [
|
||||
base_path = "/var/lib/one/images",
|
||||
type = "fs",
|
||||
tm_mad = "tm_shared"
|
||||
]
|
||||
|
||||
DEFAULT_IMAGE_TYPE = "OS"
|
||||
DEFAULT_DEVICE_PREFIX = "hd"
|
||||
|
||||
|
@ -35,13 +35,7 @@ const int DatastorePool::DEFAULT_DS_ID = 1;
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
DatastorePool::DatastorePool(SqlDB * db,
|
||||
const string& system_base_path,
|
||||
const string& system_type,
|
||||
const string& system_tm_mad,
|
||||
const string& default_base_path,
|
||||
const string& default_type,
|
||||
const string& default_tm_mad):
|
||||
DatastorePool::DatastorePool(SqlDB * db):
|
||||
PoolSQL(db, Datastore::table)
|
||||
{
|
||||
ostringstream oss;
|
||||
@ -55,10 +49,10 @@ DatastorePool::DatastorePool(SqlDB * db,
|
||||
|
||||
// Build the default datastores
|
||||
|
||||
oss << "NAME = " << SYSTEM_DS_NAME << endl
|
||||
<< "BASE_PATH = " << system_base_path << endl
|
||||
<< "TYPE = " << system_type << endl
|
||||
<< "TM_MAD = " << system_tm_mad;
|
||||
oss << "NAME = " << SYSTEM_DS_NAME << endl
|
||||
<< "BASE_PATH = /var/lib/one/system_ds" << endl
|
||||
<< "TYPE = fs" << endl
|
||||
<< "TM_MAD = tm_shared";
|
||||
|
||||
ds_tmpl = new DatastoreTemplate;
|
||||
rc = ds_tmpl->parse_str_or_xml(oss.str(), error_str);
|
||||
@ -80,9 +74,9 @@ DatastorePool::DatastorePool(SqlDB * db,
|
||||
oss.str("");
|
||||
|
||||
oss << "NAME = " << DEFAULT_DS_NAME << endl
|
||||
<< "BASE_PATH = " << default_base_path << endl
|
||||
<< "TYPE = " << default_type << endl
|
||||
<< "TM_MAD = " << default_tm_mad;
|
||||
<< "BASE_PATH = /var/lib/one/images" << endl
|
||||
<< "TYPE = fs" << endl
|
||||
<< "TM_MAD = tm_shared";
|
||||
|
||||
ds_tmpl = new DatastoreTemplate;
|
||||
rc = ds_tmpl->parse_str_or_xml(oss.str(), error_str);
|
||||
|
@ -275,16 +275,6 @@ void Nebula::start()
|
||||
string default_device_prefix;
|
||||
time_t expiration_time;
|
||||
|
||||
vector<const Attribute *> system_ds;
|
||||
string system_ds_base_path;
|
||||
string system_ds_type;
|
||||
string system_tm_mad;
|
||||
|
||||
vector<const Attribute *> default_ds;
|
||||
string default_ds_base_path;
|
||||
string default_ds_type;
|
||||
string default_tm_mad;
|
||||
|
||||
vector<const Attribute *> vm_hooks;
|
||||
vector<const Attribute *> host_hooks;
|
||||
vector<const Attribute *> vm_restricted_attrs;
|
||||
@ -323,26 +313,7 @@ void Nebula::start()
|
||||
|
||||
tpool = new VMTemplatePool(db);
|
||||
|
||||
nebula_configuration->get("SYSTEM_DS", system_ds);
|
||||
|
||||
const VectorAttribute * ds_conf =
|
||||
static_cast<const VectorAttribute *>(system_ds[0]);
|
||||
|
||||
system_ds_base_path = ds_conf->vector_value("BASE_PATH");
|
||||
system_ds_type = ds_conf->vector_value("TYPE");
|
||||
system_tm_mad = ds_conf->vector_value("TM_MAD");
|
||||
|
||||
nebula_configuration->get("DEFAULT_DS", default_ds);
|
||||
|
||||
ds_conf = static_cast<const VectorAttribute *>(default_ds[0]);
|
||||
|
||||
default_ds_base_path = ds_conf->vector_value("BASE_PATH");
|
||||
default_ds_type = ds_conf->vector_value("TYPE");
|
||||
default_tm_mad = ds_conf->vector_value("TM_MAD");
|
||||
|
||||
dspool = new DatastorePool(db,
|
||||
system_ds_base_path, system_ds_type, system_tm_mad,
|
||||
default_ds_base_path, default_ds_type, default_tm_mad);
|
||||
dspool = new DatastorePool(db);
|
||||
}
|
||||
catch (exception&)
|
||||
{
|
||||
|
@ -186,24 +186,6 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
# DEFAULT_DEVICE_PREFIX
|
||||
#*******************************************************************************
|
||||
*/
|
||||
//SYSTEM_DS
|
||||
vvalue.clear();
|
||||
vvalue.insert(make_pair("BASE_PATH","/var/lib/one/system_ds"));
|
||||
vvalue.insert(make_pair("TYPE", "fs"));
|
||||
vvalue.insert(make_pair("TM_MAD", "tm_shared"));
|
||||
|
||||
vattribute = new VectorAttribute("SYSTEM_DS",vvalue);
|
||||
conf_default.insert(make_pair(vattribute->name(),vattribute));
|
||||
|
||||
//DEFAULT_DS
|
||||
vvalue.clear();
|
||||
vvalue.insert(make_pair("BASE_PATH","/var/lib/one/images"));
|
||||
vvalue.insert(make_pair("TYPE", "fs"));
|
||||
vvalue.insert(make_pair("TM_MAD", "tm_shared"));
|
||||
|
||||
vattribute = new VectorAttribute("DEFAULT_DS",vvalue);
|
||||
conf_default.insert(make_pair(vattribute->name(),vattribute));
|
||||
|
||||
//DEFAULT_IMAGE_TYPE
|
||||
value = "OS";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user