diff --git a/include/Datastore.h b/include/Datastore.h index 1f4f88cf9a..39cfa9ef60 100644 --- a/include/Datastore.h +++ b/include/Datastore.h @@ -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 diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 4f99071a3c..400d07ab12 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -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 = [ diff --git a/src/cli/one_helper/onedatastore_helper.rb b/src/cli/one_helper/onedatastore_helper.rb index 38b79b5973..33f812c1a0 100644 --- a/src/cli/one_helper/onedatastore_helper.rb +++ b/src/cli/one_helper/onedatastore_helper.rb @@ -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 diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc index 18013d69d1..f5fbb57dd8 100644 --- a/src/datastore/Datastore.cc +++ b/src/datastore/Datastore.cc @@ -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 << "" << "" << name << "" << perms_to_xml(perms_xml) << - "" << type << "" << + "" << ds_mad << "" << "" << tm_mad << "" << "" << base_path << "" << "" << 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; } diff --git a/src/datastore/DatastorePool.cc b/src/datastore/DatastorePool.cc index d45f1eb0d3..7dfd9fe096 100644 --- a/src/datastore/DatastorePool.cc +++ b/src/datastore/DatastorePool.cc @@ -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; diff --git a/src/datastore_mad/one_datastore.rb b/src/datastore_mad/one_datastore.rb index acbef1839c..295a930bea 100755 --- a/src/datastore_mad/one_datastore.rb +++ b/src/datastore_mad/one_datastore.rb @@ -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