diff --git a/include/Datastore.h b/include/Datastore.h index 092ca656ed..489c3bfe17 100644 --- a/include/Datastore.h +++ b/include/Datastore.h @@ -163,13 +163,16 @@ public: VectorAttribute * disk, const vector& inherit_attrs); - /** * Replace template for this object. Object should be updated * after calling this method - * @param tmpl string representation of the template + * @param tmpl_str new contents + * @param keep_restricted If true, the restricted attributes of the + * current template will override the new template + * @param error string describing the error if any + * @return 0 on success */ - int replace_template(const string& tmpl_str, string& error); + int replace_template(const string& tmpl_str, bool keep_restricted, string& error); /** * Set monitor information for the Datastore diff --git a/include/VirtualNetwork.h b/include/VirtualNetwork.h index d9baaea695..d553f26eb6 100644 --- a/include/VirtualNetwork.h +++ b/include/VirtualNetwork.h @@ -358,9 +358,13 @@ public: /** * Replace the template of the virtual network it also updates the BRIDGE, * PHY_DEV, VLAN_ID and VLAN attributes. - * @param tmpl string representation of the template + * @param tmpl_str new contents + * @param keep_restricted If true, the restricted attributes of the + * current template will override the new template + * @param error string describing the error if any + * @return 0 on success */ - int replace_template(const string& tmpl_str, string& error); + int replace_template(const string& tmpl_str, bool keep_restricted, string& error); /** * Gets a string based attribute (single) from an address range. If the diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc index 98c4f976c7..f30bbbf398 100644 --- a/src/datastore/Datastore.cc +++ b/src/datastore/Datastore.cc @@ -584,7 +584,8 @@ int Datastore::from_xml(const string& xml) /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -int Datastore::replace_template(const string& tmpl_str, string& error_str) +int Datastore::replace_template( + const string& tmpl_str, bool keep_restricted, string& error_str) { string new_ds_mad; string new_tm_mad; diff --git a/src/scheduler/src/sched/SConstruct b/src/scheduler/src/sched/SConstruct index f61c2ddfa5..f8eaf32d98 100644 --- a/src/scheduler/src/sched/SConstruct +++ b/src/scheduler/src/sched/SConstruct @@ -38,6 +38,7 @@ sched_env.Prepend(LIBS=[ 'nebula_common', 'nebula_core', 'nebula_template', + 'nebula_vm', 'crypto', 'xml2' ]) diff --git a/src/vnm/VirtualNetwork.cc b/src/vnm/VirtualNetwork.cc index a1936ba579..f319cc703f 100644 --- a/src/vnm/VirtualNetwork.cc +++ b/src/vnm/VirtualNetwork.cc @@ -206,7 +206,8 @@ error_common: /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -int VirtualNetwork::replace_template(const string& tmpl_str, string& error_str) +int VirtualNetwork::replace_template( + const string& tmpl_str, bool keep_restricted, string& error_str) { string new_bridge; bool b_vlan;