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:
parent
d063e6e4de
commit
dd914b687c
@ -54,6 +54,16 @@ public:
|
||||
*/
|
||||
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 */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -32,6 +32,9 @@ const int DatastorePool::SYSTEM_DS_ID = 0;
|
||||
const string DatastorePool::DEFAULT_DS_NAME = "default";
|
||||
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();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 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
|
||||
set_update_lastOID(99);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user