From 1bb6d434645dc3e0639f00760c46ab49e86fa269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 2 Mar 2012 19:10:41 +0100 Subject: [PATCH] Feature #1112: Create system and default datastores in cluster 'none' --- src/datastore/DatastorePool.cc | 44 +++++++--------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/src/datastore/DatastorePool.cc b/src/datastore/DatastorePool.cc index 9897f80790..d45f1eb0d3 100644 --- a/src/datastore/DatastorePool.cc +++ b/src/datastore/DatastorePool.cc @@ -45,11 +45,7 @@ DatastorePool::DatastorePool(SqlDB * db): { DatastoreTemplate * ds_tmpl; - int rc, system_id, default_id; - Nebula& nd = Nebula::instance(); - - ClusterPool * clpool = nd.get_clpool(); - Cluster * cluster; + int rc; // --------------------------------------------------------------------- // Create the system datastore @@ -72,12 +68,12 @@ DatastorePool::DatastorePool(SqlDB * db): UserPool::oneadmin_name, GroupPool::ONEADMIN_NAME, ds_tmpl, - &system_id, - ClusterPool::DEFAULT_CLUSTER_ID, - ClusterPool::DEFAULT_CLUSTER_NAME, + &rc, + ClusterPool::NONE_CLUSTER_ID, + ClusterPool::NONE_CLUSTER_NAME, error_str); - if( system_id < 0 ) + if( rc < 0 ) { goto error_bootstrap; } @@ -104,38 +100,16 @@ DatastorePool::DatastorePool(SqlDB * db): UserPool::oneadmin_name, GroupPool::ONEADMIN_NAME, ds_tmpl, - &default_id, - ClusterPool::DEFAULT_CLUSTER_ID, - ClusterPool::DEFAULT_CLUSTER_NAME, + &rc, + ClusterPool::NONE_CLUSTER_ID, + ClusterPool::NONE_CLUSTER_NAME, error_str); - if( default_id < 0 ) + if( rc < 0 ) { goto error_bootstrap; } - // Add to Cluster - cluster = clpool->get(ClusterPool::DEFAULT_CLUSTER_ID, true); - - if( cluster == 0 ) - { - error_str = "Could not get default cluster"; - goto error_bootstrap; - } - - rc = cluster->add_datastore(system_id, error_str); - rc += cluster->add_datastore(default_id, error_str); - - if ( rc != 0 ) - { - cluster->unlock(); - goto error_bootstrap; - } - - clpool->update(cluster); - - cluster->unlock(); - // User created datastores will start from ID 100 set_update_lastOID(99); }