diff --git a/src/cli/one_helper/onedatastore_helper.rb b/src/cli/one_helper/onedatastore_helper.rb
index 5f117a6885..208aeb7b29 100644
--- a/src/cli/one_helper/onedatastore_helper.rb
+++ b/src/cli/one_helper/onedatastore_helper.rb
@@ -75,5 +75,9 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
datastore.img_ids.each do |id|
puts "%-15s" % [id]
end
+
+ puts
+ CLIHelper.print_header(str_h1 % "DATASTORE TEMPLATE",false)
+ puts datastore.template_str
end
end
diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc
index 14d75fcfe0..fa81ddb0e1 100644
--- a/src/datastore/Datastore.cc
+++ b/src/datastore/Datastore.cc
@@ -110,8 +110,6 @@ int Datastore::insert(SqlDB *db, string& error_str)
base_path = oss.str();
- replace_template_attribute("BASE_PATH", base_path);
-
//--------------------------------------------------------------------------
// Insert the Datastore
//--------------------------------------------------------------------------
@@ -228,6 +226,7 @@ string& Datastore::to_xml(string& xml) const
{
ostringstream oss;
string collection_xml;
+ string template_xml;
ObjectCollection::to_xml(collection_xml);
@@ -240,7 +239,8 @@ string& Datastore::to_xml(string& xml) const
"" << base_path << "" <<
"" << cluster_id << "" <<
"" << cluster << "" <<
- collection_xml <<
+ collection_xml <<
+ obj_template->to_xml(template_xml) <<
"";
xml = oss.str();
@@ -284,6 +284,19 @@ int Datastore::from_xml(const string& xml)
// Set of IDs
rc += ObjectCollection::from_xml_node(content[0]);
+ ObjectXML::free_nodes(content);
+ content.clear();
+
+ // Get associated classes
+ ObjectXML::get_nodes("/DATASTORE/TEMPLATE", content);
+
+ if (content.empty())
+ {
+ return -1;
+ }
+
+ rc += obj_template->from_xml_node(content[0]);
+
ObjectXML::free_nodes(content);
if (rc != 0)