mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
feature #2097: Checks trailing character in ds_location before creating a new datastore. Adds '/' if needed.
This commit is contained in:
parent
c6756c659b
commit
c3861de27a
@ -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);
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user