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

Feature #1112: Renamge DATASTORE/TYPE to DS_MAD

This commit is contained in:
Carlos Martín 2012-03-06 15:13:55 +01:00
parent bb2b9371a0
commit 51cec846bf
6 changed files with 27 additions and 19 deletions

View File

@ -111,9 +111,9 @@ private:
// *************************************************************************
/**
* Type of driver
* Name of the datastore driver used to register new images
*/
string type;
string ds_mad;
/**
* Name of the TM driver used to transfer file to and from the hosts

View File

@ -293,7 +293,7 @@ TM_MAD = [
#
# arguments : for the driver executable
# -t number of threads, i.e. number of repo operations at the same time
# -d datastore types separated by commas
# -d datastore mads separated by commas
#*******************************************************************************
DATASTORE_MAD = [

View File

@ -70,7 +70,7 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
puts str % ["GROUP", datastore['GNAME']]
puts str % ["CLUSTER", datastore['CLUSTER']]
puts str % ["TYPE", datastore['TYPE']]
puts str % ["DS_MAD", datastore['DS_MAD']]
puts str % ["TM_MAD", datastore['TM_MAD']]
puts str % ["BASE PATH",datastore['BASE_PATH']]
puts

View File

@ -45,7 +45,7 @@ Datastore::Datastore(
PoolObjectSQL(-1,DATASTORE,"",uid,gid,uname,gname,table),
ObjectCollection("IMAGES"),
Clusterable(cluster_id, cluster_name),
type(""),
ds_mad(""),
tm_mad(""),
base_path("")
{
@ -104,11 +104,11 @@ int Datastore::insert(SqlDB *db, string& error_str)
erase_template_attribute("NAME", name);
// NAME is checked in DatastorePool::allocate
get_template_attribute("TYPE", type);
get_template_attribute("DS_MAD", ds_mad);
if ( type.empty() == true )
if ( ds_mad.empty() == true )
{
goto error_type;
goto error_ds;
}
get_template_attribute("TM_MAD", tm_mad);
@ -130,8 +130,8 @@ int Datastore::insert(SqlDB *db, string& error_str)
return rc;
error_type:
error_str = "No TYPE in template.";
error_ds:
error_str = "No DS_MAD in template.";
goto error_common;
error_tm:
@ -248,7 +248,7 @@ string& Datastore::to_xml(string& xml) const
"<GNAME>" << gname << "</GNAME>" <<
"<NAME>" << name << "</NAME>" <<
perms_to_xml(perms_xml) <<
"<TYPE>" << type << "</TYPE>" <<
"<DS_MAD>" << ds_mad << "</DS_MAD>" <<
"<TM_MAD>" << tm_mad << "</TM_MAD>" <<
"<BASE_PATH>" << base_path << "</BASE_PATH>" <<
"<CLUSTER_ID>" << cluster_id << "</CLUSTER_ID>" <<
@ -280,7 +280,7 @@ int Datastore::from_xml(const string& xml)
rc += xpath(uname, "/DATASTORE/UNAME", "not_found");
rc += xpath(gname, "/DATASTORE/GNAME", "not_found");
rc += xpath(name, "/DATASTORE/NAME", "not_found");
rc += xpath(type, "/DATASTORE/TYPE", "not_found");
rc += xpath(ds_mad, "/DATASTORE/DS_MAD", "not_found");
rc += xpath(tm_mad, "/DATASTORE/TM_MAD", "not_found");
rc += xpath(base_path, "/DATASTORE/BASE_PATH", "not_found");
@ -329,7 +329,7 @@ int Datastore::from_xml(const string& xml)
int Datastore::replace_template(const string& tmpl_str, string& error)
{
string new_type;
string new_ds_mad;
string new_tm_mad;
int rc;
@ -341,11 +341,15 @@ int Datastore::replace_template(const string& tmpl_str, string& error)
return rc;
}
get_template_attribute("TYPE", new_type);
get_template_attribute("DS_MAD", new_ds_mad);
if ( !new_type.empty() )
if ( !new_ds_mad.empty() )
{
type = new_type;
ds_mad = new_ds_mad;
}
else
{
replace_template_attribute("DS_MAD", ds_mad);
}
get_template_attribute("TM_MAD", new_tm_mad);
@ -354,6 +358,10 @@ int Datastore::replace_template(const string& tmpl_str, string& error)
{
tm_mad = new_tm_mad;
}
else
{
replace_template_attribute("TM_MAD", tm_mad);
}
return 0;
}

View File

@ -52,7 +52,7 @@ DatastorePool::DatastorePool(SqlDB * db):
// ---------------------------------------------------------------------
oss << "NAME = " << SYSTEM_DS_NAME << endl
<< "TYPE = fs" << endl
<< "DS_MAD = fs" << endl
<< "TM_MAD = shared";
ds_tmpl = new DatastoreTemplate;
@ -84,7 +84,7 @@ DatastorePool::DatastorePool(SqlDB * db):
oss.str("");
oss << "NAME = " << DEFAULT_DS_NAME << endl
<< "TYPE = fs" << endl
<< "DS_MAD = fs" << endl
<< "TM_MAD = shared";
ds_tmpl = new DatastoreTemplate;

View File

@ -137,7 +137,7 @@ class DatastoreDriver < OpenNebulaDriver
message = Base64.decode64(drv_message)
xml_doc = REXML::Document.new(message)
dsxml = xml_doc.root.elements['/DS_DRIVER_ACTION_DATA/DATASTORE/TYPE']
dsxml = xml_doc.root.elements['/DS_DRIVER_ACTION_DATA/DATASTORE/DS_MAD']
dstxt = dsxml.text if dsxml
return dstxt