diff --git a/include/DatastorePool.h b/include/DatastorePool.h index 05d261749a..7942b48281 100644 --- a/include/DatastorePool.h +++ b/include/DatastorePool.h @@ -81,6 +81,7 @@ public: * @param cluster_id the id of the cluster this Datastore will belong to * @param cluster_name the name of the cluster this Datastore will belong to * @param ds_location for hosts in the cluster. defaults to oned.conf. + * It will be modified to incude a trailing '/' if missing. * @param error_str Returns the error reason, if any * * @return the oid assigned to the object, -1 in case of failure @@ -95,7 +96,7 @@ public: int * oid, int cluster_id, const string& cluster_name, - const string& ds_location, + string& ds_location, string& error_str); /** diff --git a/src/datastore/DatastorePool.cc b/src/datastore/DatastorePool.cc index 3ab51ed9b0..260fe53ae2 100644 --- a/src/datastore/DatastorePool.cc +++ b/src/datastore/DatastorePool.cc @@ -50,7 +50,8 @@ DatastorePool::DatastorePool(SqlDB * db): { DatastoreTemplate * ds_tmpl; - int rc; + string ds_location = nd.get_ds_location(); + int rc; // --------------------------------------------------------------------- // Create the system datastore @@ -77,7 +78,7 @@ DatastorePool::DatastorePool(SqlDB * db): &rc, ClusterPool::NONE_CLUSTER_ID, ClusterPool::NONE_CLUSTER_NAME, - nd.get_ds_location(), + ds_location, error_str); if( rc < 0 ) @@ -112,7 +113,7 @@ DatastorePool::DatastorePool(SqlDB * db): &rc, ClusterPool::NONE_CLUSTER_ID, ClusterPool::NONE_CLUSTER_NAME, - nd.get_ds_location(), + ds_location, error_str); if( rc < 0 ) @@ -147,7 +148,7 @@ DatastorePool::DatastorePool(SqlDB * db): &rc, ClusterPool::NONE_CLUSTER_ID, ClusterPool::NONE_CLUSTER_NAME, - nd.get_ds_location(), + ds_location, error_str); if( rc < 0 ) @@ -182,7 +183,7 @@ int DatastorePool::allocate( int * oid, int cluster_id, const string& cluster_name, - const string& ds_location, + string& ds_location, string& error_str) { Datastore * ds; @@ -192,6 +193,11 @@ int DatastorePool::allocate( ostringstream oss; + if (*ds_location.rbegin() != '/' ) + { + ds_location += '/'; + } + ds = new Datastore(uid, gid, uname, gname, umask, ds_template, cluster_id, cluster_name, ds_location);