1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-02 09:47:00 +03:00

Feature #4369: Remove datastore_location setting by cluster

This commit is contained in:
Carlos Martín 2016-03-16 13:07:10 +01:00
parent ac5b0ff526
commit b715c4f773
9 changed files with 12 additions and 87 deletions

View File

@ -30,15 +30,6 @@ using namespace std;
class Cluster : public PoolObjectSQL
{
public:
/**
* Returns the DATASTORE_LOCATION for the hosts of the cluster. If not
* defined that in oned.conf is returned.
*
* @param ds_location string to copy the DATASTORE_LOCATION to
* @return DATASTORE_LOCATION
*/
string& get_ds_location(string &ds_location);
// *************************************************************************
// Object Collections (Public)
// *************************************************************************

View File

@ -68,22 +68,6 @@ public:
return cluster_ids.to_xml(xml);
};
//==========================================================================
// TODO remove
/**
* Returns the cluster ID
*
* @return The cluster ID
*/
int get_cluster_id() const
{
//return ClusterPool::NONE_CLUSTER_ID;
return -1;
};
//==========================================================================
protected:
Clusterable(const set<int> &_cluster_ids):

View File

@ -281,7 +281,7 @@ public:
*
*
*/
int get_ds_location(int cluster_id, string& dsloc);
void get_ds_location(string& dsloc);
/**
* Returns the default vms location. When ONE_LOCATION is defined this path

View File

@ -196,9 +196,6 @@ MAC_PREFIX = "02:00"
# HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or
# $ONE_LOCATION/var/datastores in self-contained mode)
#
# You can define a different DATASTORE_LOCATION in each cluster by updating
# its properties with onecluster update.
#
# DATASTORE_BASE_PATH: This is the base path for the SOURCE attribute of
# the images registered in a Datastore. This is a default value, that can be
# changed when the datastore is created.

View File

@ -117,23 +117,6 @@ error_common:
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
string& Cluster::get_ds_location(string &ds_location)
{
obj_template->get("DATASTORE_LOCATION", ds_location);
if ( ds_location.empty() == true )
{
Nebula& nd = Nebula::instance();
nd.get_configuration_attribute("DATASTORE_LOCATION", ds_location);
}
return ds_location;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int Cluster::add_datastore(int id, string& error_msg)
{
int rc = datastores.add(id);

View File

@ -361,7 +361,6 @@ void InformationManager::timer_action()
string name = host->get_name();
int oid = host->get_oid();
int cluster_id = host->get_cluster_id();
string dsloc;
@ -377,10 +376,7 @@ void InformationManager::timer_action()
host->unlock();
if (nd.get_ds_location(cluster_id, dsloc) == -1)
{
continue;
}
nd.get_ds_location(dsloc);
imd->monitor(oid, name, dsloc, update_remotes);
}

View File

@ -191,7 +191,6 @@ void ImageManager::monitor_datastore(int ds_id)
string ds_data, ds_location, ds_name;
string* drv_msg;
int cluster_id;
bool shared;
Nebula& nd = Nebula::instance();
@ -220,7 +219,6 @@ void ImageManager::monitor_datastore(int ds_id)
ds->to_xml(ds_data);
cluster_id = ds->get_cluster_id();
shared = ds->is_shared();
ds_type = ds->get_type();
ds_name = ds->get_name();
@ -237,13 +235,13 @@ void ImageManager::monitor_datastore(int ds_id)
return;
}
if ( nd.get_ds_location(cluster_id, ds_location) != -1 )
{
nd.get_ds_location(ds_location);
oss << "<DATASTORE_LOCATION>"
<< ds_location
<< "</DATASTORE_LOCATION>";
ds_location = oss.str();
}
break;
case Datastore::FILE_DS:

View File

@ -1039,29 +1039,11 @@ NebulaLog::LogType Nebula::get_log_system() const
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int Nebula::get_ds_location(int cluster_id, string& dsloc)
{
if ( cluster_id != -1 )
{
Cluster * cluster = clpool->get(cluster_id, true);
if ( cluster == 0 )
{
return -1;
}
cluster->get_ds_location(dsloc);
cluster->unlock();
}
else
void Nebula::get_ds_location(string& dsloc)
{
get_configuration_attribute("DATASTORE_LOCATION", dsloc);
}
return 0;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -362,13 +362,7 @@ int RequestManagerVirtualMachine::get_host_information(
host->unlock();
if (nd.get_ds_location(cluster_id, ds_location) == -1)
{
att.resp_obj = PoolObjectSQL::CLUSTER;
att.resp_id = cluster_id;
failure_response(NO_EXISTS, att);
return -1;
}
nd.get_ds_location(ds_location);
return 0;
}