1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-08 21:17:43 +03:00

feature #1617: Create a FILE datastore when bootstraping OpenNebula

This commit is contained in:
Ruben S. Montero 2012-11-18 00:47:48 +01:00
parent d063e6e4de
commit dd914b687c
2 changed files with 58 additions and 0 deletions

View File

@ -54,6 +54,16 @@ public:
*/ */
static const int DEFAULT_DS_ID; static const int DEFAULT_DS_ID;
/**
* Name for the file datastore
*/
static const string FILE_DS_NAME;
/**
* Identifier for the file datastore
*/
static const int FILE_DS_ID;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Methods for DB management */ /* Methods for DB management */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -32,6 +32,9 @@ const int DatastorePool::SYSTEM_DS_ID = 0;
const string DatastorePool::DEFAULT_DS_NAME = "default"; const string DatastorePool::DEFAULT_DS_NAME = "default";
const int DatastorePool::DEFAULT_DS_ID = 1; const int DatastorePool::DEFAULT_DS_ID = 1;
const string DatastorePool::FILE_DS_NAME = "files";
const int DatastorePool::FILE_DS_ID = 2;
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -124,6 +127,51 @@ DatastorePool::DatastorePool(SqlDB * db):
ds->unlock(); ds->unlock();
// ---------------------------------------------------------------------
// Create the default file datastore
// ---------------------------------------------------------------------
oss.str("");
oss << "NAME = " << FILE_DS_NAME << endl
<< "TYPE = FILE_DS" << endl
<< "DS_MAD = fs" << endl
<< "TM_MAD = ssh";
ds_tmpl = new DatastoreTemplate;
rc = ds_tmpl->parse_str_or_xml(oss.str(), error_str);
if( rc < 0 )
{
goto error_bootstrap;
}
allocate(UserPool::ONEADMIN_ID,
GroupPool::ONEADMIN_ID,
UserPool::oneadmin_name,
GroupPool::ONEADMIN_NAME,
ds_tmpl,
&rc,
ClusterPool::NONE_CLUSTER_ID,
ClusterPool::NONE_CLUSTER_NAME,
error_str);
if( rc < 0 )
{
goto error_bootstrap;
}
ds = get(rc, true);
ds->set_permissions(
-1,-1,-1,
-1,-1,-1,
1,-1,-1,
error_str);
update(ds);
ds->unlock();
// User created datastores will start from ID 100 // User created datastores will start from ID 100
set_update_lastOID(99); set_update_lastOID(99);
} }