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

feature #2092: Datastore gets its base path from DATASTORE_LOCATION in Datastore template or from oned.conf

This commit is contained in:
Tino Vazquez 2013-10-03 15:53:04 +02:00
parent 866c6afe5b
commit 876c58e327

View File

@ -135,6 +135,7 @@ int Datastore::insert(SqlDB *db, string& error_str)
ostringstream oss;
string s_disk_type;
string s_ds_type;
string datastore_location;
// -------------------------------------------------------------------------
// Check default datastore attributes
@ -168,6 +169,27 @@ int Datastore::insert(SqlDB *db, string& error_str)
goto error_tm;
}
get_template_attribute("DATASTORE_LOCATION", datastore_location);
if (datastore_location.empty() == true )
{
Nebula& nd = Nebula::instance();
nd.get_configuration_attribute("DATASTORE_LOCATION", datastore_location);
}
// If default value provided, use it
// If not, default to /var/lib/one (already present in base_path)
if (datastore_location.empty() != true )
{
base_path = datastore_location;
}
if ( base_path.at(base_path.size()-1) != '/' )
{
base_path += "/";
}
oss << base_path << oid; //base_path points to ds_location - constructor
base_path = oss.str();