mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Feature #1112: Add templates to Datastores
This commit is contained in:
parent
9a7d78f7f2
commit
6d360310f4
@ -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
|
||||
|
@ -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>" << base_path << "</BASE_PATH>" <<
|
||||
"<CLUSTER_ID>" << cluster_id << "</CLUSTER_ID>" <<
|
||||
"<CLUSTER>" << cluster << "</CLUSTER>" <<
|
||||
collection_xml <<
|
||||
collection_xml <<
|
||||
obj_template->to_xml(template_xml) <<
|
||||
"</DATASTORE>";
|
||||
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user